Merge pull request #5973 from reaperrr/renderinf-unhardcode

Unhardcoded RenderInfantry sequence names
This commit is contained in:
Chris Forbes
2014-07-23 09:58:07 +12:00
4 changed files with 13 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS) * Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * 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 * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -18,6 +18,9 @@ namespace OpenRA.Mods.RA.Render
public readonly int MinIdleWaitTicks = 30; public readonly int MinIdleWaitTicks = 30;
public readonly int MaxIdleWaitTicks = 110; public readonly int MaxIdleWaitTicks = 110;
public readonly bool SpawnsCorpse = true; public readonly bool SpawnsCorpse = true;
public readonly string MoveAnimation = "run";
public readonly string AttackAnimation = "shoot";
public readonly string DeathAnimationPrefix = "die";
public readonly string[] IdleAnimations = { }; public readonly string[] IdleAnimations = { };
public readonly string[] StandAnimations = { "stand" }; public readonly string[] StandAnimations = { "stand" };
@@ -68,10 +71,8 @@ namespace OpenRA.Mods.RA.Render
public void Attacking(Actor self, Target target) public void Attacking(Actor self, Target target)
{ {
State = AnimationState.Attacking; State = AnimationState.Attacking;
if (DefaultAnimation.HasSequence(NormalizeInfantrySequence(self, "shoot"))) if (DefaultAnimation.HasSequence(NormalizeInfantrySequence(self, info.AttackAnimation)))
DefaultAnimation.PlayThen(NormalizeInfantrySequence(self, "shoot"), () => State = AnimationState.Idle); DefaultAnimation.PlayThen(NormalizeInfantrySequence(self, info.AttackAnimation), () => State = AnimationState.Idle);
else if (DefaultAnimation.HasSequence(NormalizeInfantrySequence(self, "heal")))
DefaultAnimation.PlayThen(NormalizeInfantrySequence(self, "heal"), () => State = AnimationState.Idle);
} }
public void Attacking(Actor self, Target target, Armament a, Barrel barrel) public void Attacking(Actor self, Target target, Armament a, Barrel barrel)
@@ -91,7 +92,7 @@ namespace OpenRA.Mods.RA.Render
else if ((State != AnimationState.Moving || dirty) && move.IsMoving) else if ((State != AnimationState.Moving || dirty) && move.IsMoving)
{ {
State = AnimationState.Moving; State = AnimationState.Moving;
DefaultAnimation.PlayRepeating(NormalizeInfantrySequence(self, "run")); DefaultAnimation.PlayRepeating(NormalizeInfantrySequence(self, info.MoveAnimation));
} }
dirty = false; dirty = false;
@@ -133,7 +134,7 @@ namespace OpenRA.Mods.RA.Render
if (info.SpawnsCorpse) if (info.SpawnsCorpse)
{ {
SpawnCorpse(self, "die" + (e.Warhead.InfDeath)); SpawnCorpse(self, info.DeathAnimationPrefix + (e.Warhead.InfDeath));
} }
} }

View File

@@ -107,6 +107,8 @@ MEDIC:
AttackMedic: AttackMedic:
Cursor: ability Cursor: ability
OutsideRangeCursor: ability OutsideRangeCursor: ability
RenderInfantry:
AttackAnimation: heal
Passenger: Passenger:
PipType: Blue PipType: Blue
-AutoTarget: -AutoTarget:

View File

@@ -303,6 +303,7 @@ MEDI:
-RenderInfantry: -RenderInfantry:
RenderInfantryProne: RenderInfantryProne:
IdleAnimations: idle1,idle2 IdleAnimations: idle1,idle2
AttackAnimation: heal
MECH: MECH:
Inherits: ^Infantry Inherits: ^Infantry
@@ -340,6 +341,7 @@ MECH:
-RenderInfantry: -RenderInfantry:
RenderInfantryProne: RenderInfantryProne:
IdleAnimations: idle1,idle2 IdleAnimations: idle1,idle2
AttackAnimation: heal
EINSTEIN: EINSTEIN:
Inherits: ^Infantry Inherits: ^Infantry

View File

@@ -137,6 +137,7 @@ MEDIC:
-RenderInfantry: -RenderInfantry:
RenderInfantryProne: RenderInfantryProne:
IdleAnimations: idle1,idle2 IdleAnimations: idle1,idle2
AttackAnimation: heal
SelfHealing: SelfHealing:
Passenger: Passenger:
PipType: Red PipType: Red