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