Skip to content

Commit b5e9b76

Browse files
reaperrrabcdefg30
authored andcommitted
MoveClassicFacingFudge update rule
1 parent 0df7fa1 commit b5e9b76

File tree

16 files changed

+230
-149
lines changed

16 files changed

+230
-149
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#region Copyright & License Information
2+
/*
3+
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
4+
* This file is part of OpenRA, which is free software. It is made
5+
* available to you under the terms of the GNU General Public License
6+
* as published by the Free Software Foundation, either version 3 of
7+
* the License, or (at your option) any later version. For more
8+
* information, see COPYING.
9+
*/
10+
#endregion
11+
12+
using System.Collections.Generic;
13+
using System.Linq;
14+
15+
namespace OpenRA.Mods.Common.UpdateRules.Rules
16+
{
17+
public class MoveClassicFacingFudge : UpdateRule
18+
{
19+
public override string Name { get { return "UseClassicFacingFudge functionality was moved to Cnc-specific sequence/coordinate code."; } }
20+
public override string Description
21+
{
22+
get
23+
{
24+
return "UseClassicFacingFudge has been replaced with ClassicFacingBodyOrientation trait\n" +
25+
"and Classic* variants of *Sequence loaders respectively, both located in Mods.Cnc.";
26+
}
27+
}
28+
29+
readonly List<string> locations = new List<string>();
30+
31+
public override IEnumerable<string> AfterUpdate(ModData modData)
32+
{
33+
if (locations.Any())
34+
yield return "UseClassicFacingFudge property on BodyOrientation was replaced with ClassicFacingBodyOrientation trait.\n" +
35+
"UseClassicFacingFudge for sequences was renamed to UseClassicFacings and moved to\n" +
36+
"Classic(TileSetSpecific)SpriteSequence loaders in Mods.Cnc.\n" +
37+
"Update SpriteSequenceFormat: in mod.yaml accordingly.\n" +
38+
"Make sure that actors implementing the following places don't use or inherit the standard BodyOrientation:\n" +
39+
UpdateUtils.FormatMessageList(locations);
40+
41+
locations.Clear();
42+
}
43+
44+
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
45+
{
46+
var modId = modData.Manifest.Id;
47+
48+
foreach (var bo in actorNode.ChildrenMatching("BodyOrientation"))
49+
{
50+
var usesClassicFacings = false;
51+
var facingFudgeNode = bo.LastChildMatching("UseClassicFacingFudge");
52+
if (facingFudgeNode != null)
53+
{
54+
usesClassicFacings = facingFudgeNode.NodeValue<bool>();
55+
bo.RemoveNode(facingFudgeNode);
56+
}
57+
58+
if (usesClassicFacings)
59+
{
60+
bo.RenameKey("ClassicFacingBodyOrientation");
61+
locations.Add("{0} ({1})".F(actorNode.Key, actorNode.Location.Filename));
62+
}
63+
}
64+
65+
yield break;
66+
}
67+
68+
public override IEnumerable<string> UpdateSequenceNode(ModData modData, MiniYamlNode sequenceNode)
69+
{
70+
foreach (var sequence in sequenceNode.Value.Nodes)
71+
{
72+
var facingFudgeNode = sequence.LastChildMatching("UseClassicFacingFudge");
73+
if (facingFudgeNode != null)
74+
facingFudgeNode.RenameKey("UseClassicFacings");
75+
}
76+
77+
yield break;
78+
}
79+
}
80+
}

OpenRA.Mods.Common/UpdateRules/UpdatePath.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public class UpdatePath
8181
new AddPipDecorationTraits(),
8282
new ModernizeDecorationTraits(),
8383
new RenameInfiltrationNotifications(),
84+
new MoveClassicFacingFudge(),
8485
})
8586
};
8687

mods/cnc/mod.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ SoundFormats: Aud, Wav
215215

216216
SpriteFormats: ShpTD, TmpTD, ShpTS, TmpRA
217217

218-
SpriteSequenceFormat: TilesetSpecificSpriteSequence
218+
SpriteSequenceFormat: ClassicTilesetSpecificSpriteSequence
219219
TilesetExtensions:
220220
TEMPERAT: .tem
221221
WINTER: .win

mods/cnc/rules/defaults.yaml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
QuantizeFacingsFromSequence:
1414
RenderSprites:
1515

16+
^ClassicFacingSpriteActor:
17+
ClassicFacingBodyOrientation:
18+
QuantizeFacingsFromSequence:
19+
RenderSprites:
20+
1621
^1x1Shape:
1722
HitShape:
1823
UseTargetableCellsOffsets: true
@@ -263,7 +268,7 @@
263268

264269
^Vehicle:
265270
Inherits@1: ^ExistsInWorld
266-
Inherits@3: ^SpriteActor
271+
Inherits@3: ^ClassicFacingSpriteActor
267272
Inherits@selection: ^SelectableCombatUnit
268273
Huntable:
269274
OwnerLostAction:
@@ -294,8 +299,6 @@
294299
MustBeDestroyed:
295300
Voiced:
296301
VoiceSet: VehicleVoice
297-
BodyOrientation:
298-
UseClassicFacingFudge: True
299302
HitShape:
300303
MapEditorData:
301304
Categories: Vehicle
@@ -310,7 +313,7 @@
310313

311314
^Helicopter:
312315
Inherits@1: ^ExistsInWorld
313-
Inherits@3: ^SpriteActor
316+
Inherits@3: ^ClassicFacingSpriteActor
314317
Inherits@selection: ^SelectableCombatUnit
315318
Huntable:
316319
OwnerLostAction:
@@ -357,8 +360,6 @@
357360
MustBeDestroyed:
358361
Voiced:
359362
VoiceSet: VehicleVoice
360-
BodyOrientation:
361-
UseClassicFacingFudge: True
362363
HitShape:
363364
MapEditorData:
364365
Categories: Aircraft
@@ -641,7 +642,7 @@
641642

642643
^Plane:
643644
Inherits@1: ^ExistsInWorld
644-
Inherits@2: ^SpriteActor
645+
Inherits@2: ^ClassicFacingSpriteActor
645646
Huntable:
646647
OwnerLostAction:
647648
Action: Kill
@@ -1030,7 +1031,7 @@
10301031
ValidOwnerNames: Neutral
10311032

10321033
^CommonHuskDefaults:
1033-
Inherits@1: ^SpriteActor
1034+
Inherits@1: ^ClassicFacingSpriteActor
10341035
Interactable:
10351036
Health:
10361037
HP: 14000
@@ -1068,8 +1069,6 @@
10681069
Explodes:
10691070
Weapon: UnitExplodeSmall
10701071
EmptyWeapon: UnitExplodeSmall
1071-
BodyOrientation:
1072-
UseClassicFacingFudge: True
10731072

10741073
^LightHusk:
10751074
Inherits: ^Husk
@@ -1090,8 +1089,6 @@
10901089
Explosion: HeliCrash
10911090
Tooltip:
10921091
GenericName: Destroyed Helicopter
1093-
BodyOrientation:
1094-
UseClassicFacingFudge: True
10951092
-MapEditorData:
10961093

10971094
^Bridge:

mods/cnc/rules/ships.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ LST:
7171
Type: Heavy
7272
RevealsShroud:
7373
Range: 7c0
74+
-BodyOrientation:
75+
ClassicFacingBodyOrientation:
7476
WithFacingSpriteBody:
7577
Selectable:
7678
Bounds: 48,48

mods/cnc/rules/structures.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,8 @@ GUN:
865865
Range: 3c0
866866
Power:
867867
Amount: -20
868-
BodyOrientation:
869-
UseClassicFacingFudge: True
868+
-BodyOrientation:
869+
ClassicFacingBodyOrientation:
870870

871871
SAM:
872872
Inherits: ^Defense
@@ -915,8 +915,8 @@ SAM:
915915
-RenderDetectionCircle:
916916
Power:
917917
Amount: -20
918-
BodyOrientation:
919-
UseClassicFacingFudge: True
918+
-BodyOrientation:
919+
ClassicFacingBodyOrientation:
920920
-ActorPreviewPlaceBuildingPreview:
921921
SequencePlaceBuildingPreview:
922922
Sequence: place

mods/cnc/sequences/aircraft.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
c17:
22
idle:
33
Facings: 32
4-
UseClassicFacingFudge: True
4+
UseClassicFacings: True
55
icon: c17icnh
66

77
tran:
88
idle:
99
Facings: 32
10-
UseClassicFacingFudge: True
10+
UseClassicFacings: True
1111
rotor: lrotor
1212
Length: 4
1313
rotor2: rrotor
@@ -29,7 +29,7 @@ tran:
2929
heli:
3030
idle:
3131
Facings: 32
32-
UseClassicFacingFudge: True
32+
UseClassicFacings: True
3333
rotor: lrotor
3434
Length: 4
3535
slow-rotor: lrotor
@@ -44,7 +44,7 @@ heli:
4444
orca:
4545
idle:
4646
Facings: 32
47-
UseClassicFacingFudge: True
47+
UseClassicFacings: True
4848
move:
4949
Start: 32
5050
Facings: 32
@@ -54,7 +54,7 @@ orca:
5454
a10:
5555
idle:
5656
Facings: 32
57-
UseClassicFacingFudge: True
57+
UseClassicFacings: True
5858
muzzle: minigun
5959
Length: 6
6060
Facings: 8

mods/cnc/sequences/campaign.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
lst:
22
idle: lstnew
3-
UseClassicFacingFudge: True
3+
UseClassicFacings: True
44
Facings: 32
55
roof: lstnew2
6-
UseClassicFacingFudge: True
6+
UseClassicFacings: True
77
Facings: 32
88
icon: lsticnh.tem
99
AddExtension: False

mods/cnc/sequences/structures.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,19 +437,19 @@ wood:
437437
gun:
438438
idle:
439439
Facings: 32
440-
UseClassicFacingFudge: True
440+
UseClassicFacings: True
441441
recoil:
442442
Start: 32
443443
Facings: 32
444-
UseClassicFacingFudge: True
444+
UseClassicFacings: True
445445
damaged-idle:
446446
Start: 64
447447
Facings: 32
448-
UseClassicFacingFudge: True
448+
UseClassicFacings: True
449449
damaged-recoil:
450450
Start: 96
451451
Facings: 32
452-
UseClassicFacingFudge: True
452+
UseClassicFacings: True
453453
make: gunmake
454454
Length: *
455455
Tick: 80
@@ -476,7 +476,7 @@ sam:
476476
idle:
477477
Start: 17
478478
Facings: 32
479-
UseClassicFacingFudge: True
479+
UseClassicFacings: True
480480
closing:
481481
Start: 50
482482
Length: 14
@@ -490,7 +490,7 @@ sam:
490490
damaged-idle:
491491
Start: 81
492492
Facings: 32
493-
UseClassicFacingFudge: True
493+
UseClassicFacings: True
494494
damaged-closing:
495495
Start: 114
496496
Length: 14

0 commit comments

Comments
 (0)