From 7f81de2f8aee2cdc910ded7902238b30211179c4 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 21 May 2017 14:12:34 +0200 Subject: [PATCH] Upgrade rule for Health.Shape to HitShape.Type --- .../UtilityCommands/UpgradeRules.cs | 22 ++++++++++ mods/cnc/rules/defaults.yaml | 24 +++++++--- mods/cnc/rules/misc.yaml | 1 + mods/d2k/rules/arrakis.yaml | 14 +++--- mods/d2k/rules/defaults.yaml | 9 +++- mods/d2k/rules/structures.yaml | 7 +-- mods/ra/maps/bomber-john/rules.yaml | 2 + mods/ra/rules/defaults.yaml | 19 ++++++-- mods/ra/rules/infantry.yaml | 5 ++- mods/ts/rules/aircraft.yaml | 1 + mods/ts/rules/bridges.yaml | 1 + mods/ts/rules/critters.yaml | 12 ++--- mods/ts/rules/defaults.yaml | 44 ++++++++++++------- mods/ts/rules/gdi-infantry.yaml | 1 + mods/ts/rules/shared-infantry.yaml | 1 + 15 files changed, 119 insertions(+), 44 deletions(-) diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 8faff636f3..446fdd2217 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -679,6 +679,28 @@ namespace OpenRA.Mods.Common.UtilityCommands } } + // Added HitShape trait + if (engineVersion < 20170531) + { + var hitShapeNode = new MiniYamlNode("HitShape", ""); + + // Moved and renamed Health.Shape to HitShape.Type + var health = node.Value.Nodes.FirstOrDefault(n => n.Key == "Health"); + if (health != null) + { + var shape = health.Value.Nodes.FirstOrDefault(n => n.Key == "Shape"); + if (shape != null) + { + RenameNodeKey(shape, "Type"); + hitShapeNode.Value.Nodes.Add(shape); + node.Value.Nodes.Add(hitShapeNode); + health.Value.Nodes.Remove(shape); + } + else + node.Value.Nodes.Add(hitShapeNode); + } + } + UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1); } diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index a83c24fdd1..e1678edf86 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -173,6 +173,7 @@ VoiceSet: VehicleVoice BodyOrientation: UseClassicFacingFudge: True + HitShape: ^Tank: Inherits: ^Vehicle @@ -234,14 +235,13 @@ VoiceSet: VehicleVoice BodyOrientation: UseClassicFacingFudge: True + HitShape: ^Infantry: Inherits@1: ^ExistsInWorld Inherits@3: ^SpriteActor Huntable: Health: - Shape: Circle - Radius: 128 Armor: Type: None RevealsShroud: @@ -334,6 +334,9 @@ DeathTypes: TiberiumDeath Voiced: VoiceSet: GenericVoice + HitShape: + Type: Circle + Radius: 128 ^Soldier: Inherits: ^Infantry @@ -391,8 +394,6 @@ Huntable: Health: HP: 1000 - Shape: Circle - Radius: 128 Armor: Type: Wood Buildable: @@ -441,6 +442,9 @@ DeathSounds: Voiced: VoiceSet: DinoVoice + HitShape: + Type: Circle + Radius: 128 ^Viceroid: Inherits@1: ^ExistsInWorld @@ -448,8 +452,6 @@ Huntable: Health: HP: 300 - Shape: Circle - Radius: 427 Armor: Type: Wood RevealsShroud: @@ -500,6 +502,9 @@ Terrain: Tiberium, BlueTiberium Voiced: VoiceSet: DinoVoice + HitShape: + Type: Circle + Radius: 427 ^Plane: Inherits@1: ^ExistsInWorld @@ -548,6 +553,7 @@ GenericName: Ship Voiced: VoiceSet: VehicleVoice + HitShape: ^Building: Inherits@1: ^ExistsInWorld @@ -710,7 +716,8 @@ ScriptTriggers: Health: HP: 100 - Shape: Rectangle + HitShape: + Type: Rectangle TopLeft: -512, -512 BottomRight: 512, 512 @@ -752,6 +759,7 @@ AutoTargetIgnore: HiddenUnderShroud: ScriptTriggers: + HitShape: ^TreeHusk: Inherits@1: ^SpriteActor @@ -812,6 +820,7 @@ Type: CenterPosition AutoTargetIgnore: WithFacingSpriteBody: + HitShape: ^Husk: Inherits: ^CommonHuskDefaults @@ -869,6 +878,7 @@ DamagedSounds: xplos.aud DestroyedSounds: xplobig4.aud ScriptTriggers: + HitShape: ^Crate: Inherits@1: ^SpriteActor diff --git a/mods/cnc/rules/misc.yaml b/mods/cnc/rules/misc.yaml index 97be8cc0e8..301ef339ae 100644 --- a/mods/cnc/rules/misc.yaml +++ b/mods/cnc/rules/misc.yaml @@ -90,6 +90,7 @@ CAMERA.small: OccupiesSpace: false Health: HP: 1000 + HitShape: RevealsShroud: Range: 6c0 Type: CenterPosition diff --git a/mods/d2k/rules/arrakis.yaml b/mods/d2k/rules/arrakis.yaml index 9433d79889..c1b8082f87 100644 --- a/mods/d2k/rules/arrakis.yaml +++ b/mods/d2k/rules/arrakis.yaml @@ -20,10 +20,11 @@ spicebloom.spawnpoint: Actor: spicebloom Health: HP: 9999 - Shape: Circle - Radius: 1 Immobile: OccupiesSpace: false + HitShape: + Type: Circle + Radius: 1 spicebloom: HiddenUnderShroud: @@ -48,8 +49,6 @@ spicebloom: Immobile: Health: HP: 1 - Shape: Circle - Radius: 512 Targetable: TargetTypes: Ground RequiresForceFire: true @@ -57,6 +56,9 @@ spicebloom: Type: none SpawnActorOnDeath: Actor: spicebloom.spawnpoint + HitShape: + Type: Circle + Radius: 512 sandworm: Inherits@1: ^SpriteActor @@ -64,7 +66,9 @@ sandworm: Name: Sandworm Health: HP: 9990 - Radius: 256 + HitShape: + Type: Circle + Radius: 256 Armor: Type: heavy Mobile: diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml index 8271ca745c..e4aa3d0384 100644 --- a/mods/d2k/rules/defaults.yaml +++ b/mods/d2k/rules/defaults.yaml @@ -173,6 +173,7 @@ RevealOnDeath: Duration: 100 Radius: 2c512 + HitShape: ^Tank: Inherits: ^Vehicle @@ -192,6 +193,7 @@ AutoTargetIgnore: ScriptTriggers: WithFacingSpriteBody: + HitShape: ^VehicleHusk: Inherits: ^Husk @@ -229,6 +231,7 @@ Tooltip: Name: Destroyed Tower ScriptTriggers: + HitShape: ^Infantry: Inherits@1: ^ExistsInWorld @@ -236,8 +239,6 @@ Inherits@3: ^SpriteActor Huntable: Health: - Shape: Circle - Radius: 96 Armor: Type: none RevealsShroud: @@ -303,6 +304,9 @@ RevealOnFire: RevealOnDeath: Duration: 100 + HitShape: + Type: Circle + Radius: 96 ^Plane: Inherits@1: ^ExistsInWorld @@ -318,6 +322,7 @@ DrawLineToTarget: WithFacingSpriteBody: WithShadow: + HitShape: ^Building: Inherits@1: ^ExistsInWorld diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index 67104df3fd..2f1f2b24b1 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -633,9 +633,6 @@ wall: TerrainTypes: Rock, Concrete Health: HP: 2000 - Shape: Rectangle - TopLeft: -512, -512 - BottomRight: 512, 512 Armor: Type: wall RevealsShroud: @@ -663,6 +660,10 @@ wall: Weapons: Debris2, Debris3 Pieces: 1, 1 Range: 1c512, 2c768 + HitShape: + Type: Rectangle + TopLeft: -512, -512 + BottomRight: 512, 512 medium_gun_turret: Inherits: ^Defense diff --git a/mods/ra/maps/bomber-john/rules.yaml b/mods/ra/maps/bomber-john/rules.yaml index e4fd0104ac..fa901416ad 100644 --- a/mods/ra/maps/bomber-john/rules.yaml +++ b/mods/ra/maps/bomber-john/rules.yaml @@ -97,6 +97,7 @@ MNLYR: Image: MNLY Chronoshiftable: ReturnToOrigin: false + HitShape: FTUR: Health: @@ -164,6 +165,7 @@ MINVV: Explodes: Weapon: CrateNuke EmptyWeapon: CrateNuke + HitShape: T17: Health: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index da413cbb0c..1c2511ed59 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -209,6 +209,7 @@ RequiresCondition: parachute BodyOrientation: UseClassicFacingFudge: True + HitShape: ^Tank: Inherits: ^Vehicle @@ -237,8 +238,6 @@ DrawLineToTarget: Health: HP: 25 - Shape: Circle - Radius: 128 Armor: Type: None RevealsShroud: @@ -324,6 +323,9 @@ OpeningSequence: open Offset: 0,0,427 RequiresCondition: parachute + HitShape: + Type: Circle + Radius: 128 ^Soldier: Inherits: ^Infantry @@ -412,6 +414,7 @@ Voiced: VoiceSet: VehicleVoice WithFacingSpriteBody: + HitShape: ^NeutralPlane: Inherits@1: ^ExistsInWorld @@ -463,6 +466,7 @@ MustBeDestroyed: Voiced: VoiceSet: GenericVoice + HitShape: ^Plane: Inherits: ^NeutralPlane @@ -592,7 +596,8 @@ FrozenUnderFogUpdatedByGps: Health: HP: 100 - Shape: Rectangle + HitShape: + Type: Rectangle TopLeft: -512, -512 BottomRight: 512, 512 @@ -618,6 +623,7 @@ OpeningSound: cashturn.aud ClosingSound: cashturn.aud TerrainTypes: Clear, Road + HitShape: ^TechBuilding: Inherits: ^BasicBuilding @@ -630,6 +636,7 @@ Name: Civilian Building GenericVisibility: None FrozenUnderFog: + HitShape: ^FakeBuilding: Inherits: ^Building @@ -649,6 +656,7 @@ ZOffset: 256 -EmitInfantryOnSell: -MustBeDestroyed: + HitShape: ^InfiltratableFake: Targetable: @@ -678,6 +686,7 @@ Type: Light Targetable: TargetTypes: Ground, DetonateAttack + HitShape: ^CivBuilding: Inherits: ^TechBuilding @@ -748,6 +757,7 @@ ScriptTriggers: EditorTilesetFilter: ExcludeTilesets: INTERIOR + HitShape: ^TreeHusk: Inherits@1: ^SpriteActor @@ -773,6 +783,7 @@ AutoTargetIgnore: ScriptTriggers: WithFacingSpriteBody: + HitShape: ^Husk: Inherits: ^BasicHusk @@ -842,6 +853,7 @@ Type: Concrete AutoTargetIgnore: ScriptTriggers: + HitShape: ^Rock: Inherits@1: ^SpriteActor @@ -926,6 +938,7 @@ TargetTypes: Ground Immobile: OccupiesSpace: true + HitShape: ^DisabledOverlay: WithColoredOverlay@IDISABLE: diff --git a/mods/ra/rules/infantry.yaml b/mods/ra/rules/infantry.yaml index 3e07916151..d9508b8b96 100644 --- a/mods/ra/rules/infantry.yaml +++ b/mods/ra/rules/infantry.yaml @@ -651,8 +651,6 @@ Ant: VisualBounds: 30,30,0,-2 Health: HP: 750 - Shape: Circle - Radius: 469 Mobile: Speed: 99 TurnSpeed: 12 @@ -671,3 +669,6 @@ Ant: UseDeathTypeSuffix: false Voiced: VoiceSet: AntVoice + HitShape: + Type: Circle + Radius: 469 diff --git a/mods/ts/rules/aircraft.yaml b/mods/ts/rules/aircraft.yaml index 4496979022..5e55e1eb08 100644 --- a/mods/ts/rules/aircraft.yaml +++ b/mods/ts/rules/aircraft.yaml @@ -365,3 +365,4 @@ HUNTER: SelectionDecorations: Palette: pips ActorLostNotification: + HitShape: diff --git a/mods/ts/rules/bridges.yaml b/mods/ts/rules/bridges.yaml index 9af88c9347..9c613c9c70 100644 --- a/mods/ts/rules/bridges.yaml +++ b/mods/ts/rules/bridges.yaml @@ -40,6 +40,7 @@ CABHUT: HP: 500 Armor: Type: Concrete + HitShape: LOBRDG_A: Inherits: ^LowBridge diff --git a/mods/ts/rules/critters.yaml b/mods/ts/rules/critters.yaml index c8ce54cdb1..037372815d 100644 --- a/mods/ts/rules/critters.yaml +++ b/mods/ts/rules/critters.yaml @@ -6,8 +6,6 @@ DOGGIE: Name: Tiberian Fiend Health: HP: 250 - Shape: Circle - Radius: 213 Selectable: Bounds: 24,24 Valued: @@ -35,6 +33,9 @@ DOGGIE: DeathSequence: die- DeathTypes: FireDeath: burning + HitShape: + Type: Circle + Radius: 213 VISC_SML: Inherits: ^Visceroid @@ -85,9 +86,6 @@ JFISH: Name: Tiberium Floater Health: HP: 500 - Shape: Circle - Radius: 363 - VerticalTopOffset: 768 RevealsShroud: Range: 5c0 Mobile: @@ -119,3 +117,7 @@ JFISH: SoundFiles: floatmov.aud, flotmov2.aud, flotmov3.aud, flotmov4.aud Delay: 150, 450 Interval: 300, 800 + HitShape: + Type: Circle + Radius: 363 + VerticalTopOffset: 768 diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 67a3c8fa05..33dd549cce 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -283,7 +283,8 @@ ScriptTriggers: ConditionManager: Health: - Shape: Rectangle + HitShape: + Type: Rectangle LocalYaw: 128 TopLeft: -512, -512 BottomRight: 512, 512 @@ -306,8 +307,6 @@ DrawLineToTarget: Health: HP: 50 - Shape: Circle - Radius: 128 Armor: Type: None Valued: @@ -382,6 +381,9 @@ RevealOnFire: EntersTunnels: Voice: Move + HitShape: + Type: Circle + Radius: 128 ^RegularInfantryDeath: WithDeathAnimation@normal: @@ -568,6 +570,7 @@ RevealOnFire: EntersTunnels: Voice: Move + HitShape: ^Tank: Inherits: ^Vehicle @@ -641,6 +644,7 @@ RenderVoxels: WithVoxelBody: RevealOnFire: + HitShape: ^Helicopter: Inherits: ^Aircraft @@ -673,6 +677,7 @@ Spins: true Moves: true Velocity: 86 + HitShape: ^Visceroid: Inherits@1: ^ExistsInWorld @@ -681,9 +686,6 @@ Huntable: DrawLineToTarget: Health: - Shape: Circle - Radius: 256 - VerticalTopOffset: 512 Armor: Type: Light Mobile: @@ -715,6 +717,10 @@ RevealOnFire: EntersTunnels: Voice: Move + HitShape: + Type: Circle + Radius: 256 + VerticalTopOffset: 512 ^BlossomTree: Inherits@1: ^SpriteActor @@ -854,6 +860,7 @@ Weapons: SmallDebris Pieces: 3, 7 Range: 2c0, 5c0 + HitShape: ^TerrainOverlay: AlwaysVisible: @@ -898,11 +905,6 @@ Cost: 250 Health: HP: 350 - Shape: Rectangle - LocalYaw: 128 - TopLeft: -512, -512 - BottomRight: 512, 512 - VerticalTopOffset: 768 Armor: Type: Heavy LineBuildNode: @@ -924,13 +926,16 @@ BlocksProjectilesHeight: 768 Buildable: Description: Automated barrier that opens for allied units. + HitShape: + Type: Rectangle + LocalYaw: 128 + TopLeft: -512, -512 + BottomRight: 512, 512 + VerticalTopOffset: 768 ^Gate_A: Inherits: ^Gate Health: - Shape: Rectangle - TopLeft: -512, -1536 - BottomRight: 512, 1536 Gate: Dimensions: 3,1 Footprint: xxx @@ -938,13 +943,14 @@ WallConnections: -1,0, 3,0 LineBuildNode: Connections: -1,0, 1,0 + HitShape: + Type: Rectangle + TopLeft: -512, -1536 + BottomRight: 512, 1536 ^Gate_B: Inherits: ^Gate Health: - Shape: Rectangle - TopLeft: -1536, -512 - BottomRight: 1536, 512 Gate: Dimensions: 1,3 Footprint: x x x @@ -952,6 +958,10 @@ WallConnections: 0,-1, 0,3 LineBuildNode: Connections: 0,-1, 0,1 + HitShape: + Type: Rectangle + TopLeft: -1536, -512 + BottomRight: 1536, 512 ^HealsOnTiberium: DamagedByTerrain: diff --git a/mods/ts/rules/gdi-infantry.yaml b/mods/ts/rules/gdi-infantry.yaml index 1925f7d6a2..4822b4e17a 100644 --- a/mods/ts/rules/gdi-infantry.yaml +++ b/mods/ts/rules/gdi-infantry.yaml @@ -168,6 +168,7 @@ JUMPJET.Husk: WithSpriteBody: Sequence: die-falling Health: + HitShape: ConditionManager: GrantConditionOnTerrain: TerrainTypes: Water diff --git a/mods/ts/rules/shared-infantry.yaml b/mods/ts/rules/shared-infantry.yaml index fa2c9c3a31..a421388810 100644 --- a/mods/ts/rules/shared-infantry.yaml +++ b/mods/ts/rules/shared-infantry.yaml @@ -97,3 +97,4 @@ FLAMEGUY: WithDeathAnimation: FallbackSequence: die UseDeathTypeSuffix: false + HitShape: