diff --git a/OpenRA.Mods.Common/Activities/DeliverResources.cs b/OpenRA.Mods.Common/Activities/DeliverResources.cs index 4d263b6cf9..480624c18f 100644 --- a/OpenRA.Mods.Common/Activities/DeliverResources.cs +++ b/OpenRA.Mods.Common/Activities/DeliverResources.cs @@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Activities if (self.Location != proc.Location + iao.DeliveryOffset) { foreach (var n in self.TraitsImplementing()) - n.MovingToRefinery(self, proc, new FindAndDeliverResources(self)); + n.MovingToRefinery(self, proc); QueueChild(movement.MoveTo(proc.Location + iao.DeliveryOffset, 0)); return false; diff --git a/OpenRA.Mods.Common/Activities/HarvestResource.cs b/OpenRA.Mods.Common/Activities/HarvestResource.cs index ef48cdcfe9..fe5deb038a 100644 --- a/OpenRA.Mods.Common/Activities/HarvestResource.cs +++ b/OpenRA.Mods.Common/Activities/HarvestResource.cs @@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Activities if (self.Location != targetCell) { foreach (var n in self.TraitsImplementing()) - 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)); diff --git a/OpenRA.Mods.Common/Activities/Resupply.cs b/OpenRA.Mods.Common/Activities/Resupply.cs index 8afb8f1c29..2e6a8b7713 100644 --- a/OpenRA.Mods.Common/Activities/Resupply.cs +++ b/OpenRA.Mods.Common/Activities/Resupply.cs @@ -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); diff --git a/OpenRA.Mods.Common/Traits/AutoCarryable.cs b/OpenRA.Mods.Common/Traits/AutoCarryable.cs index c5e353605a..7bc3a60dcf 100644 --- a/OpenRA.Mods.Common/Traits/AutoCarryable.cs +++ b/OpenRA.Mods.Common/Traits/AutoCarryable.cs @@ -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().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); } diff --git a/OpenRA.Mods.Common/Traits/Carryable.cs b/OpenRA.Mods.Common/Traits/Carryable.cs index c499ba9ff6..576e8c2811 100644 --- a/OpenRA.Mods.Common/Traits/Carryable.cs +++ b/OpenRA.Mods.Common/Traits/Carryable.cs @@ -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; } } diff --git a/OpenRA.Mods.Common/Traits/CarryableHarvester.cs b/OpenRA.Mods.Common/Traits/CarryableHarvester.cs index 5604f1751c..646ff13cf3 100644 --- a/OpenRA.Mods.Common/Traits/CarryableHarvester.cs +++ b/OpenRA.Mods.Common/Traits/CarryableHarvester.cs @@ -29,18 +29,18 @@ namespace OpenRA.Mods.Common.Traits transports = self.TraitsImplementing().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(); 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) diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs index dacf4caef6..af9ccd036a 100644 --- a/OpenRA.Mods.Common/Traits/Cloak.cs +++ b/OpenRA.Mods.Common/Traits/Cloak.cs @@ -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) { } diff --git a/OpenRA.Mods.Common/Traits/Render/WithHarvestAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithHarvestAnimation.cs index db428acc83..75c97311be 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithHarvestAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithHarvestAnimation.cs @@ -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) { } } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs index b0d8cb7cee..e12f60153a 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs @@ -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() { } diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index fb4586a77e..a1a2ce69b5 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -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 diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml index 0da0c5fcbc..23d33970a2 100644 --- a/mods/d2k/rules/defaults.yaml +++ b/mods/d2k/rules/defaults.yaml @@ -210,6 +210,7 @@ AutoCarryable: CarriedCondition: notmobile ReservedCondition: carryall-reserved + LockedCondition: notmobile WithDecoration@CARRYALL: Image: pips Sequence: pickup-indicator diff --git a/mods/ts/rules/civilian-vehicles.yaml b/mods/ts/rules/civilian-vehicles.yaml index 4a5e8697ab..af5ef9f257 100644 --- a/mods/ts/rules/civilian-vehicles.yaml +++ b/mods/ts/rules/civilian-vehicles.yaml @@ -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: diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index e6da920f84..243a4cb5ae 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -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 diff --git a/mods/ts/rules/gdi-vehicles.yaml b/mods/ts/rules/gdi-vehicles.yaml index c78e8bac11..af646319d2 100644 --- a/mods/ts/rules/gdi-vehicles.yaml +++ b/mods/ts/rules/gdi-vehicles.yaml @@ -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 diff --git a/mods/ts/rules/nod-vehicles.yaml b/mods/ts/rules/nod-vehicles.yaml index 46bf23c906..b222dfa01b 100644 --- a/mods/ts/rules/nod-vehicles.yaml +++ b/mods/ts/rules/nod-vehicles.yaml @@ -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 diff --git a/mods/ts/rules/shared-vehicles.yaml b/mods/ts/rules/shared-vehicles.yaml index 8b8fea057c..dffaad8b3d 100644 --- a/mods/ts/rules/shared-vehicles.yaml +++ b/mods/ts/rules/shared-vehicles.yaml @@ -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