Fix harvesters losing their last harvesting position when carried by carryall.

This commit is contained in:
tovl
2019-07-15 20:01:20 +02:00
committed by teinarss
parent d59b01597a
commit 922c6e9c40
16 changed files with 39 additions and 37 deletions

View File

@@ -26,7 +26,6 @@ namespace OpenRA.Mods.Common.Traits
public class AutoCarryable : Carryable, ICallForTransport
{
readonly AutoCarryableInfo info;
Activity afterLandActivity;
public AutoCarryable(Actor self, AutoCarryableInfo info)
: base(self, info)
@@ -38,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
// No longer want to be carried
void ICallForTransport.MovementCancelled(Actor self) { MovementCancelled(self); }
void ICallForTransport.RequestTransport(Actor self, CPos destination, Activity afterLandActivity) { RequestTransport(self, destination, afterLandActivity); }
void ICallForTransport.RequestTransport(Actor self, CPos destination) { RequestTransport(self, destination); }
void MovementCancelled(Actor self)
{
@@ -46,12 +45,11 @@ namespace OpenRA.Mods.Common.Traits
return;
Destination = null;
afterLandActivity = null;
// TODO: We could implement something like a carrier.Trait<Carryall>().CancelTransportNotify(self) and call it here
}
void RequestTransport(Actor self, CPos destination, Activity afterLandActivity)
void RequestTransport(Actor self, CPos destination)
{
var delta = self.World.Map.CenterOfCell(destination) - self.CenterPosition;
if (delta.HorizontalLengthSquared < info.MinDistance.LengthSquared)
@@ -61,7 +59,6 @@ namespace OpenRA.Mods.Common.Traits
}
Destination = destination;
this.afterLandActivity = afterLandActivity;
if (state != State.Free)
return;
@@ -85,9 +82,6 @@ namespace OpenRA.Mods.Common.Traits
Destination = null;
if (afterLandActivity != null)
self.QueueActivity(false, afterLandActivity);
base.Detached(self);
}