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
/*
* 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
* available to you under the terms of the GNU General Public License
* 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 MaxIdleWaitTicks = 110;
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[] StandAnimations = { "stand" };
@@ -68,10 +71,8 @@ namespace OpenRA.Mods.RA.Render
public void Attacking(Actor self, Target target)
{
State = AnimationState.Attacking;
if (DefaultAnimation.HasSequence(NormalizeInfantrySequence(self, "shoot")))
DefaultAnimation.PlayThen(NormalizeInfantrySequence(self, "shoot"), () => State = AnimationState.Idle);
else if (DefaultAnimation.HasSequence(NormalizeInfantrySequence(self, "heal")))
DefaultAnimation.PlayThen(NormalizeInfantrySequence(self, "heal"), () => State = AnimationState.Idle);
if (DefaultAnimation.HasSequence(NormalizeInfantrySequence(self, info.AttackAnimation)))
DefaultAnimation.PlayThen(NormalizeInfantrySequence(self, info.AttackAnimation), () => State = AnimationState.Idle);
}
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)
{
State = AnimationState.Moving;
DefaultAnimation.PlayRepeating(NormalizeInfantrySequence(self, "run"));
DefaultAnimation.PlayRepeating(NormalizeInfantrySequence(self, info.MoveAnimation));
}
dirty = false;
@@ -133,7 +134,7 @@ namespace OpenRA.Mods.RA.Render
if (info.SpawnsCorpse)
{
SpawnCorpse(self, "die" + (e.Warhead.InfDeath));
SpawnCorpse(self, info.DeathAnimationPrefix + (e.Warhead.InfDeath));
}
}

View File

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

View File

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

View File

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