Airborne transports only land to (un)load.
This commit is contained in:
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
destination = Target.FromCell(self.World, self.Location);
|
destination = Target.FromCell(self.World, self.Location);
|
||||||
|
|
||||||
QueueChild(self, new Land(self, destination, deliverRange), true);
|
QueueChild(self, new Land(self, destination, deliverRange), true);
|
||||||
QueueChild(self, new Wait(carryall.Info.UnloadingDelay, false), true);
|
QueueChild(self, new Wait(carryall.Info.BeforeUnloadDelay, false), true);
|
||||||
QueueChild(self, new ReleaseUnit(self));
|
QueueChild(self, new ReleaseUnit(self));
|
||||||
QueueChild(self, new TakeOff(self));
|
QueueChild(self, new TakeOff(self));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
Actor enterActor;
|
Actor enterActor;
|
||||||
Cargo enterCargo;
|
Cargo enterCargo;
|
||||||
|
Aircraft enterAircraft;
|
||||||
|
|
||||||
public EnterTransport(Actor self, Target target)
|
public EnterTransport(Actor self, Target target)
|
||||||
: base(self, target, Color.Green)
|
: base(self, target, Color.Green)
|
||||||
@@ -35,6 +36,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
enterActor = targetActor;
|
enterActor = targetActor;
|
||||||
enterCargo = targetActor.TraitOrDefault<Cargo>();
|
enterCargo = targetActor.TraitOrDefault<Cargo>();
|
||||||
|
enterAircraft = targetActor.TraitOrDefault<Aircraft>();
|
||||||
|
|
||||||
// Make sure we can still enter the transport
|
// Make sure we can still enter the transport
|
||||||
// (but not before, because this may stop the actor in the middle of nowhere)
|
// (but not before, because this may stop the actor in the middle of nowhere)
|
||||||
@@ -44,6 +46,9 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (enterAircraft != null && !enterAircraft.AtLandAltitude)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,13 +24,27 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
readonly Cargo cargo;
|
readonly Cargo cargo;
|
||||||
readonly INotifyUnload[] notifiers;
|
readonly INotifyUnload[] notifiers;
|
||||||
readonly bool unloadAll;
|
readonly bool unloadAll;
|
||||||
|
readonly Aircraft aircraft;
|
||||||
|
readonly bool assignTargetOnFirstRun;
|
||||||
|
readonly WDist unloadRange;
|
||||||
|
|
||||||
public UnloadCargo(Actor self, bool unloadAll)
|
Target destination;
|
||||||
|
|
||||||
|
public UnloadCargo(Actor self, WDist unloadRange, bool unloadAll = true)
|
||||||
|
: this(self, Target.Invalid, unloadRange, unloadAll)
|
||||||
|
{
|
||||||
|
assignTargetOnFirstRun = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnloadCargo(Actor self, Target destination, WDist unloadRange, bool unloadAll = true)
|
||||||
{
|
{
|
||||||
this.self = self;
|
this.self = self;
|
||||||
cargo = self.Trait<Cargo>();
|
cargo = self.Trait<Cargo>();
|
||||||
notifiers = self.TraitsImplementing<INotifyUnload>().ToArray();
|
notifiers = self.TraitsImplementing<INotifyUnload>().ToArray();
|
||||||
this.unloadAll = unloadAll;
|
this.unloadAll = unloadAll;
|
||||||
|
aircraft = self.TraitOrDefault<Aircraft>();
|
||||||
|
this.destination = destination;
|
||||||
|
this.unloadRange = unloadRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<CPos, SubCell>? ChooseExitSubCell(Actor passenger)
|
public Pair<CPos, SubCell>? ChooseExitSubCell(Actor passenger)
|
||||||
@@ -53,6 +67,23 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
.Where(c => pos.CanEnterCell(c, null, true) != pos.CanEnterCell(c, null, false));
|
.Where(c => pos.CanEnterCell(c, null, true) != pos.CanEnterCell(c, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnFirstRun(Actor self)
|
||||||
|
{
|
||||||
|
if (assignTargetOnFirstRun)
|
||||||
|
destination = Target.FromCell(self.World, self.Location);
|
||||||
|
|
||||||
|
// Move to the target destination
|
||||||
|
if (aircraft != null)
|
||||||
|
QueueChild(self, new Land(self, destination, unloadRange));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var cell = self.World.Map.Clamp(this.self.World.Map.CellContaining(destination.CenterPosition));
|
||||||
|
QueueChild(self, new Move(self, cell, unloadRange));
|
||||||
|
}
|
||||||
|
|
||||||
|
QueueChild(self, new Wait(cargo.Info.BeforeUnloadDelay));
|
||||||
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (ChildActivity != null)
|
if (ChildActivity != null)
|
||||||
@@ -62,50 +93,52 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
cargo.Unloading = false;
|
|
||||||
if (IsCanceling || cargo.IsEmpty(self))
|
if (IsCanceling || cargo.IsEmpty(self))
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
if (!cargo.CanUnload())
|
if (cargo.CanUnload())
|
||||||
|
{
|
||||||
|
foreach (var inu in notifiers)
|
||||||
|
inu.Unloading(self);
|
||||||
|
|
||||||
|
var actor = cargo.Peek(self);
|
||||||
|
var spawn = self.CenterPosition;
|
||||||
|
|
||||||
|
var exitSubCell = ChooseExitSubCell(actor);
|
||||||
|
if (exitSubCell == null)
|
||||||
|
{
|
||||||
|
self.NotifyBlocker(BlockedExitCells(actor));
|
||||||
|
QueueChild(self, new Wait(10), true);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
cargo.Unload(self);
|
||||||
|
self.World.AddFrameEndTask(w =>
|
||||||
|
{
|
||||||
|
if (actor.Disposed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var move = actor.Trait<IMove>();
|
||||||
|
var pos = actor.Trait<IPositionable>();
|
||||||
|
|
||||||
|
actor.CancelActivity();
|
||||||
|
pos.SetVisualPosition(actor, spawn);
|
||||||
|
actor.QueueActivity(move.MoveIntoWorld(actor, exitSubCell.Value.First, exitSubCell.Value.Second));
|
||||||
|
actor.SetTargetLine(Target.FromCell(w, exitSubCell.Value.First, exitSubCell.Value.Second), Color.Green, false);
|
||||||
|
w.Add(actor);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!unloadAll || !cargo.CanUnload())
|
||||||
{
|
{
|
||||||
Cancel(self, true);
|
Cancel(self, true);
|
||||||
return NextActivity;
|
if (cargo.Info.AfterUnloadDelay > 0)
|
||||||
|
QueueChild(self, new Wait(cargo.Info.AfterUnloadDelay, false), true);
|
||||||
|
|
||||||
|
if (aircraft != null && !aircraft.Info.LandWhenIdle)
|
||||||
|
QueueChild(self, new TakeOff(self), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var inu in notifiers)
|
|
||||||
inu.Unloading(self);
|
|
||||||
|
|
||||||
var actor = cargo.Peek(self);
|
|
||||||
var spawn = self.CenterPosition;
|
|
||||||
|
|
||||||
var exitSubCell = ChooseExitSubCell(actor);
|
|
||||||
if (exitSubCell == null)
|
|
||||||
{
|
|
||||||
self.NotifyBlocker(BlockedExitCells(actor));
|
|
||||||
QueueChild(self, new Wait(10), true);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
cargo.Unload(self);
|
|
||||||
self.World.AddFrameEndTask(w =>
|
|
||||||
{
|
|
||||||
if (actor.Disposed)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var move = actor.Trait<IMove>();
|
|
||||||
var pos = actor.Trait<IPositionable>();
|
|
||||||
|
|
||||||
actor.CancelActivity();
|
|
||||||
pos.SetVisualPosition(actor, spawn);
|
|
||||||
actor.QueueActivity(move.MoveIntoWorld(actor, exitSubCell.Value.First, exitSubCell.Value.Second));
|
|
||||||
actor.SetTargetLine(Target.FromCell(w, exitSubCell.Value.First, exitSubCell.Value.Second), Color.Green, false);
|
|
||||||
w.Add(actor);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!unloadAll || cargo.IsEmpty(self))
|
|
||||||
return NextActivity;
|
|
||||||
|
|
||||||
cargo.Unloading = true;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,44 +150,14 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var aircraft = transport.TraitOrDefault<Aircraft>();
|
var aircraft = transport.TraitOrDefault<Aircraft>();
|
||||||
|
|
||||||
|
// Scripted cargo aircraft must turn to default position before unloading.
|
||||||
|
// TODO: pass facing through UnloadCargo instead.
|
||||||
if (aircraft != null)
|
if (aircraft != null)
|
||||||
{
|
transport.QueueActivity(new Land(transport, Target.FromCell(transport.World, entryPath.Last()), WDist.FromCells(dropRange), aircraft.Info.InitialFacing));
|
||||||
var destination = entryPath.Last();
|
|
||||||
|
|
||||||
// Try to find an alternative landing spot if we can't land at the current destination
|
|
||||||
if (!aircraft.CanLand(destination) && dropRange > 0)
|
|
||||||
{
|
|
||||||
var locomotors = cargo.Passengers
|
|
||||||
.Select(a => a.Info.TraitInfoOrDefault<MobileInfo>())
|
|
||||||
.Where(m => m != null)
|
|
||||||
.Distinct()
|
|
||||||
.Select(m => m.LocomotorInfo)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
foreach (var c in transport.World.Map.FindTilesInCircle(destination, dropRange))
|
|
||||||
{
|
|
||||||
if (!aircraft.CanLand(c))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!locomotors.All(m => domainIndex.IsPassable(destination, c, m)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
destination = c;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transport.QueueActivity(new Land(transport, Target.FromCell(transport.World, destination), facing: aircraft.Info.InitialFacing));
|
|
||||||
transport.QueueActivity(new Wait(15));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cargo != null)
|
if (cargo != null)
|
||||||
{
|
transport.QueueActivity(new UnloadCargo(transport, WDist.FromCells(dropRange)));
|
||||||
transport.QueueActivity(new UnloadCargo(transport, true));
|
|
||||||
transport.QueueActivity(new WaitFor(() => cargo.IsEmpty(transport)));
|
|
||||||
}
|
|
||||||
|
|
||||||
transport.QueueActivity(new Wait(aircraft != null ? 50 : 25));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exitFunc != null)
|
if (exitFunc != null)
|
||||||
|
|||||||
@@ -42,9 +42,15 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
|
|
||||||
[ScriptActorPropertyActivity]
|
[ScriptActorPropertyActivity]
|
||||||
[Desc("Command transport to unload passengers.")]
|
[Desc("Command transport to unload passengers.")]
|
||||||
public void UnloadPassengers()
|
public void UnloadPassengers(CPos? cell = null, int unloadRange = 5)
|
||||||
{
|
{
|
||||||
Self.QueueActivity(new UnloadCargo(Self, true));
|
if (cell.HasValue)
|
||||||
|
{
|
||||||
|
var destination = Target.FromCell(Self.World, cell.Value);
|
||||||
|
Self.QueueActivity(new UnloadCargo(Self, destination, WDist.FromCells(unloadRange)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Self.QueueActivity(new UnloadCargo(Self, WDist.FromCells(unloadRange)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -664,7 +664,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
protected virtual void OnBecomingIdle(Actor self)
|
protected virtual void OnBecomingIdle(Actor self)
|
||||||
{
|
{
|
||||||
var atLandAltitude = self.World.Map.DistanceAboveTerrain(CenterPosition) == LandAltitude;
|
var altitude = self.World.Map.DistanceAboveTerrain(CenterPosition);
|
||||||
|
var atLandAltitude = altitude == LandAltitude;
|
||||||
|
|
||||||
// Work-around to prevent players from accidentally canceling resupply by pressing 'Stop',
|
// Work-around to prevent players from accidentally canceling resupply by pressing 'Stop',
|
||||||
// by re-queueing Resupply as long as resupply hasn't finished and aircraft is still on resupplier.
|
// by re-queueing Resupply as long as resupply hasn't finished and aircraft is still on resupplier.
|
||||||
@@ -692,6 +693,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
// Will go away soon (in a separate PR) with the arrival of ActionsWhenIdle.
|
// Will go away soon (in a separate PR) with the arrival of ActionsWhenIdle.
|
||||||
self.QueueActivity(new FlyCircle(self, -1, Info.IdleTurnSpeed > -1 ? Info.IdleTurnSpeed : TurnSpeed));
|
self.QueueActivity(new FlyCircle(self, -1, Info.IdleTurnSpeed > -1 ? Info.IdleTurnSpeed : TurnSpeed));
|
||||||
}
|
}
|
||||||
|
else if (!atLandAltitude && altitude != Info.CruiseAltitude && !Info.LandWhenIdle)
|
||||||
|
self.QueueActivity(new TakeOff(self));
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Implement IPositionable
|
#region Implement IPositionable
|
||||||
|
|||||||
@@ -47,9 +47,21 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Voice to play when ordered to unload the passengers.")]
|
[Desc("Voice to play when ordered to unload the passengers.")]
|
||||||
public readonly string UnloadVoice = "Action";
|
public readonly string UnloadVoice = "Action";
|
||||||
|
|
||||||
|
[Desc("Radius to search for a load/unload location if the ordered cell is blocked.")]
|
||||||
|
public readonly WDist LoadRange = WDist.FromCells(5);
|
||||||
|
|
||||||
[Desc("Which direction the passenger will face (relative to the transport) when unloading.")]
|
[Desc("Which direction the passenger will face (relative to the transport) when unloading.")]
|
||||||
public readonly int PassengerFacing = 128;
|
public readonly int PassengerFacing = 128;
|
||||||
|
|
||||||
|
[Desc("Delay (in ticks) before continuing after loading a passenger.")]
|
||||||
|
public readonly int AfterLoadDelay = 8;
|
||||||
|
|
||||||
|
[Desc("Delay (in ticks) before unloading the first passenger.")]
|
||||||
|
public readonly int BeforeUnloadDelay = 8;
|
||||||
|
|
||||||
|
[Desc("Delay (in ticks) before continuing after unloading a passenger.")]
|
||||||
|
public readonly int AfterUnloadDelay = 25;
|
||||||
|
|
||||||
[Desc("Cursor to display when able to unload the passengers.")]
|
[Desc("Cursor to display when able to unload the passengers.")]
|
||||||
public readonly string UnloadCursor = "deploy";
|
public readonly string UnloadCursor = "deploy";
|
||||||
|
|
||||||
@@ -96,15 +108,16 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
CPos currentCell;
|
CPos currentCell;
|
||||||
public IEnumerable<CPos> CurrentAdjacentCells { get; private set; }
|
public IEnumerable<CPos> CurrentAdjacentCells { get; private set; }
|
||||||
public bool Unloading { get; internal set; }
|
|
||||||
public IEnumerable<Actor> Passengers { get { return cargo; } }
|
public IEnumerable<Actor> Passengers { get { return cargo; } }
|
||||||
public int PassengerCount { get { return cargo.Count; } }
|
public int PassengerCount { get { return cargo.Count; } }
|
||||||
|
|
||||||
|
enum State { Free, Locked }
|
||||||
|
State state = State.Free;
|
||||||
|
|
||||||
public Cargo(ActorInitializer init, CargoInfo info)
|
public Cargo(ActorInitializer init, CargoInfo info)
|
||||||
{
|
{
|
||||||
self = init.Self;
|
self = init.Self;
|
||||||
Info = info;
|
Info = info;
|
||||||
Unloading = false;
|
|
||||||
checkTerrainType = info.UnloadTerrainTypes.Count > 0;
|
checkTerrainType = info.UnloadTerrainTypes.Count > 0;
|
||||||
|
|
||||||
if (init.Contains<RuntimeCargoInit>())
|
if (init.Contains<RuntimeCargoInit>())
|
||||||
@@ -195,11 +208,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (!order.Queued)
|
if (!order.Queued)
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
|
|
||||||
Unloading = true;
|
self.QueueActivity(new UnloadCargo(self, Info.LoadRange));
|
||||||
if (aircraft != null)
|
|
||||||
self.QueueActivity(new Land(self));
|
|
||||||
|
|
||||||
self.QueueActivity(new UnloadCargo(self, true));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,13 +227,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !IsEmpty(self) && (aircraft == null || aircraft.CanLand(self.Location))
|
return !IsEmpty(self) && (aircraft == null || aircraft.CanLand(self.Location, blockedByMobile: false))
|
||||||
&& CurrentAdjacentCells != null && CurrentAdjacentCells.Any(c => Passengers.Any(p => p.Trait<IPositionable>().CanEnterCell(c, null, immediate)));
|
&& CurrentAdjacentCells != null && CurrentAdjacentCells.Any(c => Passengers.Any(p => p.Trait<IPositionable>().CanEnterCell(c, null, immediate)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanLoad(Actor self, Actor a)
|
public bool CanLoad(Actor self, Actor a)
|
||||||
{
|
{
|
||||||
return (reserves.Contains(a) || HasSpace(GetWeight(a))) && self.IsAtGroundLevel();
|
return reserves.Contains(a) || HasSpace(GetWeight(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool ReserveSpace(Actor a)
|
internal bool ReserveSpace(Actor a)
|
||||||
@@ -241,6 +250,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
reserves.Add(a);
|
reserves.Add(a);
|
||||||
reservedWeight += w;
|
reservedWeight += w;
|
||||||
|
LockForPickup(self);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -252,11 +262,43 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
reservedWeight -= GetWeight(a);
|
reservedWeight -= GetWeight(a);
|
||||||
reserves.Remove(a);
|
reserves.Remove(a);
|
||||||
|
ReleaseLock(self);
|
||||||
|
|
||||||
if (loadingToken != ConditionManager.InvalidConditionToken)
|
if (loadingToken != ConditionManager.InvalidConditionToken)
|
||||||
loadingToken = conditionManager.RevokeCondition(self, loadingToken);
|
loadingToken = conditionManager.RevokeCondition(self, loadingToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prepare for transport pickup
|
||||||
|
bool LockForPickup(Actor self)
|
||||||
|
{
|
||||||
|
if (state == State.Locked)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
state = State.Locked;
|
||||||
|
|
||||||
|
self.CancelActivity();
|
||||||
|
|
||||||
|
var air = self.TraitOrDefault<Aircraft>();
|
||||||
|
if (air != null && !air.AtLandAltitude)
|
||||||
|
self.QueueActivity(new Land(self));
|
||||||
|
|
||||||
|
self.QueueActivity(new WaitFor(() => state != State.Locked, false));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReleaseLock(Actor self)
|
||||||
|
{
|
||||||
|
if (reservedWeight != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
state = State.Free;
|
||||||
|
|
||||||
|
self.QueueActivity(new Wait(Info.AfterLoadDelay, false));
|
||||||
|
var air = self.TraitOrDefault<Aircraft>();
|
||||||
|
if (air != null)
|
||||||
|
self.QueueActivity(new TakeOff(self));
|
||||||
|
}
|
||||||
|
|
||||||
public string CursorForOrder(Actor self, Order order)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString != "Unload")
|
if (order.OrderString != "Unload")
|
||||||
@@ -353,6 +395,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
reservedWeight -= w;
|
reservedWeight -= w;
|
||||||
reserves.Remove(a);
|
reserves.Remove(a);
|
||||||
|
ReleaseLock(self);
|
||||||
|
|
||||||
if (loadingToken != ConditionManager.InvalidConditionToken)
|
if (loadingToken != ConditionManager.InvalidConditionToken)
|
||||||
loadingToken = conditionManager.RevokeCondition(self, loadingToken);
|
loadingToken = conditionManager.RevokeCondition(self, loadingToken);
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Transports actors with the `Carryable` trait.")]
|
[Desc("Transports actors with the `Carryable` trait.")]
|
||||||
public class CarryallInfo : ITraitInfo, Requires<BodyOrientationInfo>, Requires<AircraftInfo>
|
public class CarryallInfo : ITraitInfo, Requires<BodyOrientationInfo>, Requires<AircraftInfo>
|
||||||
{
|
{
|
||||||
[Desc("Delay on the ground while attaching an actor to the carryall.")]
|
[Desc("Delay (in ticks) on the ground while attaching an actor to the carryall.")]
|
||||||
public readonly int LoadingDelay = 0;
|
public readonly int BeforeLoadDelay = 0;
|
||||||
|
|
||||||
[Desc("Delay on the ground while detacting an actor to the carryall.")]
|
[Desc("Delay (in ticks) on the ground while detaching an actor from the carryall.")]
|
||||||
public readonly int UnloadingDelay = 0;
|
public readonly int BeforeUnloadDelay = 0;
|
||||||
|
|
||||||
[Desc("Carryable attachment point relative to body.")]
|
[Desc("Carryable attachment point relative to body.")]
|
||||||
public readonly WVec LocalOffset = WVec.Zero;
|
public readonly WVec LocalOffset = WVec.Zero;
|
||||||
@@ -317,7 +317,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
|
|
||||||
self.SetTargetLine(order.Target, Color.Yellow);
|
self.SetTargetLine(order.Target, Color.Yellow);
|
||||||
self.QueueActivity(order.Queued, new PickupUnit(self, order.Target.Actor, Info.LoadingDelay));
|
self.QueueActivity(order.Queued, new PickupUnit(self, order.Target.Actor, Info.BeforeLoadDelay));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -168,9 +168,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public bool Reserve(Actor self, Cargo cargo)
|
public bool Reserve(Actor self, Cargo cargo)
|
||||||
{
|
{
|
||||||
|
if (cargo == ReservedCargo)
|
||||||
|
return true;
|
||||||
|
|
||||||
Unreserve(self);
|
Unreserve(self);
|
||||||
if (!cargo.ReserveSpace(self))
|
if (!cargo.ReserveSpace(self))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ReservedCargo = cargo;
|
ReservedCargo = cargo;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -181,6 +185,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
if (ReservedCargo == null)
|
if (ReservedCargo == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ReservedCargo.UnreserveSpace(self);
|
ReservedCargo.UnreserveSpace(self);
|
||||||
ReservedCargo = null;
|
ReservedCargo = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#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;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||||
|
{
|
||||||
|
public class RenameCarryallDelays : UpdateRule
|
||||||
|
{
|
||||||
|
public override string Name { get { return "Rename Carryall and Cargo delay parameters"; } }
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return "Carryall's LoadingDelay and UnloadingDelay parameters have been renamed\n"
|
||||||
|
+ "to BeforeLoadDelay and BeforeUnloadDelay to match new parameters on Cargo.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||||
|
{
|
||||||
|
foreach (var carryall in actorNode.ChildrenMatching("Carryall"))
|
||||||
|
{
|
||||||
|
foreach (var node in carryall.ChildrenMatching("LoadingDelay"))
|
||||||
|
node.RenameKey("BeforeLoadDelay");
|
||||||
|
|
||||||
|
foreach (var node in carryall.ChildrenMatching("UnloadingDelay"))
|
||||||
|
node.RenameKey("BeforeUnloadDelay");
|
||||||
|
}
|
||||||
|
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -129,6 +129,7 @@ namespace OpenRA.Mods.Common.UpdateRules
|
|||||||
new RemovePlaceBuildingPalettes(),
|
new RemovePlaceBuildingPalettes(),
|
||||||
new RenameHoversOffsetModifier(),
|
new RenameHoversOffsetModifier(),
|
||||||
new AddAirAttackTypes(),
|
new AddAirAttackTypes(),
|
||||||
|
new RenameCarryallDelays(),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ TRAN:
|
|||||||
Queue: Aircraft.GDI, Aircraft.Nod
|
Queue: Aircraft.GDI, Aircraft.Nod
|
||||||
Description: Fast Infantry Transport Helicopter.\n Unarmed
|
Description: Fast Infantry Transport Helicopter.\n Unarmed
|
||||||
Aircraft:
|
Aircraft:
|
||||||
LandWhenIdle: true
|
LandWhenIdle: false
|
||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
Speed: 150
|
Speed: 150
|
||||||
AltitudeVelocity: 0c100
|
AltitudeVelocity: 0c100
|
||||||
@@ -43,6 +43,7 @@ TRAN:
|
|||||||
Types: Infantry
|
Types: Infantry
|
||||||
MaxWeight: 10
|
MaxWeight: 10
|
||||||
PipCount: 10
|
PipCount: 10
|
||||||
|
AfterUnloadDelay: 40
|
||||||
SpawnActorOnDeath:
|
SpawnActorOnDeath:
|
||||||
Actor: TRAN.Husk
|
Actor: TRAN.Husk
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ carryall.reinforce:
|
|||||||
Actor: carryall.huskVTOL
|
Actor: carryall.huskVTOL
|
||||||
RequiresCondition: !cruising
|
RequiresCondition: !cruising
|
||||||
Carryall:
|
Carryall:
|
||||||
LoadingDelay: 10
|
BeforeLoadDelay: 10
|
||||||
UnloadingDelay: 15
|
BeforeUnloadDelay: 15
|
||||||
LocalOffset: 0, 0, -128
|
LocalOffset: 0, 0, -128
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: carryall
|
Image: carryall
|
||||||
@@ -52,8 +52,8 @@ carryall:
|
|||||||
Inherits: carryall.reinforce
|
Inherits: carryall.reinforce
|
||||||
-Carryall:
|
-Carryall:
|
||||||
AutoCarryall:
|
AutoCarryall:
|
||||||
LoadingDelay: 10
|
BeforeLoadDelay: 10
|
||||||
UnloadingDelay: 15
|
BeforeUnloadDelay: 15
|
||||||
LocalOffset: 0, 0, -128
|
LocalOffset: 0, 0, -128
|
||||||
Aircraft:
|
Aircraft:
|
||||||
MinAirborneAltitude: 400
|
MinAirborneAltitude: 400
|
||||||
|
|||||||
@@ -238,6 +238,7 @@ TRAN:
|
|||||||
Range: 6c0
|
Range: 6c0
|
||||||
Type: GroundPosition
|
Type: GroundPosition
|
||||||
Aircraft:
|
Aircraft:
|
||||||
|
LandWhenIdle: false
|
||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
Speed: 128
|
Speed: 128
|
||||||
AltitudeVelocity: 0c58
|
AltitudeVelocity: 0c58
|
||||||
@@ -261,6 +262,7 @@ TRAN:
|
|||||||
Types: Infantry
|
Types: Infantry
|
||||||
MaxWeight: 8
|
MaxWeight: 8
|
||||||
PipCount: 8
|
PipCount: 8
|
||||||
|
AfterUnloadDelay: 40
|
||||||
SpawnActorOnDeath:
|
SpawnActorOnDeath:
|
||||||
Actor: TRAN.Husk
|
Actor: TRAN.Husk
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ ORCATRAN:
|
|||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Aircraft:
|
Aircraft:
|
||||||
LandWhenIdle: true
|
LandWhenIdle: false
|
||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
Speed: 84
|
Speed: 84
|
||||||
InitialFacing: 0
|
InitialFacing: 0
|
||||||
@@ -210,6 +210,7 @@ ORCATRAN:
|
|||||||
PipCount: 5
|
PipCount: 5
|
||||||
UnloadVoice: Move
|
UnloadVoice: Move
|
||||||
EjectOnDeath: true
|
EjectOnDeath: true
|
||||||
|
AfterUnloadDelay: 40
|
||||||
SpawnActorOnDeath:
|
SpawnActorOnDeath:
|
||||||
Actor: ORCATRAN.Husk
|
Actor: ORCATRAN.Husk
|
||||||
|
|
||||||
@@ -236,6 +237,8 @@ TRNSPORT:
|
|||||||
Carryall:
|
Carryall:
|
||||||
Voice: Move
|
Voice: Move
|
||||||
LocalOffset: 0,0,-317
|
LocalOffset: 0,0,-317
|
||||||
|
BeforeLoadDelay: 10
|
||||||
|
BeforeUnloadDelay: 10
|
||||||
Health:
|
Health:
|
||||||
HP: 17500
|
HP: 17500
|
||||||
Armor:
|
Armor:
|
||||||
|
|||||||
Reference in New Issue
Block a user