forked from OpenRA/OpenRA
/
UpdatePath.cs
190 lines (175 loc) · 6.41 KB
/
UpdatePath.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#region Copyright & License Information
/*
* Copyright 2007-2019 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using OpenRA.Mods.Common.UpdateRules.Rules;
namespace OpenRA.Mods.Common.UpdateRules
{
public class UpdatePath
{
// Define known update paths from stable tags to the current bleed tip
//
// This file should be maintained separately on prep branches vs bleed.
// The bleed version of this file should ignore the presence of the prep branch
// and list rules from the playtest that forked the prep branch and current bleed.
// The prep branch should maintain its own list of rules along the prep branch
// until the eventual final release.
//
// When a final release has been tagged the update paths from the prep branch
// can be merged back into bleed by replacing the forking-playtest-to-bleed path
// with the prep playtest-to-playtest-to-release paths and finally a new/modified
// release-to-bleed path.
[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1118:ParameterMustNotSpanMultipleLines",
Justification = "Extracting update lists to temporary variables obfuscates the definitions.")]
static readonly UpdatePath[] Paths =
{
new UpdatePath("release-20171014", "release-20180218", new UpdateRule[]
{
new LegacyBetaWarning(),
new RemoveMobileOnRails(),
new AircraftCanHoverGeneralization(),
new AddNukeLaunchAnimation(),
new RenameWithTurreted(),
new RemovePlayerPaletteTileset(),
new CapturableChanges(),
new DecoupleSelfReloading(),
new RemoveOutOfAmmo(),
new ChangeCanPowerDown(),
new ReplaceRequiresPower(),
new DropPauseAnimationWhenDisabled(),
new ChangeBuildableArea(),
new MoveVisualBounds(),
new ScaleDefaultModHealth(),
new ReworkCheckboxes(),
new SplitGateFromBuilding(),
new RemoveIDisable(),
new ReplaceCanPowerDown(),
new ScaleSupportPowerSecondsToTicks(),
new WarnAboutInfiltrateForTypes(),
new RenameBurstDelay(),
}),
new UpdatePath("release-20180218", "release-20180307", new UpdateRule[0]),
new UpdatePath("release-20180307", "release-20180923", new UpdateRule[]
{
new RemoveTerrainTypeIsWaterFlag(),
new DefineSquadExcludeHarvester(),
new RemoveWeaponScanRadius(),
new SplitAimAnimations(),
new DefineSoundDefaults(),
new RenameWormSpawner(),
new RemoveWithReloadingSpriteTurret(),
new ChangeIntensityToDuration(),
new IgnoreAbstractActors(),
new AddShakeToBridge(),
new RemovePaletteFromCurrentTileset(),
new DefineLocomotors(),
new DefineOwnerLostAction(),
new RenameEmitInfantryOnSell(),
new SplitRepairDecoration(),
new MoveHackyAISupportPowerDecisions(),
new DefineGroundCorpseDefault(),
new RemoveCanUndeployFromGrantConditionOnDeploy(),
}),
new UpdatePath("release-20180923", "release-20181215", new UpdateRule[0]),
new UpdatePath("release-20181215", "release-20190314", new UpdateRule[]
{
new AddCarryableHarvester(),
new RenameEditorTilesetFilter(),
new DefineNotificationDefaults(),
new MergeRearmAndRepairAnimation(),
new MergeCaptureTraits(),
new RemovedNotifyBuildComplete(),
new LowPowerSlowdownToModifier(),
new ChangeTakeOffSoundAndLandingSound(),
new RemoveHealthPercentageRing(),
new RenameCrateActionNotification(),
new RemoveRepairBuildingsFromAircraft(),
new AddRearmable(),
new MergeAttackPlaneAndHeli(),
new RemovedDemolishLocking(),
new RequireProductionType(),
new CloakRequiresConditionToPause(),
new ExtractHackyAIModules(),
new RemoveNegativeDamageFullHealthCheck(),
new RemoveResourceExplodeModifier(),
new DefineLevelUpImageDefault(),
new RemovedAutoCarryallCircleTurnSpeed(),
new RemoveAttackIgnoresVisibility(),
new ReplacedWithChargeAnimation(),
new RefactorResourceLevelAnimating(),
new RemoveAttackSuicides(),
}),
new UpdatePath("release-20190314", "release-20191117", new UpdateRule[]
{
new MultipleDeploySounds(),
new RemoveSimpleBeacon(),
new MakeMobilePausableConditional(),
new StreamlineRepairableTraits(),
new ReplaceSpecialMoveConsiderations(),
new RefactorHarvesterIdle(),
new SplitHarvesterSpriteBody(),
new RenameAttackMoveConditions(),
new RemovePlaceBuildingPalettes(),
new RenameHoversOffsetModifier(),
new AddAirAttackTypes(),
new MoveAbortOnResupply(),
new RenameCarryallDelays(),
new AddCanSlide(),
new AddAircraftIdleBehavior(),
new RenameSearchRadius(),
new RenameChronoshiftFootprint(),
new RemoveMoveIntoWorldFromExit(),
}),
new UpdatePath("release-20191117", new UpdateRule[]
{
// Bleed only changes here
new RemoveYesNo(),
new RemoveInitialFacingHardcoding(),
new RemoveAirdropActorTypeDefault(),
})
};
public static IEnumerable<UpdateRule> FromSource(ObjectCreator objectCreator, string source, bool chain = true)
{
// Use reflection to identify types
var namedType = objectCreator.FindType(source);
if (namedType != null && namedType.IsSubclassOf(typeof(UpdateRule)))
return new[] { (UpdateRule)objectCreator.CreateBasic(namedType) };
var namedPath = Paths.FirstOrDefault(p => p.source == source);
return namedPath != null ? namedPath.Rules(chain) : null;
}
public static IEnumerable<string> KnownPaths { get { return Paths.Select(p => p.source); } }
public static IEnumerable<string> KnownRules(ObjectCreator objectCreator)
{
return objectCreator.GetTypesImplementing<UpdateRule>().Select(t => t.Name);
}
readonly string source;
readonly string chainToSource;
readonly UpdateRule[] rules;
UpdatePath(string source, UpdateRule[] rules)
: this(source, null, rules) { }
UpdatePath(string source, string chainToSource, UpdateRule[] rules)
{
this.source = source;
this.rules = rules;
this.chainToSource = chainToSource;
}
IEnumerable<UpdateRule> Rules(bool chain = true)
{
if (chainToSource != null && chain)
{
var child = Paths.First(p => p.source == chainToSource);
return rules.Concat(child.Rules(chain));
}
return rules;
}
}
}