Rewrite Aircraft movement using world coords.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2013 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,
|
||||
@@ -19,6 +19,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
|
||||
public readonly bool Spins = true;
|
||||
public readonly bool Moves = false;
|
||||
public readonly WRange Velocity = new WRange(43);
|
||||
|
||||
public object Create(ActorInitializer init) { return new FallsToEarth(init.self, this); }
|
||||
}
|
||||
@@ -47,7 +48,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
var aircraft = self.Trait<Aircraft>();
|
||||
if (aircraft.Altitude <= 0)
|
||||
if (self.CenterPosition.Z <= 0)
|
||||
{
|
||||
if (info.Explosion != null)
|
||||
Combat.DoExplosion(self, info.Explosion, self.CenterPosition);
|
||||
@@ -62,15 +63,14 @@ namespace OpenRA.Mods.RA.Air
|
||||
aircraft.Facing = (aircraft.Facing + spin) % 256;
|
||||
}
|
||||
|
||||
if (info.Moves)
|
||||
FlyUtil.Fly(self, aircraft.Altitude);
|
||||
|
||||
aircraft.Altitude--;
|
||||
var move = info.Moves ? aircraft.FlyStep(aircraft.Facing) : WVec.Zero;
|
||||
move -= new WVec(WRange.Zero, WRange.Zero, info.Velocity);
|
||||
aircraft.SetPosition(self, aircraft.CenterPosition + move);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// Cannot be cancelled
|
||||
public override void Cancel( Actor self ) { }
|
||||
public override void Cancel(Actor self) { }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user