Fix units from transports appearing at load point.
This commit is contained in:
@@ -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<TargetLineNode> TargetLineNodes(Actor self)
|
||||
|
||||
@@ -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<IPositionable>();
|
||||
ignore = ignoreActor;
|
||||
|
||||
fallVector = new WVec(0, 0, self.Info.TraitInfo<ParachutableInfo>().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<INotifyParachute>())
|
||||
np.OnLanded(self, ignore);
|
||||
np.OnLanded(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Passenger>();
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -121,9 +121,10 @@ namespace OpenRA.Mods.Common.Activities
|
||||
var move = actor.Trait<IMove>();
|
||||
var pos = actor.Trait<IPositionable>();
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user