diff --git a/OpenRA.Game/Traits/Render/RenderBuildingWall.cs b/OpenRA.Game/Traits/Render/RenderBuildingWall.cs index 856e1452b1..6dd2daa1e1 100644 --- a/OpenRA.Game/Traits/Render/RenderBuildingWall.cs +++ b/OpenRA.Game/Traits/Render/RenderBuildingWall.cs @@ -24,12 +24,14 @@ namespace OpenRa.Traits { class RenderBuildingWallInfo : RenderBuildingInfo { + public readonly int DamageStates = 2; public override object Create(Actor self) { return new RenderBuildingWall(self); } } class RenderBuildingWall : RenderBuilding { string seqName; + int damageStates; Actor self; public RenderBuildingWall(Actor self) @@ -37,8 +39,9 @@ namespace OpenRa.Traits { seqName = "idle"; this.self = self; + this.damageStates = self.Info.Traits.Get().DamageStates; } - + public override void Damaged(Actor self, AttackInfo e) { if (!e.DamageStateChanged) return; @@ -48,10 +51,21 @@ namespace OpenRa.Traits case DamageState.Normal: seqName = "idle"; break; + case DamageState.ThreeQuarter: + if (damageStates >= 4) + seqName = "minor-damaged-idle"; + break; case DamageState.Half: seqName = "damaged-idle"; Sound.Play("kaboom1.aud"); break; + case DamageState.Quarter: + if (damageStates >= 3) + { + seqName = "critical-idle"; + Sound.Play("kaboom1.aud"); + } + break; } } diff --git a/OpenRa.Game/Actor.cs b/OpenRa.Game/Actor.cs index 6dcd9e5f6d..e287229e80 100755 --- a/OpenRa.Game/Actor.cs +++ b/OpenRa.Game/Actor.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -144,9 +144,19 @@ namespace OpenRa public DamageState GetDamageState() { - if (Health <= 0) return DamageState.Dead; - var halfStrength = this.GetMaxHP() * Rules.General.ConditionYellow; - return Health < halfStrength ? DamageState.Half : DamageState.Normal; + if (Health <= 0) + return DamageState.Dead; + + if (Health < this.GetMaxHP() * Rules.General.ConditionRed) + return DamageState.Quarter; + + if (Health < this.GetMaxHP() * Rules.General.ConditionYellow) + return DamageState.Half; + + if (Health < this.GetMaxHP() * 0.75) + return DamageState.ThreeQuarter; + + return DamageState.Normal; } public void InflictDamage(Actor attacker, int damage, WarheadInfo warhead) diff --git a/OpenRa.Game/Traits/TraitsInterfaces.cs b/OpenRa.Game/Traits/TraitsInterfaces.cs index 97600f814b..b2660d2bc0 100644 --- a/OpenRa.Game/Traits/TraitsInterfaces.cs +++ b/OpenRa.Game/Traits/TraitsInterfaces.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -27,7 +27,7 @@ using OpenRa.Traits.Activities; namespace OpenRa.Traits { - public enum DamageState { Normal, Half, Dead }; + public enum DamageState { Normal, ThreeQuarter, Half, Quarter, Dead }; // depends on the order of pips in WorldRenderer.cs! public enum PipType { Transparent, Green, Yellow, Red, Gray }; diff --git a/mods/ra/defaults.yaml b/mods/ra/defaults.yaml index 47876c35f4..0c587dcd7f 100644 --- a/mods/ra/defaults.yaml +++ b/mods/ra/defaults.yaml @@ -55,6 +55,8 @@ Crewed: no Sight: 0 Wall: + Selectable: RenderBuildingWall: Palette: terrain + DamageStates: 2 diff --git a/mods/ra/rules.yaml b/mods/ra/rules.yaml index d941c0f86f..9a6e21d4f4 100644 --- a/mods/ra/rules.yaml +++ b/mods/ra/rules.yaml @@ -2499,7 +2499,7 @@ SBAG: Buildable: TechLevel: 2 Prerequisites: fact - Owner: soviet + Owner: allies Cost: 25 Description: Sandbag Wall LongDesc: Stops infantry and blocks enemy fire.\n Can be crushed by tanks. @@ -2507,19 +2507,6 @@ SBAG: HP: 100 Armor: none -BRIK: - Inherits: ^Wall - Buildable: - TechLevel: 8 - Prerequisites: fact - Owner: soviet - Cost: 100 - Description: Concrete Wall - LongDesc: Stop units from passing and block enemy fire. - Building: - HP: 100 - Armor: none - FENC: Inherits: ^Wall Buildable: @@ -2532,12 +2519,29 @@ FENC: Building: HP: 100 Armor: none + +BRIK: + Inherits: ^Wall + Buildable: + TechLevel: 8 + Prerequisites: fact + Owner: allies,soviet + Cost: 100 + Description: Concrete Wall + LongDesc: Stop units from passing and block enemy fire. + Building: + HP: 100 + Armor: none + RenderBuildingWall: + DamageStates: 4 + CYCL: Inherits: ^Wall Building: HP: 100 Armor: none - + RenderBuildingWall: + DamageStates: 3 BARB: Inherits: ^Wall Building: diff --git a/mods/ra/sequences.xml b/mods/ra/sequences.xml index 3f844a2c42..ca9069b1f1 100644 --- a/mods/ra/sequences.xml +++ b/mods/ra/sequences.xml @@ -861,44 +861,35 @@ - - + + - - - - - - + - - - - \ No newline at end of file