Merge pull request #7167 from MatthijsBenschop/d2k-carryall-extras

Some carryall fixes
This commit is contained in:
Oliver Brakmann
2015-01-04 14:11:13 +01:00
2 changed files with 12 additions and 11 deletions

View File

@@ -54,17 +54,18 @@ namespace OpenRA.Mods.D2k.Traits
void RequestTransport(CPos destination, Activity afterLandActivity) void RequestTransport(CPos destination, Activity afterLandActivity)
{ {
if (locked || Reserved) if (destination == CPos.Zero || (self.Location - destination).Length < info.MinDistance)
return; {
WantsTransport = false; // Be sure to cancel any pending transports
if (destination == CPos.Zero)
return;
if ((self.Location - destination).Length < info.MinDistance)
return; return;
}
Destination = destination; Destination = destination;
this.afterLandActivity = afterLandActivity; this.afterLandActivity = afterLandActivity;
if (locked || Reserved)
return;
WantsTransport = true; WantsTransport = true;
// Inform all idle carriers // Inform all idle carriers
@@ -87,7 +88,7 @@ namespace OpenRA.Mods.D2k.Traits
return; return;
WantsTransport = false; WantsTransport = false;
Reserved = false; afterLandActivity = null;
// TODO: We could implement something like a carrier.Trait<AutoCarryAll>().CancelTransportNotify(self) and call it here // TODO: We could implement something like a carrier.Trait<AutoCarryAll>().CancelTransportNotify(self) and call it here
} }

View File

@@ -181,7 +181,7 @@ namespace OpenRA.Mods.RA.Traits
foreach (var n in notify) foreach (var n in notify)
n.MovingToResources(self, moveTo, next); n.MovingToResources(self, moveTo, next);
self.QueueActivity(next); self.QueueActivity(new FindResources());
return; return;
} }
} }
@@ -355,9 +355,9 @@ namespace OpenRA.Mods.RA.Traits
self.QueueActivity(new DeliverResources()); self.QueueActivity(new DeliverResources());
var notify = self.TraitsImplementing<INotifyHarvesterAction>(); var notify = self.TraitsImplementing<INotifyHarvesterAction>();
var next = new FindResources(); var next = new DeliverResources();
foreach (var n in notify) foreach (var n in notify)
n.MovingToResources(self, order.TargetLocation, next); n.MovingToRefinery(self, order.TargetLocation, next);
} }
else if (order.OrderString == "Stop" || order.OrderString == "Move") else if (order.OrderString == "Stop" || order.OrderString == "Move")
{ {