diff --git a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs index c966b166ba..74e8f7ae7a 100644 --- a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs +++ b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs @@ -191,7 +191,7 @@ namespace OpenRA.Mods.Cnc.Traits WPos? initialTargetPosition = null, Color? targetLineColor = null) { return null; } public Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange, WPos? initialTargetPosition = null, Color? targetLineColor = null) { return null; } - public Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any) { return null; } + public Activity MoveIntoWorld(Actor self, int delay = 0) { return null; } public Activity MoveToTarget(Actor self, Target target, WPos? initialTargetPosition = null, Color? targetLineColor = null) { return null; } public Activity MoveIntoTarget(Actor self, Target target) { return null; } diff --git a/OpenRA.Mods.Common/Activities/Enter.cs b/OpenRA.Mods.Common/Activities/Enter.cs index 513fb2aed6..08449dc15e 100644 --- a/OpenRA.Mods.Common/Activities/Enter.cs +++ b/OpenRA.Mods.Common/Activities/Enter.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Activities public abstract class Enter : Activity { - enum EnterState { Approaching, Entering, Exiting } + enum EnterState { Approaching, Entering, Exiting, Finished } readonly IMove move; readonly Color? targetLineColor; @@ -133,15 +133,18 @@ namespace OpenRA.Mods.Common.Activities OnEnterComplete(self, target.Actor); lastState = EnterState.Exiting; - QueueChild(move.MoveIntoWorld(self, self.Location)); return false; } case EnterState.Exiting: - return true; + { + QueueChild(move.MoveIntoWorld(self)); + lastState = EnterState.Finished; + return false; + } } - return false; + return true; } public override IEnumerable TargetLineNodes(Actor self) diff --git a/OpenRA.Mods.Common/Activities/Parachute.cs b/OpenRA.Mods.Common/Activities/Parachute.cs index b66f07827d..334d66fa84 100644 --- a/OpenRA.Mods.Common/Activities/Parachute.cs +++ b/OpenRA.Mods.Common/Activities/Parachute.cs @@ -19,14 +19,12 @@ namespace OpenRA.Mods.Common.Activities { readonly IPositionable pos; readonly WVec fallVector; - readonly Actor ignore; int groundLevel; - public Parachute(Actor self, Actor ignoreActor = null) + public Parachute(Actor self) { pos = self.TraitOrDefault(); - ignore = ignoreActor; fallVector = new WVec(0, 0, self.Info.TraitInfo().FallRate); IsInterruptible = false; @@ -56,7 +54,7 @@ namespace OpenRA.Mods.Common.Activities pos.SetPosition(self, centerPosition + new WVec(0, 0, groundLevel - centerPosition.Z)); foreach (var np in self.TraitsImplementing()) - np.OnLanded(self, ignore); + np.OnLanded(self); } } } diff --git a/OpenRA.Mods.Common/Activities/EnterTransport.cs b/OpenRA.Mods.Common/Activities/RideTransport.cs similarity index 87% rename from OpenRA.Mods.Common/Activities/EnterTransport.cs rename to OpenRA.Mods.Common/Activities/RideTransport.cs index f1036b89f3..ea5fd8c1d9 100644 --- a/OpenRA.Mods.Common/Activities/EnterTransport.cs +++ b/OpenRA.Mods.Common/Activities/RideTransport.cs @@ -15,7 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Activities { - class EnterTransport : Enter + class RideTransport : Enter { readonly Passenger passenger; @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Activities Cargo enterCargo; Aircraft enterAircraft; - public EnterTransport(Actor self, Target target) + public RideTransport(Actor self, Target target) : base(self, target, Color.Green) { passenger = self.Trait(); @@ -63,10 +63,6 @@ namespace OpenRA.Mods.Common.Activities enterCargo.Load(enterActor, self); w.Remove(self); - - // Preemptively cancel any activities to avoid an edge-case where successively queued - // EnterTransports corrupt the actor state. Activities are cancelled again on unload - self.CancelActivity(); }); } diff --git a/OpenRA.Mods.Common/Activities/UnloadCargo.cs b/OpenRA.Mods.Common/Activities/UnloadCargo.cs index 41fe74868c..09c68826a2 100644 --- a/OpenRA.Mods.Common/Activities/UnloadCargo.cs +++ b/OpenRA.Mods.Common/Activities/UnloadCargo.cs @@ -121,9 +121,10 @@ namespace OpenRA.Mods.Common.Activities var move = actor.Trait(); var pos = actor.Trait(); - actor.CancelActivity(); + pos.SetPosition(self, exitSubCell.Value.First, exitSubCell.Value.Second); pos.SetVisualPosition(actor, spawn); - actor.QueueActivity(move.MoveIntoWorld(actor, exitSubCell.Value.First, exitSubCell.Value.Second)); + + actor.CancelActivity(); w.Add(actor); }); } diff --git a/OpenRA.Mods.Common/ActorInitializer.cs b/OpenRA.Mods.Common/ActorInitializer.cs index cadc0a8707..9726050fdd 100644 --- a/OpenRA.Mods.Common/ActorInitializer.cs +++ b/OpenRA.Mods.Common/ActorInitializer.cs @@ -24,6 +24,16 @@ namespace OpenRA.Mods.Common public int Value(World world) { return value; } } + public class MoveIntoWorldDelayInit : IActorInit + { + [FieldFromYamlKey] + readonly int value = 0; + + public MoveIntoWorldDelayInit() { } + public MoveIntoWorldDelayInit(int init) { value = init; } + public int Value(World world) { return value; } + } + public class DynamicFacingInit : IActorInit> { readonly Func func; diff --git a/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs index 43780fa60a..af240e1214 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs @@ -46,7 +46,10 @@ namespace OpenRA.Mods.Common.Scripting [Desc("Moves from outside the world into the cell grid.")] public void MoveIntoWorld(CPos cell) { - Self.QueueActivity(mobile.MoveIntoWorld(Self, cell, mobile.ToSubCell)); + var pos = Self.CenterPosition; + mobile.SetPosition(Self, cell); + mobile.SetVisualPosition(Self, pos); + Self.QueueActivity(mobile.MoveIntoWorld(Self)); } [ScriptActorPropertyActivity] @@ -60,7 +63,7 @@ namespace OpenRA.Mods.Common.Scripting [Desc("Move to and enter the transport.")] public void EnterTransport(Actor transport) { - Self.QueueActivity(new EnterTransport(Self, Target.FromActor(transport))); + Self.QueueActivity(new RideTransport(Self, Target.FromActor(transport))); } [Desc("Whether the actor can move (false if immobilized).")] diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 8f846b4b8e..d12aa7f907 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -219,6 +219,7 @@ namespace OpenRA.Mods.Common.Traits public bool ForceLanding { get; private set; } IEnumerable landingCells = Enumerable.Empty(); bool requireForceMove; + int moveIntoWorldDelay; public static WPos GroundPosition(Actor self) { @@ -229,7 +230,6 @@ namespace OpenRA.Mods.Common.Traits bool airborne; bool cruising; - bool firstTick = true; int airborneToken = ConditionManager.InvalidConditionToken; int cruisingToken = ConditionManager.InvalidConditionToken; @@ -250,6 +250,7 @@ namespace OpenRA.Mods.Common.Traits SetPosition(self, init.Get()); Facing = init.Contains() ? init.Get() : Info.InitialFacing; + moveIntoWorldDelay = init.Contains() ? init.Get() : 0; } public WDist LandAltitude @@ -307,6 +308,8 @@ namespace OpenRA.Mods.Common.Traits notifyMoving = self.TraitsImplementing().ToArray(); positionOffsets = self.TraitsImplementing().ToArray(); overrideAircraftLanding = self.TraitOrDefault(); + + self.QueueActivity(MoveIntoWorld(self, moveIntoWorldDelay)); } void INotifyAddedToWorld.AddedToWorld(Actor self) @@ -346,20 +349,6 @@ namespace OpenRA.Mods.Common.Traits protected virtual void Tick(Actor self) { - if (firstTick) - { - firstTick = false; - - var host = GetActorBelow(); - if (host == null) - return; - - MakeReservation(host); - - if (Info.TakeOffOnCreation) - UnReserve(true); - } - // Add land activity if LandOnCondition resolves to true and the actor can land at the current location. if (!ForceLanding && landNow.HasValue && landNow.Value && airborne && CanLand(self.Location) && !((self.CurrentActivity is Land) || self.CurrentActivity is Turn)) @@ -868,9 +857,46 @@ namespace OpenRA.Mods.Common.Traits initialTargetPosition, targetLineColor); } - public Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any) + public Activity MoveIntoWorld(Actor self, int delay = 0) { - return new Fly(self, Target.FromCell(self.World, cell, subCell)); + return new MoveIntoWorldActivity(self, delay); + } + + class MoveIntoWorldActivity : Activity + { + readonly Actor self; + readonly Aircraft aircraft; + readonly int delay; + + public MoveIntoWorldActivity(Actor self, int delay = 0) + { + this.self = self; + aircraft = self.Trait(); + IsInterruptible = false; + this.delay = delay; + } + + protected override void OnFirstRun(Actor self) + { + var host = aircraft.GetActorBelow(); + if (host != null) + aircraft.MakeReservation(host); + + if (delay > 0) + QueueChild(new Wait(delay)); + } + + public override bool Tick(Actor self) + { + if (!aircraft.Info.TakeOffOnCreation) + return true; + + if (self.World.Map.DistanceAboveTerrain(aircraft.CenterPosition).Length <= aircraft.LandAltitude.Length) + QueueChild(new TakeOff(self)); + + aircraft.UnReserve(); + return true; + } } public Activity MoveToTarget(Actor self, Target target, diff --git a/OpenRA.Mods.Common/Traits/Buildings/Exit.cs b/OpenRA.Mods.Common/Traits/Buildings/Exit.cs index c369c70519..fd32e4f00f 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Exit.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Exit.cs @@ -29,9 +29,6 @@ namespace OpenRA.Mods.Common.Traits [Desc("Type tags on this exit.")] public readonly HashSet ProductionTypes = new HashSet(); - [Desc("AttackMove to a RallyPoint or stay where you are spawned.")] - public readonly bool MoveIntoWorld = true; - [Desc("Number of ticks to wait before moving into the world.")] public readonly int ExitDelay = 0; diff --git a/OpenRA.Mods.Common/Traits/Crates/Crate.cs b/OpenRA.Mods.Common/Traits/Crates/Crate.cs index 8dc8c9e7cb..97691e2474 100644 --- a/OpenRA.Mods.Common/Traits/Crates/Crate.cs +++ b/OpenRA.Mods.Common/Traits/Crates/Crate.cs @@ -11,6 +11,7 @@ using System.Collections.Generic; using System.Linq; +using OpenRA.Mods.Common.Activities; using OpenRA.Mods.Common.Traits.Render; using OpenRA.Primitives; using OpenRA.Traits; @@ -106,7 +107,7 @@ namespace OpenRA.Mods.Common.Traits } void INotifyParachute.OnParachute(Actor self) { } - void INotifyParachute.OnLanded(Actor self, Actor ignore) + void INotifyParachute.OnLanded(Actor self) { // Check whether the crate landed on anything var landedOn = self.World.ActorMap.GetActorsAt(self.Location) @@ -237,6 +238,9 @@ namespace OpenRA.Mods.Common.Traits var cs = self.World.WorldActor.TraitOrDefault(); if (cs != null) cs.IncrementCrates(); + + if (self.World.Map.DistanceAboveTerrain(CenterPosition) > WDist.Zero && self.TraitOrDefault() != null) + self.QueueActivity(new Parachute(self)); } void INotifyRemovedFromWorld.RemovedFromWorld(Actor self) diff --git a/OpenRA.Mods.Common/Traits/EjectOnDeath.cs b/OpenRA.Mods.Common/Traits/EjectOnDeath.cs index 24c162f63d..5752cf3ec0 100644 --- a/OpenRA.Mods.Common/Traits/EjectOnDeath.cs +++ b/OpenRA.Mods.Common/Traits/EjectOnDeath.cs @@ -82,11 +82,10 @@ namespace OpenRA.Mods.Common.Traits self.World.AddFrameEndTask(w => { pilotPositionable.SetPosition(pilot, pilotCell, pilotSubCell); - w.Add(pilot); - var dropPosition = pilot.CenterPosition + new WVec(0, 0, self.CenterPosition.Z - pilot.CenterPosition.Z); pilotPositionable.SetVisualPosition(pilot, dropPosition); - pilot.QueueActivity(new Parachute(pilot)); + + w.Add(pilot); }); Game.Sound.Play(SoundType.World, Info.ChuteSound, cp); diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 10b2db855f..c9ac785c2a 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -144,6 +144,7 @@ namespace OpenRA.Mods.Common.Traits { readonly Actor self; readonly Lazy> speedModifiers; + readonly int moveIntoWorldDelay; #region IMove CurrentMovementTypes MovementType movementTypes; @@ -239,6 +240,8 @@ namespace OpenRA.Mods.Common.Traits // Use LocationInit if you want to insert the actor into the ActorMap! if (init.Contains()) SetVisualPosition(self, init.Get()); + + moveIntoWorldDelay = init.Contains() ? init.Get() : 0; } protected override void Created(Actor self) @@ -251,6 +254,7 @@ namespace OpenRA.Mods.Common.Traits Locomotor = self.World.WorldActor.TraitsImplementing() .Single(l => l.Info.Name == Info.Locomotor); + self.QueueActivity(MoveIntoWorld(self, moveIntoWorldDelay)); base.Created(self); } @@ -563,22 +567,59 @@ namespace OpenRA.Mods.Common.Traits return WrapMove(new Follow(self, target, minRange, maxRange, initialTargetPosition, targetLineColor)); } - public Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any) + public Activity MoveIntoWorld(Actor self, int delay = 0) { - var pos = self.CenterPosition; + return new MoveIntoWorldActivity(self, delay); + } - if (subCell == SubCell.Any) - subCell = Info.LocomotorInfo.SharesCell ? self.World.ActorMap.FreeSubCell(cell, subCell) : SubCell.FullCell; + class MoveIntoWorldActivity : Activity + { + readonly Actor self; + readonly Mobile mobile; - // TODO: solve/reduce cell is full problem - if (subCell == SubCell.Invalid) - subCell = self.World.Map.Grid.DefaultSubCell; + CPos cell; + SubCell subCell; + WPos pos; + int delay; - // Reserve the exit cell - SetPosition(self, cell, subCell); - SetVisualPosition(self, pos); + public MoveIntoWorldActivity(Actor self, int delay = 0) + { + this.self = self; + mobile = self.Trait(); + IsInterruptible = false; + this.delay = delay; + } - return WrapMove(VisualMove(self, pos, self.World.Map.CenterOfSubCell(cell, subCell), cell)); + protected override void OnFirstRun(Actor self) + { + pos = self.CenterPosition; + if (self.World.Map.DistanceAboveTerrain(pos) > WDist.Zero && self.TraitOrDefault() != null) + QueueChild(new Parachute(self)); + } + + public override bool Tick(Actor self) + { + pos = self.CenterPosition; + cell = mobile.ToCell; + subCell = mobile.ToSubCell; + + if (subCell == SubCell.Any) + subCell = mobile.Info.LocomotorInfo.SharesCell ? self.World.ActorMap.FreeSubCell(cell, subCell) : SubCell.FullCell; + + // TODO: solve/reduce cell is full problem + if (subCell == SubCell.Invalid) + subCell = self.World.Map.Grid.DefaultSubCell; + + // Reserve the exit cell + mobile.SetPosition(self, cell, subCell); + mobile.SetVisualPosition(self, pos); + + if (delay > 0) + QueueChild(new Wait(delay)); + + QueueChild(mobile.VisualMove(self, pos, self.World.Map.CenterOfSubCell(cell, subCell))); + return true; + } } public Activity MoveToTarget(Actor self, Target target, diff --git a/OpenRA.Mods.Common/Traits/ParaDrop.cs b/OpenRA.Mods.Common/Traits/ParaDrop.cs index f13586c85f..184f1aaeca 100644 --- a/OpenRA.Mods.Common/Traits/ParaDrop.cs +++ b/OpenRA.Mods.Common/Traits/ParaDrop.cs @@ -105,12 +105,10 @@ namespace OpenRA.Mods.Common.Traits self.World.AddFrameEndTask(w => { dropPositionable.SetPosition(dropActor, dropCell, dropSubCell); - w.Add(dropActor); var dropPosition = dropActor.CenterPosition + new WVec(0, 0, self.CenterPosition.Z - dropActor.CenterPosition.Z); dropPositionable.SetVisualPosition(dropActor, dropPosition); - - dropActor.QueueActivity(new Parachute(dropActor)); + w.Add(dropActor); }); Game.Sound.Play(SoundType.World, info.ChuteSound, self.CenterPosition); diff --git a/OpenRA.Mods.Common/Traits/Parachutable.cs b/OpenRA.Mods.Common/Traits/Parachutable.cs index 31262184e0..1c60a24d6c 100644 --- a/OpenRA.Mods.Common/Traits/Parachutable.cs +++ b/OpenRA.Mods.Common/Traits/Parachutable.cs @@ -62,6 +62,8 @@ namespace OpenRA.Mods.Common.Traits readonly ParachutableInfo info; readonly IPositionable positionable; + public Actor IgnoreActor; + ConditionManager conditionManager; int parachutingToken = ConditionManager.InvalidConditionToken; @@ -86,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits parachutingToken = conditionManager.GrantCondition(self, info.ParachutingCondition); } - void INotifyParachute.OnLanded(Actor self, Actor ignore) + void INotifyParachute.OnLanded(Actor self) { IsInAir = false; @@ -100,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits if (positionable.CanEnterCell(cell, self)) return; - if (ignore != null && self.World.ActorMap.GetActorsAt(cell).Any(a => a != ignore)) + if (IgnoreActor != null && self.World.ActorMap.GetActorsAt(cell).Any(a => a != IgnoreActor)) return; var onWater = info.WaterTerrainTypes.Contains(self.World.Map.GetTerrainInfo(cell).Type); diff --git a/OpenRA.Mods.Common/Traits/Passenger.cs b/OpenRA.Mods.Common/Traits/Passenger.cs index 126f8b7b78..3c6484015d 100644 --- a/OpenRA.Mods.Common/Traits/Passenger.cs +++ b/OpenRA.Mods.Common/Traits/Passenger.cs @@ -162,7 +162,7 @@ namespace OpenRA.Mods.Common.Traits if (!order.Queued) self.CancelActivity(); - self.QueueActivity(new EnterTransport(self, order.Target)); + self.QueueActivity(new RideTransport(self, order.Target)); self.ShowTargetLines(); } diff --git a/OpenRA.Mods.Common/Traits/Production.cs b/OpenRA.Mods.Common/Traits/Production.cs index 42be476bcc..8a67915bc5 100644 --- a/OpenRA.Mods.Common/Traits/Production.cs +++ b/OpenRA.Mods.Common/Traits/Production.cs @@ -73,6 +73,8 @@ namespace OpenRA.Mods.Common.Traits td.Add(new LocationInit(exit)); td.Add(new CenterPositionInit(spawn)); td.Add(new FacingInit(initialFacing)); + if (exitinfo != null) + td.Add(new MoveIntoWorldDelayInit(exitinfo.ExitDelay)); } self.World.AddFrameEndTask(w => @@ -81,16 +83,7 @@ namespace OpenRA.Mods.Common.Traits var move = newUnit.TraitOrDefault(); if (exitinfo != null && move != null) - { - if (exitinfo.MoveIntoWorld) - { - if (exitinfo.ExitDelay > 0) - newUnit.QueueActivity(new Wait(exitinfo.ExitDelay, false)); - - newUnit.QueueActivity(move.MoveIntoWorld(newUnit, exit)); - newUnit.QueueActivity(new AttackMoveActivity(newUnit, () => move.MoveTo(exitLocation, 1, targetLineColor: Color.OrangeRed))); - } - } + newUnit.QueueActivity(new AttackMoveActivity(newUnit, () => move.MoveTo(exitLocation, 1, targetLineColor: Color.OrangeRed))); if (!self.IsDead) foreach (var t in self.TraitsImplementing()) diff --git a/OpenRA.Mods.Common/Traits/ProductionParadrop.cs b/OpenRA.Mods.Common/Traits/ProductionParadrop.cs index cf5389a31f..d249c6d4c6 100644 --- a/OpenRA.Mods.Common/Traits/ProductionParadrop.cs +++ b/OpenRA.Mods.Common/Traits/ProductionParadrop.cs @@ -127,25 +127,17 @@ namespace OpenRA.Mods.Common.Traits td.Add(new LocationInit(exit)); td.Add(new CenterPositionInit(spawn)); td.Add(new FacingInit(initialFacing)); + td.Add(new MoveIntoWorldDelayInit(exitinfo.ExitDelay)); } self.World.AddFrameEndTask(w => { var newUnit = self.World.CreateActor(producee.Name, td); + newUnit.Trait().IgnoreActor = self; - newUnit.QueueActivity(new Parachute(newUnit, self)); var move = newUnit.TraitOrDefault(); if (move != null) - { - if (exitinfo.MoveIntoWorld) - { - if (exitinfo.ExitDelay > 0) - newUnit.QueueActivity(new Wait(exitinfo.ExitDelay, false)); - - newUnit.QueueActivity(move.MoveIntoWorld(newUnit, exit)); - newUnit.QueueActivity(new AttackMoveActivity(newUnit, () => move.MoveTo(exitLocation, 1, targetLineColor: Color.OrangeRed))); - } - } + newUnit.QueueActivity(new AttackMoveActivity(newUnit, () => move.MoveTo(exitLocation, 1, targetLineColor: Color.OrangeRed))); if (!self.IsDead) foreach (var t in self.TraitsImplementing()) diff --git a/OpenRA.Mods.Common/Traits/Render/WithCrateBody.cs b/OpenRA.Mods.Common/Traits/Render/WithCrateBody.cs index 89b3ee65ec..4fbe7b8025 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithCrateBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithCrateBody.cs @@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits.Render void INotifyParachute.OnParachute(Actor self) { } - void INotifyParachute.OnLanded(Actor self, Actor ignore) + void INotifyParachute.OnLanded(Actor self) { PlaySequence(); } diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index f771b93ee1..d3daccd3d4 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -145,7 +145,7 @@ namespace OpenRA.Mods.Common.Traits [RequireExplicitImplementation] public interface INotifyResourceAccepted { void OnResourceAccepted(Actor self, Actor refinery, int amount); } - public interface INotifyParachute { void OnParachute(Actor self); void OnLanded(Actor self, Actor ignore); } + public interface INotifyParachute { void OnParachute(Actor self); void OnLanded(Actor self); } [RequireExplicitImplementation] public interface INotifyCapture { void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner, BitSet captureTypes); } @@ -435,7 +435,7 @@ namespace OpenRA.Mods.Common.Traits WPos? initialTargetPosition = null, Color? targetLineColor = null); Activity MoveToTarget(Actor self, Target target, WPos? initialTargetPosition = null, Color? targetLineColor = null); - Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any); + Activity MoveIntoWorld(Actor self, int delay = 0); Activity MoveIntoTarget(Actor self, Target target); Activity VisualMove(Actor self, WPos fromPos, WPos toPos); int EstimatedMoveDuration(Actor self, WPos fromPos, WPos toPos); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20190314/RemoveMoveIntoWorldFromExit.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20190314/RemoveMoveIntoWorldFromExit.cs new file mode 100644 index 0000000000..ea0760cc10 --- /dev/null +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20190314/RemoveMoveIntoWorldFromExit.cs @@ -0,0 +1,38 @@ +#region Copyright & License Information +/* + * Copyright 2007-2019 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. For more + * information, see COPYING. + */ +#endregion + +using System.Collections.Generic; +using System.Linq; + +namespace OpenRA.Mods.Common.UpdateRules.Rules +{ + public class RemoveMoveIntoWorldFromExit : UpdateRule + { + public override string Name { get { return "Remove MoveIntoWorld from Exit."; } } + public override string Description + { + get + { + return "The MoveIntoWorld parameter has been removed from the Exit trait because it no\n" + + "longer serves a purpose (aircraft can now use the same exit procedure as other\n" + + "units)."; + } + } + + public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) + { + foreach (var t in actorNode.ChildrenMatching("Exit")) + t.RemoveNodes("MoveIntoWorld"); + + yield break; + } + } +} diff --git a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs index 0199922049..f223452122 100644 --- a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs +++ b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs @@ -133,6 +133,7 @@ namespace OpenRA.Mods.Common.UpdateRules new AddCanSlide(), new AddAircraftIdleBehavior(), new RenameSearchRadius(), + new RemoveMoveIntoWorldFromExit(), }) }; diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 40d3f0b644..dbddf14a35 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -1344,7 +1344,6 @@ HPAD: RequiresCondition: !being-captured SpawnOffset: 0,-256,0 ExitCell: 0,0 - MoveIntoWorld: false Facing: 224 RallyPoint: Production: @@ -1435,7 +1434,6 @@ AFLD: RequiresCondition: !being-captured ExitCell: 1,1 Facing: 192 - MoveIntoWorld: false RallyPoint: Production: Produces: Aircraft, Plane