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:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user