From 0868558e9484e275582fb047debb28444ca727c2 Mon Sep 17 00:00:00 2001 From: Matthijs Benschop Date: Sun, 21 Dec 2014 23:03:29 +0100 Subject: [PATCH 1/3] Allow a carryable to change his destination after being reserved --- OpenRA.Mods.D2k/Traits/Carryable.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/OpenRA.Mods.D2k/Traits/Carryable.cs b/OpenRA.Mods.D2k/Traits/Carryable.cs index 07ea7f824d..400f9a8660 100644 --- a/OpenRA.Mods.D2k/Traits/Carryable.cs +++ b/OpenRA.Mods.D2k/Traits/Carryable.cs @@ -54,17 +54,18 @@ namespace OpenRA.Mods.D2k.Traits void RequestTransport(CPos destination, Activity afterLandActivity) { - if (locked || Reserved) - return; - - if (destination == CPos.Zero) - return; - - if ((self.Location - destination).Length < info.MinDistance) + if (destination == CPos.Zero || (self.Location - destination).Length < info.MinDistance) + { + WantsTransport = false; // Be sure to cancel any pending transports return; + } Destination = destination; this.afterLandActivity = afterLandActivity; + + if (locked || Reserved) + return; + WantsTransport = true; // Inform all idle carriers From 740595064a65c32499a9c64892e4ccf60d8ee942 Mon Sep 17 00:00:00 2001 From: Matthijs Benschop Date: Sun, 21 Dec 2014 23:20:04 +0100 Subject: [PATCH 2/3] The carryable should not unreserve itself --- OpenRA.Mods.D2k/Traits/Carryable.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenRA.Mods.D2k/Traits/Carryable.cs b/OpenRA.Mods.D2k/Traits/Carryable.cs index 400f9a8660..e68c4d34c5 100644 --- a/OpenRA.Mods.D2k/Traits/Carryable.cs +++ b/OpenRA.Mods.D2k/Traits/Carryable.cs @@ -88,7 +88,6 @@ namespace OpenRA.Mods.D2k.Traits return; WantsTransport = false; - Reserved = false; // TODO: We could implement something like a carrier.Trait().CancelTransportNotify(self) and call it here } From 3c49364b57c772d992dbcad9eff5bcf6c44006f0 Mon Sep 17 00:00:00 2001 From: Matthijs Benschop Date: Mon, 22 Dec 2014 14:57:01 +0100 Subject: [PATCH 3/3] Fix harvesters doing nothing after being dropped of by a carryall --- OpenRA.Mods.D2k/Traits/Carryable.cs | 1 + OpenRA.Mods.RA/Traits/Harvester.cs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.D2k/Traits/Carryable.cs b/OpenRA.Mods.D2k/Traits/Carryable.cs index e68c4d34c5..93ba447330 100644 --- a/OpenRA.Mods.D2k/Traits/Carryable.cs +++ b/OpenRA.Mods.D2k/Traits/Carryable.cs @@ -88,6 +88,7 @@ namespace OpenRA.Mods.D2k.Traits return; WantsTransport = false; + afterLandActivity = null; // TODO: We could implement something like a carrier.Trait().CancelTransportNotify(self) and call it here } diff --git a/OpenRA.Mods.RA/Traits/Harvester.cs b/OpenRA.Mods.RA/Traits/Harvester.cs index ae3b814d5e..fd4d2514bd 100644 --- a/OpenRA.Mods.RA/Traits/Harvester.cs +++ b/OpenRA.Mods.RA/Traits/Harvester.cs @@ -181,7 +181,7 @@ namespace OpenRA.Mods.RA.Traits foreach (var n in notify) n.MovingToResources(self, moveTo, next); - self.QueueActivity(next); + self.QueueActivity(new FindResources()); return; } } @@ -355,9 +355,9 @@ namespace OpenRA.Mods.RA.Traits self.QueueActivity(new DeliverResources()); var notify = self.TraitsImplementing(); - var next = new FindResources(); + var next = new DeliverResources(); 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") {