changes facing (and desireFacing) on Mobile and on Turreted. range is now 0..255

This commit is contained in:
Bob
2009-10-19 23:45:14 +13:00
parent 451fdc1615
commit a7ce0f97d1
14 changed files with 162 additions and 150 deletions

View File

@@ -15,6 +15,7 @@ namespace OpenRa.Game.Traits
public Order Order(Actor self, Game game, int2 xy)
{
DeployLocation = null;
// TODO: check that there's enough space at the destination.
if( xy == self.Location )
return new DeployMcvOrder( self, xy );
@@ -24,24 +25,21 @@ namespace OpenRa.Game.Traits
public void Tick(Actor self, Game game, int dt)
{
var mobile = self.traits.Get<Mobile>();
if( self.Location != DeployLocation )
return;
var mobile = self.traits.Get<Mobile>();
mobile.desiredFacing = 96;
if( mobile.moveFraction < mobile.moveFractionTotal )
return;
if( self.Location != DeployLocation )
{
DeployLocation = null;
return;
}
if (mobile.Turn(12))
if( mobile.facing != mobile.desiredFacing )
return;
game.world.AddFrameEndTask(_ =>
{
game.world.Remove(self);
game.world.Add(new Actor("fact", self.Location - new int2(1, 1), self.Owner));
game.world.Remove(self);
game.world.Add(new Actor("fact", self.Location - new int2(1, 1), self.Owner));
});
}
}