Fix #1269 - Transport Helicopter Loading while in the Air

Note that weight is now checked for cargo (this might break things)
This commit is contained in:
alzeih
2011-12-11 22:19:59 +13:00
committed by Chris Forbes
parent 7e590b05c1
commit b508f7c300
2 changed files with 11 additions and 2 deletions

View File

@@ -27,10 +27,9 @@ namespace OpenRA.Mods.RA.Activities
if (transport == null || !transport.IsInWorld) return NextActivity;
var cargo = transport.Trait<Cargo>();
if (!cargo.HasSpace(1))
if (!cargo.CanLoad(transport, self))
return NextActivity;
// Todo: Queue a move order to the transport? need to be
// careful about units that can't path to the transport
if ((transport.Location - self.Location).LengthSquared > 2)

View File

@@ -87,6 +87,16 @@ namespace OpenRA.Mods.RA
return true;
}
public bool CanLoad(Actor self, Actor a)
{
if (!HasSpace(GetWeight(a)))
return false;
// Cannot load mid-air
var move = self.TraitOrDefault<IMove>();
return move == null || move.Altitude == 0;
}
public string CursorForOrder(Actor self, Order order)
{
if (order.OrderString != "Unload") return null;