skip 'make' animation for mapunits

This commit is contained in:
Chris Forbes
2009-11-01 19:09:18 +13:00
parent f9fb04372c
commit 4336c2af35
3 changed files with 16 additions and 8 deletions

View File

@@ -21,8 +21,12 @@ namespace OpenRa.Game
public int2 Location; public int2 Location;
public Player Owner; public Player Owner;
public int Health; public int Health;
public readonly bool IsMapActor;
public Actor(string name, int2 location, Player owner) public Actor(string name, int2 location, Player owner)
: this( name, location, owner, false ) {}
public Actor( string name, int2 location, Player owner, bool isMapActor )
{ {
ActorID = Game.world.NextAID(); ActorID = Game.world.NextAID();
unitInfo = Rules.UnitInfo[ name ]; unitInfo = Rules.UnitInfo[ name ];
@@ -30,6 +34,7 @@ namespace OpenRa.Game
CenterLocation = new float2( 12, 12 ) + Game.CellSize * (float2)Location; CenterLocation = new float2( 12, 12 ) + Game.CellSize * (float2)Location;
Owner = owner; Owner = owner;
Health = unitInfo.Strength; /* todo: handle cases where this is not true! */ Health = unitInfo.Strength; /* todo: handle cases where this is not true! */
IsMapActor = isMapActor;
if( unitInfo.Traits != null ) if( unitInfo.Traits != null )
{ {

View File

@@ -87,7 +87,7 @@ namespace OpenRa.Game
//num=owner,type,health,location,facing,trigger,unknown,shouldRepair //num=owner,type,health,location,facing,trigger,unknown,shouldRepair
var parts = s.Value.ToLowerInvariant().Split( ',' ); var parts = s.Value.ToLowerInvariant().Split( ',' );
var loc = int.Parse( parts[ 3 ] ); var loc = int.Parse( parts[ 3 ] );
world.Add( new Actor( parts[ 1 ], new int2( loc % 128, loc / 128 ), players[ 0 ] ) ); world.Add( new Actor( parts[ 1 ], new int2( loc % 128, loc / 128 ), players[ 0 ], true ) );
} }
} }
@@ -98,7 +98,7 @@ namespace OpenRa.Game
//num=owner,type,health,location,facing,action,trigger //num=owner,type,health,location,facing,action,trigger
var parts = s.Value.ToLowerInvariant().Split( ',' ); var parts = s.Value.ToLowerInvariant().Split( ',' );
var loc = int.Parse( parts[ 3 ] ); var loc = int.Parse( parts[ 3 ] );
world.Add( new Actor( parts[ 1 ], new int2( loc % 128, loc / 128 ), players[ 0 ] ) ); world.Add( new Actor( parts[ 1 ], new int2( loc % 128, loc / 128 ), players[ 0 ], true ) );
} }
} }

View File

@@ -18,13 +18,16 @@ namespace OpenRa.Game.Traits
public RenderBuilding(Actor self) public RenderBuilding(Actor self)
: base(self) : base(self)
{ {
if (self.IsMapActor)
anim.PlayRepeating("idle");
else
anim.PlayThen("make", () => anim.PlayRepeating("idle")); anim.PlayThen("make", () => anim.PlayRepeating("idle"));
DoBib(self, false); DoBib(self, false);
} }
void DoBib(Actor self, bool isRemove) void DoBib(Actor self, bool isRemove)
{ {
// at this point, we already know where we are, so we can safely place the bib in the smudge
var buildingInfo = (UnitInfo.BuildingInfo)self.unitInfo; var buildingInfo = (UnitInfo.BuildingInfo)self.unitInfo;
if (buildingInfo.Bib) if (buildingInfo.Bib)
{ {