Files
OpenRA/OpenRa.Game/Traits/McvDeploy.cs
Bob 707ba7d957 Locked frame times; SAM, GUN, AGUN work again.
- all frames are 40ms long. (except something in the sidebar, which should really be PlayFetchIndex anyway)
    - SAM, GUN, and AGUN no longer crash the game when built. (Turreted used Mobile, which those buildings don't have)
2009-10-20 00:57:50 +13:00

47 lines
988 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenRa.Game.Traits
{
class McvDeploy : IOrder, ITick
{
public int2? DeployLocation;
public McvDeploy(Actor self)
{
}
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 );
return null;
}
public void Tick(Actor self, Game game)
{
if( self.Location != DeployLocation )
return;
var mobile = self.traits.Get<Mobile>();
mobile.desiredFacing = 96;
if( mobile.moveFraction < mobile.moveFractionTotal )
return;
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));
});
}
}
}