diff --git a/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj b/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj index 114de35398..486bb7324f 100644 --- a/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj +++ b/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj @@ -52,6 +52,7 @@ + diff --git a/OpenRA.Mods.TS/Traits/Render/WithPermanentInjury.cs b/OpenRA.Mods.TS/Traits/Render/WithPermanentInjury.cs new file mode 100644 index 0000000000..d735a3950f --- /dev/null +++ b/OpenRA.Mods.TS/Traits/Render/WithPermanentInjury.cs @@ -0,0 +1,46 @@ +#region Copyright & License Information +/* + * Copyright 2007-2015 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. For more information, + * see COPYING. + */ +#endregion + +using OpenRA.Mods.Common.Traits; +using OpenRA.Traits; + +namespace OpenRA.Mods.TS.Traits +{ + [Desc("Change the sprite after a certain amount of damage is taken, even when the hitpoints are regenerated.")] + public class WithPermanentInjuryInfo : ITraitInfo + { + public readonly DamageState TriggeringDamageStage = DamageState.Critical; + + public readonly string InjuredSequencePrefix = "crippled-"; + + public object Create(ActorInitializer init) { return new WithPermanentInjury(init, this); } + } + + public class WithPermanentInjury : INotifyDamage, IRenderInfantrySequenceModifier + { + readonly WithPermanentInjuryInfo info; + + bool isInjured; + + public bool IsModifyingSequence { get { return isInjured; } } + public string SequencePrefix { get { return info.InjuredSequencePrefix; } } + + public WithPermanentInjury(ActorInitializer init, WithPermanentInjuryInfo info) + { + this.info = info; + } + + public void Damaged(Actor self, AttackInfo e) + { + if (e.DamageState == info.TriggeringDamageStage) + isInjured = true; + } + } +} diff --git a/mods/ts/rules/nod-infantry.yaml b/mods/ts/rules/nod-infantry.yaml index 3a0ac06f18..34379056d7 100644 --- a/mods/ts/rules/nod-infantry.yaml +++ b/mods/ts/rules/nod-infantry.yaml @@ -62,16 +62,9 @@ CYBORG: Armament: Weapon: Vulcan3 AttackFrontal: - TakeCover: - DamageModifiers: - Prone50Percent: 50 - Prone60Percent: 60 - Prone70Percent: 70 - Prone100Percent: 100 - Prone350Percent: 350 - DamageTriggers: TriggerProne WithInfantryBody: IdleSequences: idle1,idle2 + WithPermanentInjury: CYC2: Inherits: ^Infantry @@ -105,16 +98,9 @@ CYC2: Weapon: CyCannon LocalOffset: 170,85,683 AttackFrontal: - TakeCover: - DamageModifiers: - Prone50Percent: 50 - Prone60Percent: 60 - Prone70Percent: 70 - Prone100Percent: 100 - Prone350Percent: 350 - DamageTriggers: TriggerProne WithInfantryBody: IdleSequences: idle1,idle2 + WithPermanentInjury: MHIJACK: Inherits: ^Infantry diff --git a/mods/ts/sequences/infantry.yaml b/mods/ts/sequences/infantry.yaml index a4aefce52c..878c2b7e1b 100644 --- a/mods/ts/sequences/infantry.yaml +++ b/mods/ts/sequences/infantry.yaml @@ -761,12 +761,12 @@ cyc2: Start: 95 Length: 15 ShadowStart: 403 - prone-run: + crippled-run: Start: 110 Length: 9 Facings: 8 ShadowStart: 418 - prone-stand: + crippled-stand: Start: 110 Facings: 8 Stride: 9 @@ -786,16 +786,11 @@ cyc2: Length: 6 Facings: 8 ShadowStart: 520 - prone-shoot: + crippled-shoot: Start: 260 Length: 6 Facings: 8 ShadowStart: 568 - standup-0: # TODO: N/A as they only crawl when severly damaged - Start: 260 - Length: 2 - Facings: 8 - ShadowStart: 568 die5: flameguy # TODO: walking animation unused Start: 42 Length: 104 @@ -823,12 +818,12 @@ cyborg: Start: 71 Length: 15 ShadowStart: 441 - prone-run: + crippled-run: Start: 86 Length: 6 Facings: 8 ShadowStart: 456 - prone-stand: + crippled-stand: Start: 86 Facings: 8 Stride: 6 @@ -846,16 +841,11 @@ cyborg: Length: 6 Facings: 8 ShadowStart: 534 - prone-shoot: + crippled-shoot: Start: 212 Length: 6 Facings: 8 ShadowStart: 582 - standup-0: # TODO: N/A as they don't do that - Start: 260 - Length: 2 - Facings: 8 - ShadowStart: 630 die5: # TODO: unused running frame 322 and following Start: 292 Length: 14