Added FacingInit and AltitudeInit. Used in Mobile/Aircraft/Husks. Refactored Production, SpyPlane, Paratroopers and LeavesHusk

This commit is contained in:
alzeih
2010-08-02 00:49:26 +12:00
parent 2cc6e197fa
commit 4ea66ea309
8 changed files with 83 additions and 19 deletions

View File

@@ -12,6 +12,7 @@ using OpenRA.Mods.RA.Activities;
using OpenRA.Orders;
using OpenRA.Traits;
using OpenRA.Traits.Activities;
using OpenRA.FileFormats;
namespace OpenRA.Mods.RA
{
@@ -45,9 +46,13 @@ namespace OpenRA.Mods.RA
var enterCell = self.World.ChooseRandomEdgeCell();
var plane = self.World.CreateActor("U2", enterCell, self.Owner);
plane.traits.Get<IMove>().Altitude = plane.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
plane.traits.Get<IFacing>().Facing = Util.GetFacing(order.TargetLocation - enterCell, 0);
var plane = self.World.CreateActor("u2", new TypeDictionary
{
new LocationInit( enterCell ),
new OwnerInit( self.Owner ),
new FacingInit( Util.GetFacing(order.TargetLocation - enterCell, 0) ),
new AltitudeInit( Rules.Info["u2"].Traits.Get<PlaneInfo>().CruiseAltitude ),
});
plane.CancelActivity();
plane.QueueActivity(new Fly(Util.CenterOfCell(order.TargetLocation)));