Fix harvesters losing their last harvesting position when carried by carryall.
This commit is contained in:
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (self.Location != proc.Location + iao.DeliveryOffset)
|
||||
{
|
||||
foreach (var n in self.TraitsImplementing<INotifyHarvesterAction>())
|
||||
n.MovingToRefinery(self, proc, new FindAndDeliverResources(self));
|
||||
n.MovingToRefinery(self, proc);
|
||||
|
||||
QueueChild(movement.MoveTo(proc.Location + iao.DeliveryOffset, 0));
|
||||
return false;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (self.Location != targetCell)
|
||||
{
|
||||
foreach (var n in self.TraitsImplementing<INotifyHarvesterAction>())
|
||||
n.MovingToResources(self, targetCell, new FindAndDeliverResources(self));
|
||||
n.MovingToResources(self, targetCell);
|
||||
|
||||
self.SetTargetLine(Target.FromCell(self.World, targetCell), Color.Red, false);
|
||||
QueueChild(move.MoveTo(targetCell, 2));
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
QueueChild(new WaitForTransport(self, moveActivities));
|
||||
|
||||
// TODO: Make this compatible with RepairableNear
|
||||
transport.RequestTransport(self, targetCell, new Resupply(self, host.Actor, closeEnough));
|
||||
transport.RequestTransport(self, targetCell);
|
||||
}
|
||||
else
|
||||
QueueChild(moveActivities);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("The condition to grant to self while being carried.")]
|
||||
public readonly string CarriedCondition = null;
|
||||
|
||||
[GrantedConditionReference]
|
||||
[Desc("The condition to grant to self while being locked for carry.")]
|
||||
public readonly string LockedCondition = null;
|
||||
|
||||
[Desc("Carryall attachment point relative to body.")]
|
||||
public readonly WVec LocalOffset = WVec.Zero;
|
||||
|
||||
@@ -36,6 +40,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
ConditionManager conditionManager;
|
||||
int reservedToken = ConditionManager.InvalidConditionToken;
|
||||
int carriedToken = ConditionManager.InvalidConditionToken;
|
||||
int lockedToken = ConditionManager.InvalidConditionToken;
|
||||
|
||||
public Actor Carrier { get; private set; }
|
||||
public bool Reserved { get { return state != State.Free; } }
|
||||
@@ -100,6 +105,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (reservedToken != ConditionManager.InvalidConditionToken)
|
||||
reservedToken = conditionManager.RevokeCondition(self, reservedToken);
|
||||
|
||||
if (lockedToken != ConditionManager.InvalidConditionToken)
|
||||
lockedToken = conditionManager.RevokeCondition(self, lockedToken);
|
||||
}
|
||||
|
||||
// Prepare for transport pickup
|
||||
@@ -110,7 +118,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
state = State.Locked;
|
||||
Carrier = carrier;
|
||||
self.QueueActivity(false, new WaitFor(() => state != State.Locked, false));
|
||||
|
||||
if (lockedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.LockedCondition))
|
||||
lockedToken = conditionManager.GrantCondition(self, Info.LockedCondition);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,18 +29,18 @@ namespace OpenRA.Mods.Common.Traits
|
||||
transports = self.TraitsImplementing<ICallForTransport>().ToArray();
|
||||
}
|
||||
|
||||
void INotifyHarvesterAction.MovingToResources(Actor self, CPos targetCell, Activity next)
|
||||
void INotifyHarvesterAction.MovingToResources(Actor self, CPos targetCell)
|
||||
{
|
||||
foreach (var t in transports)
|
||||
t.RequestTransport(self, targetCell, next);
|
||||
t.RequestTransport(self, targetCell);
|
||||
}
|
||||
|
||||
void INotifyHarvesterAction.MovingToRefinery(Actor self, Actor refineryActor, Activity next)
|
||||
void INotifyHarvesterAction.MovingToRefinery(Actor self, Actor refineryActor)
|
||||
{
|
||||
var iao = refineryActor.Trait<IAcceptResources>();
|
||||
var location = refineryActor.Location + iao.DeliveryOffset;
|
||||
foreach (var t in transports)
|
||||
t.RequestTransport(self, location, next);
|
||||
t.RequestTransport(self, location);
|
||||
}
|
||||
|
||||
void INotifyHarvesterAction.MovementCancelled(Actor self)
|
||||
|
||||
@@ -210,9 +210,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return color;
|
||||
}
|
||||
|
||||
void INotifyHarvesterAction.MovingToResources(Actor self, CPos targetCell, Activity next) { }
|
||||
void INotifyHarvesterAction.MovingToResources(Actor self, CPos targetCell) { }
|
||||
|
||||
void INotifyHarvesterAction.MovingToRefinery(Actor self, Actor refineryActor, Activity next) { }
|
||||
void INotifyHarvesterAction.MovingToRefinery(Actor self, Actor refineryActor) { }
|
||||
|
||||
void INotifyHarvesterAction.MovementCancelled(Actor self) { }
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
void INotifyHarvesterAction.Docked() { }
|
||||
void INotifyHarvesterAction.Undocked() { }
|
||||
void INotifyHarvesterAction.MovingToResources(Actor self, CPos targetCell, Activity next) { }
|
||||
void INotifyHarvesterAction.MovingToRefinery(Actor self, Actor refineryActor, Activity next) { }
|
||||
void INotifyHarvesterAction.MovingToResources(Actor self, CPos targetCell) { }
|
||||
void INotifyHarvesterAction.MovingToRefinery(Actor self, Actor refineryActor) { }
|
||||
void INotifyHarvesterAction.MovementCancelled(Actor self) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
anim.PlayThen(info.Sequence, () => visible = false);
|
||||
}
|
||||
|
||||
void INotifyHarvesterAction.MovingToResources(Actor self, CPos targetCell, Activity next) { }
|
||||
void INotifyHarvesterAction.MovingToRefinery(Actor self, Actor targetRefinery, Activity next) { }
|
||||
void INotifyHarvesterAction.MovingToResources(Actor self, CPos targetCell) { }
|
||||
void INotifyHarvesterAction.MovingToRefinery(Actor self, Actor targetRefinery) { }
|
||||
void INotifyHarvesterAction.MovementCancelled(Actor self) { }
|
||||
void INotifyHarvesterAction.Docked() { }
|
||||
void INotifyHarvesterAction.Undocked() { }
|
||||
|
||||
@@ -196,8 +196,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public interface INotifyHarvesterAction
|
||||
{
|
||||
void MovingToResources(Actor self, CPos targetCell, Activity next);
|
||||
void MovingToRefinery(Actor self, Actor refineryActor, Activity next);
|
||||
void MovingToResources(Actor self, CPos targetCell);
|
||||
void MovingToRefinery(Actor self, Actor refineryActor);
|
||||
void MovementCancelled(Actor self);
|
||||
void Harvested(Actor self, ResourceType resource);
|
||||
void Docked();
|
||||
@@ -287,7 +287,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
WDist MinimumDistance { get; }
|
||||
bool WantsTransport { get; }
|
||||
void MovementCancelled(Actor self);
|
||||
void RequestTransport(Actor self, CPos destination, Activity afterLandActivity);
|
||||
void RequestTransport(Actor self, CPos destination);
|
||||
}
|
||||
|
||||
public interface IDeathActorInitModifier
|
||||
|
||||
@@ -210,6 +210,7 @@
|
||||
AutoCarryable:
|
||||
CarriedCondition: notmobile
|
||||
ReservedCondition: carryall-reserved
|
||||
LockedCondition: notmobile
|
||||
WithDecoration@CARRYALL:
|
||||
Image: pips
|
||||
Sequence: pickup-indicator
|
||||
|
||||
@@ -97,7 +97,7 @@ BUS:
|
||||
Mobile:
|
||||
TurnSpeed: 5
|
||||
Speed: 113
|
||||
PauseOnCondition: empdisable || loading || being-captured
|
||||
PauseOnCondition: empdisable || loading || being-captured || carried
|
||||
Health:
|
||||
HP: 10000
|
||||
Armor:
|
||||
@@ -123,7 +123,7 @@ PICK:
|
||||
Mobile:
|
||||
TurnSpeed: 5
|
||||
Speed: 113
|
||||
PauseOnCondition: empdisable || loading || being-captured
|
||||
PauseOnCondition: empdisable || loading || being-captured || carried
|
||||
Health:
|
||||
HP: 10000
|
||||
Armor:
|
||||
@@ -149,7 +149,7 @@ CAR:
|
||||
Mobile:
|
||||
TurnSpeed: 5
|
||||
Speed: 113
|
||||
PauseOnCondition: empdisable || loading || being-captured
|
||||
PauseOnCondition: empdisable || loading || being-captured || carried
|
||||
Health:
|
||||
HP: 10000
|
||||
Armor:
|
||||
@@ -175,7 +175,7 @@ WINI:
|
||||
Mobile:
|
||||
TurnSpeed: 5
|
||||
Speed: 113
|
||||
PauseOnCondition: empdisable || loading || being-captured
|
||||
PauseOnCondition: empdisable || loading || being-captured || carried
|
||||
Health:
|
||||
HP: 20000
|
||||
Armor:
|
||||
|
||||
@@ -753,7 +753,7 @@
|
||||
Action: Kill
|
||||
DrawLineToTarget:
|
||||
Mobile:
|
||||
PauseOnCondition: empdisable || being-captured
|
||||
PauseOnCondition: empdisable || being-captured || carried
|
||||
Locomotor: wheeled
|
||||
TurnSpeed: 5
|
||||
Voice: Move
|
||||
@@ -816,6 +816,7 @@
|
||||
Modifier: 60
|
||||
Carryable:
|
||||
RequiresCondition: !inside-tunnel
|
||||
LockedCondition: carried
|
||||
RevealOnFire:
|
||||
EntersTunnels:
|
||||
Voice: Move
|
||||
|
||||
@@ -15,7 +15,7 @@ APC:
|
||||
Mobile:
|
||||
TurnSpeed: 5
|
||||
Speed: 113
|
||||
PauseOnCondition: empdisable || loading || being-captured
|
||||
PauseOnCondition: empdisable || loading || being-captured || carried
|
||||
Locomotor: amphibious
|
||||
Health:
|
||||
HP: 20000
|
||||
@@ -332,7 +332,6 @@ JUGG:
|
||||
Mobile:
|
||||
Speed: 71
|
||||
TurnSpeed: 5
|
||||
PauseOnCondition: empdisable || being-captured
|
||||
RequireForceMoveCondition: !undeployed
|
||||
RevealsShroud:
|
||||
RequiresCondition: !inside-tunnel
|
||||
|
||||
@@ -104,7 +104,6 @@ TTNK:
|
||||
Mobile:
|
||||
TurnSpeed: 5
|
||||
Speed: 85
|
||||
PauseOnCondition: empdisable || being-captured
|
||||
RequireForceMoveCondition: !undeployed
|
||||
Health:
|
||||
HP: 35000
|
||||
@@ -234,7 +233,6 @@ ART2:
|
||||
Mobile:
|
||||
Speed: 71
|
||||
TurnSpeed: 2
|
||||
PauseOnCondition: empdisable || being-captured
|
||||
RequireForceMoveCondition: !undeployed
|
||||
RevealsShroud:
|
||||
RequiresCondition: !inside-tunnel
|
||||
@@ -400,7 +398,7 @@ SAPC:
|
||||
Mobile:
|
||||
TurnSpeed: 5
|
||||
Speed: 71
|
||||
PauseOnCondition: empdisable || loading || being-captured
|
||||
PauseOnCondition: empdisable || loading || being-captured || carried
|
||||
Locomotor: subterranean
|
||||
Health:
|
||||
HP: 17500
|
||||
|
||||
@@ -19,7 +19,6 @@ MCV:
|
||||
Armor:
|
||||
Type: Heavy
|
||||
Mobile:
|
||||
PauseOnCondition: empdisable || being-captured
|
||||
Speed: 42
|
||||
RevealsShroud:
|
||||
RequiresCondition: !inside-tunnel
|
||||
@@ -128,7 +127,6 @@ LPST:
|
||||
Mobile:
|
||||
Speed: 85
|
||||
TurnSpeed: 5
|
||||
PauseOnCondition: empdisable || being-captured
|
||||
RequireForceMoveCondition: !undeployed
|
||||
RevealsShroud:
|
||||
RequiresCondition: !inside-tunnel && undeployed
|
||||
|
||||
Reference in New Issue
Block a user