diff --git a/OpenRA.Mods.Common/Traits/Carryall.cs b/OpenRA.Mods.Common/Traits/Carryall.cs index 44136d901d..44933577b2 100644 --- a/OpenRA.Mods.Common/Traits/Carryall.cs +++ b/OpenRA.Mods.Common/Traits/Carryall.cs @@ -53,6 +53,10 @@ namespace OpenRA.Mods.Common.Traits [Desc("Cursor to display when picking up the passengers.")] public readonly string PickUpCursor = "ability"; + [GrantedConditionReference] + [Desc("Condition to grant to the Carryall while it is carrying something.")] + public readonly string CarryCondition = null; + [VoiceReference] public readonly string Voice = "Action"; @@ -85,6 +89,7 @@ namespace OpenRA.Mods.Common.Traits WAngle cachedFacing; IActorPreview[] carryablePreview; HashSet landableTerrainTypes; + int carryConditionToken = Actor.InvalidConditionToken; /// Offset between the carryall's and the carried actor's CenterPositions public WVec CarryableOffset { get; private set; } @@ -177,6 +182,8 @@ namespace OpenRA.Mods.Common.Traits Carryable = carryable; State = CarryallState.Carrying; self.World.ScreenMap.AddOrUpdate(self); + if (carryConditionToken == Actor.InvalidConditionToken) + carryConditionToken = self.GrantCondition(Info.CarryCondition); CarryableOffset = OffsetForCarryable(self, carryable); landableTerrainTypes = Carryable.Trait().Info.LocomotorInfo.TerrainSpeeds.Keys.ToHashSet(); @@ -188,6 +195,8 @@ namespace OpenRA.Mods.Common.Traits { UnreserveCarryable(self); self.World.ScreenMap.AddOrUpdate(self); + if (carryConditionToken != Actor.InvalidConditionToken) + carryConditionToken = self.RevokeCondition(carryConditionToken); carryablePreview = null; landableTerrainTypes = null;