Further untangle (and - hopefully - fix) the afterLandActivity mess

This commit is contained in:
abcdefg30
2018-08-31 07:36:31 +02:00
committed by Paul Chote
parent 7e20bdd7ea
commit db58b35856
3 changed files with 3 additions and 12 deletions

View File

@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Activities
if (self.Location != proc.Location + iao.DeliveryOffset) if (self.Location != proc.Location + iao.DeliveryOffset)
{ {
foreach (var n in self.TraitsImplementing<INotifyHarvesterAction>()) foreach (var n in self.TraitsImplementing<INotifyHarvesterAction>())
n.MovingToRefinery(self, proc, this); n.MovingToRefinery(self, proc, null);
return ActivityUtils.SequenceActivities(movement.MoveTo(proc.Location + iao.DeliveryOffset, 0), this); return ActivityUtils.SequenceActivities(movement.MoveTo(proc.Location + iao.DeliveryOffset, 0), this);
} }

View File

@@ -11,7 +11,6 @@
using System.Linq; using System.Linq;
using OpenRA.Activities; using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
@@ -88,15 +87,7 @@ namespace OpenRA.Mods.Common.Traits
Destination = null; Destination = null;
if (afterLandActivity != null) if (afterLandActivity != null)
{
// HACK: Harvesters need special treatment to avoid getting stuck on resource fields,
// so if a Harvester's afterLandActivity is not DeliverResources, queue a new FindResources activity
var findResources = self.Info.HasTraitInfo<HarvesterInfo>() && !(afterLandActivity is DeliverResources);
if (findResources)
self.QueueActivity(new FindResources(self));
else
self.QueueActivity(false, afterLandActivity); self.QueueActivity(false, afterLandActivity);
}
base.Detached(self); base.Detached(self);
} }

View File

@@ -412,7 +412,7 @@ namespace OpenRA.Mods.Common.Traits
self.QueueActivity(new DeliverResources(self)); self.QueueActivity(new DeliverResources(self));
foreach (var n in notifyHarvesterAction) foreach (var n in notifyHarvesterAction)
n.MovingToRefinery(self, targetActor, new DeliverResources(self)); n.MovingToRefinery(self, targetActor, null);
} }
else if (order.OrderString == "Stop" || order.OrderString == "Move") else if (order.OrderString == "Stop" || order.OrderString == "Move")
{ {