make cargo unload deploy action queueable

fix line spacing

remove unnecessary null check
This commit is contained in:
tovl
2019-01-12 21:29:54 +01:00
committed by reaperrr
parent da2e56e478
commit 9f419fca34
2 changed files with 11 additions and 3 deletions

View File

@@ -59,6 +59,12 @@ namespace OpenRA.Mods.Common.Activities
if (IsCanceling || cargo.IsEmpty(self)) if (IsCanceling || cargo.IsEmpty(self))
return NextActivity; return NextActivity;
if (!cargo.CanUnload())
{
Cancel(self, true);
return NextActivity;
}
foreach (var inu in notifiers) foreach (var inu in notifiers)
inu.Unloading(self); inu.Unloading(self);

View File

@@ -185,11 +185,13 @@ namespace OpenRA.Mods.Common.Traits
{ {
if (order.OrderString == "Unload") if (order.OrderString == "Unload")
{ {
if (!CanUnload()) if (!order.Queued && !CanUnload())
return; return;
if (!order.Queued)
self.CancelActivity();
Unloading = true; Unloading = true;
self.CancelActivity();
if (aircraft != null) if (aircraft != null)
self.QueueActivity(new HeliLand(self, true)); self.QueueActivity(new HeliLand(self, true));
self.QueueActivity(new UnloadCargo(self, true)); self.QueueActivity(new UnloadCargo(self, true));
@@ -201,7 +203,7 @@ namespace OpenRA.Mods.Common.Traits
return Util.AdjacentCells(self.World, Target.FromActor(self)).Where(c => self.Location != c); return Util.AdjacentCells(self.World, Target.FromActor(self)).Where(c => self.Location != c);
} }
bool CanUnload() public bool CanUnload()
{ {
if (checkTerrainType) if (checkTerrainType)
{ {