Allow VTOLs to land with force-move
This commit is contained in:
@@ -119,20 +119,22 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
// Look for free landing cell
|
// Look for free landing cell
|
||||||
if (target.Type == TargetType.Terrain && !landingInitiated)
|
if (target.Type == TargetType.Terrain && !landingInitiated)
|
||||||
{
|
{
|
||||||
var targetLocation = aircraft.FindLandingLocation(landingCell, landRange);
|
var newLocation = aircraft.FindLandingLocation(landingCell, landRange);
|
||||||
if (!targetLocation.HasValue)
|
|
||||||
|
// Cannot land so fly towards the last target location instead.
|
||||||
|
if (!newLocation.HasValue)
|
||||||
{
|
{
|
||||||
// Maintain holding pattern.
|
Cancel(self, true);
|
||||||
if (aircraft.Info.CanHover)
|
QueueChild(self, aircraft.MoveTo(landingCell, 0), true);
|
||||||
QueueChild(self, new Wait(25), true);
|
|
||||||
else
|
|
||||||
QueueChild(self, new FlyCircle(self, 25), true);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
target = Target.FromCell(self.World, targetLocation.Value);
|
if (newLocation.Value != landingCell)
|
||||||
targetPosition = target.CenterPosition + offset;
|
{
|
||||||
landingCell = self.World.Map.CellContaining(targetPosition);
|
target = Target.FromCell(self.World, newLocation.Value);
|
||||||
|
targetPosition = target.CenterPosition + offset;
|
||||||
|
landingCell = self.World.Map.CellContaining(targetPosition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move towards landing location
|
// Move towards landing location
|
||||||
|
|||||||
@@ -97,6 +97,9 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
// Checking for NextActivity == null again in case another activity was queued while taking off
|
// Checking for NextActivity == null again in case another activity was queued while taking off
|
||||||
if (moveToRallyPoint && NextActivity == null)
|
if (moveToRallyPoint && NextActivity == null)
|
||||||
{
|
{
|
||||||
|
if (!aircraft.Info.VTOL && assignTargetOnFirstRun)
|
||||||
|
return NextActivity;
|
||||||
|
|
||||||
QueueChild(self, new AttackMoveActivity(self, () => move.MoveToTarget(self, target)), true);
|
QueueChild(self, new AttackMoveActivity(self, () => move.MoveToTarget(self, target)), true);
|
||||||
moveToRallyPoint = false;
|
moveToRallyPoint = false;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -66,7 +66,15 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (cargo != carryall.Carryable)
|
if (cargo != carryall.Carryable)
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
if (cargo.IsDead || IsCanceling || carryable.IsTraitDisabled || !cargo.AppearsFriendlyTo(self))
|
if (IsCanceling)
|
||||||
|
{
|
||||||
|
if (carryall.State == Carryall.CarryallState.Reserved)
|
||||||
|
carryall.UnreserveCarryable(self);
|
||||||
|
|
||||||
|
return NextActivity;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cargo.IsDead || carryable.IsTraitDisabled || !cargo.AppearsFriendlyTo(self))
|
||||||
{
|
{
|
||||||
carryall.UnreserveCarryable(self);
|
carryall.UnreserveCarryable(self);
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
@@ -93,14 +101,15 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
// Land at the target location
|
// Land at the target location
|
||||||
var localOffset = carryall.OffsetForCarryable(self, cargo).Rotate(carryableBody.QuantizeOrientation(self, cargo.Orientation));
|
var localOffset = carryall.OffsetForCarryable(self, cargo).Rotate(carryableBody.QuantizeOrientation(self, cargo.Orientation));
|
||||||
QueueChild(self, new Land(self, Target.FromActor(cargo), -carryableBody.LocalToWorld(localOffset), carryableFacing.Facing));
|
QueueChild(self, new Land(self, Target.FromActor(cargo), -carryableBody.LocalToWorld(localOffset), carryableFacing.Facing), true);
|
||||||
|
|
||||||
// Pause briefly before attachment for visual effect
|
// Pause briefly before attachment for visual effect
|
||||||
if (delay > 0)
|
if (delay > 0)
|
||||||
QueueChild(self, new Wait(delay, false), true);
|
QueueChild(self, new Wait(delay, false));
|
||||||
|
|
||||||
// Remove our carryable from world
|
// Remove our carryable from world
|
||||||
QueueChild(self, new CallFunc(() => Attach(self)));
|
QueueChild(self, new CallFunc(() => Attach(self)));
|
||||||
|
QueueChild(self, new TakeOff(self));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -680,7 +680,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!atLandAltitude && Info.LandWhenIdle)
|
if (!atLandAltitude && Info.LandWhenIdle && Info.LandableTerrainTypes.Count > 0)
|
||||||
self.QueueActivity(new Land(self));
|
self.QueueActivity(new Land(self));
|
||||||
else if (!Info.CanHover && !atLandAltitude)
|
else if (!Info.CanHover && !atLandAltitude)
|
||||||
self.QueueActivity(new FlyCircle(self, -1, Info.IdleTurnSpeed > -1 ? Info.IdleTurnSpeed : TurnSpeed));
|
self.QueueActivity(new FlyCircle(self, -1, Info.IdleTurnSpeed > -1 ? Info.IdleTurnSpeed : TurnSpeed));
|
||||||
@@ -914,7 +914,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||||
{
|
{
|
||||||
if (order.OrderID == "Enter" || order.OrderID == "Move")
|
if (order.OrderID == "Enter" || order.OrderID == "Move" || order.OrderID == "Land")
|
||||||
return new Order(order.OrderID, self, target, queued);
|
return new Order(order.OrderID, self, target, queued);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -934,6 +934,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
switch (order.OrderString)
|
switch (order.OrderString)
|
||||||
{
|
{
|
||||||
|
case "Land":
|
||||||
case "Move":
|
case "Move":
|
||||||
if (!Info.MoveIntoShroud && order.Target.Type != TargetType.Invalid)
|
if (!Info.MoveIntoShroud && order.Target.Type != TargetType.Invalid)
|
||||||
{
|
{
|
||||||
@@ -968,6 +969,20 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
self.SetTargetLine(target, Color.Green);
|
self.SetTargetLine(target, Color.Green);
|
||||||
self.QueueActivity(order.Queued, new Fly(self, target));
|
self.QueueActivity(order.Queued, new Fly(self, target));
|
||||||
}
|
}
|
||||||
|
else if (order.OrderString == "Land")
|
||||||
|
{
|
||||||
|
var cell = self.World.Map.Clamp(self.World.Map.CellContaining(order.Target.CenterPosition));
|
||||||
|
if (!Info.MoveIntoShroud && !self.Owner.Shroud.IsExplored(cell))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!order.Queued)
|
||||||
|
UnReserve();
|
||||||
|
|
||||||
|
var target = Target.FromCell(self.World, cell);
|
||||||
|
|
||||||
|
self.SetTargetLine(target, Color.Green);
|
||||||
|
self.QueueActivity(order.Queued, new Land(self, target));
|
||||||
|
}
|
||||||
else if (order.OrderString == "Enter" || order.OrderString == "Repair")
|
else if (order.OrderString == "Enter" || order.OrderString == "Repair")
|
||||||
{
|
{
|
||||||
// Enter and Repair orders are only valid for own/allied actors,
|
// Enter and Repair orders are only valid for own/allied actors,
|
||||||
@@ -1095,13 +1110,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
readonly Aircraft aircraft;
|
readonly Aircraft aircraft;
|
||||||
|
|
||||||
public string OrderID { get { return "Move"; } }
|
public string OrderID { get; protected set; }
|
||||||
public int OrderPriority { get { return 4; } }
|
public int OrderPriority { get { return 4; } }
|
||||||
public bool IsQueued { get; protected set; }
|
public bool IsQueued { get; protected set; }
|
||||||
|
|
||||||
public AircraftMoveOrderTargeter(Aircraft aircraft)
|
public AircraftMoveOrderTargeter(Aircraft aircraft)
|
||||||
{
|
{
|
||||||
this.aircraft = aircraft;
|
this.aircraft = aircraft;
|
||||||
|
OrderID = "Move";
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers)
|
public bool TargetOverridesSelection(TargetModifiers modifiers)
|
||||||
@@ -1114,6 +1130,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (target.Type != TargetType.Terrain || (aircraft.requireForceMove && !modifiers.HasModifier(TargetModifiers.ForceMove)))
|
if (target.Type != TargetType.Terrain || (aircraft.requireForceMove && !modifiers.HasModifier(TargetModifiers.ForceMove)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (modifiers.HasModifier(TargetModifiers.ForceMove))
|
||||||
|
OrderID = "Land";
|
||||||
|
|
||||||
var location = self.World.Map.CellContaining(target.CenterPosition);
|
var location = self.World.Map.CellContaining(target.CenterPosition);
|
||||||
var explored = self.Owner.Shroud.IsExplored(location);
|
var explored = self.Owner.Shroud.IsExplored(location);
|
||||||
cursor = self.World.Map.Contains(location) ?
|
cursor = self.World.Map.Contains(location) ?
|
||||||
|
|||||||
@@ -1209,7 +1209,7 @@ Container@PLAYER_WIDGETS:
|
|||||||
Background: chrome-button-background
|
Background: chrome-button-background
|
||||||
DisableKeySound: true
|
DisableKeySound: true
|
||||||
TooltipText: Force Move
|
TooltipText: Force Move
|
||||||
TooltipDesc: Selected units will move to the desired location\n - Default activity for the target is suppressed\n - Vehicles will attempt to crush enemies at the target location\n\nLeft-click icon then right-click on target.\nHold {(Alt)} to activate temporarily while commanding units.
|
TooltipDesc: Selected units will move to the desired location\n - Default activity for the target is suppressed\n - Vehicles will attempt to crush enemies at the target location\n - Helicopters will land at the target location\n\nLeft-click icon then right-click on target.\nHold {(Alt)} to activate temporarily while commanding units.
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
TooltipTemplate: BUTTON_WITH_DESC_HIGHLIGHT_TOOLTIP_FACTIONSUFFIX
|
TooltipTemplate: BUTTON_WITH_DESC_HIGHLIGHT_TOOLTIP_FACTIONSUFFIX
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ TRAN:
|
|||||||
LandWhenIdle: true
|
LandWhenIdle: true
|
||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
Speed: 150
|
Speed: 150
|
||||||
LandableTerrainTypes: Clear, Rough, Road, Beach, Tiberium, BlueTiberium
|
|
||||||
Crushes: crate, infantry
|
|
||||||
AltitudeVelocity: 0c100
|
AltitudeVelocity: 0c100
|
||||||
Health:
|
Health:
|
||||||
HP: 9000
|
HP: 9000
|
||||||
|
|||||||
@@ -328,6 +328,8 @@
|
|||||||
CanHover: True
|
CanHover: True
|
||||||
TakeOffOnResupply: true
|
TakeOffOnResupply: true
|
||||||
VTOL: true
|
VTOL: true
|
||||||
|
LandableTerrainTypes: Clear, Rough, Road, Beach, Tiberium, BlueTiberium
|
||||||
|
Crushes: crate, infantry
|
||||||
InitialFacing: 224
|
InitialFacing: 224
|
||||||
HiddenUnderFog:
|
HiddenUnderFog:
|
||||||
Type: GroundPosition
|
Type: GroundPosition
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ Container@PLAYER_WIDGETS:
|
|||||||
Background: command-button
|
Background: command-button
|
||||||
DisableKeySound: true
|
DisableKeySound: true
|
||||||
TooltipText: Force Move
|
TooltipText: Force Move
|
||||||
TooltipDesc: Selected units will move to the desired location\n - Default activity for the target is suppressed\n - Vehicles will attempt to crush enemies at the target location\n - Chrono Tanks will teleport towards the target location\n\nLeft-click icon then right-click on target.\nHold {(Alt)} to activate temporarily while commanding units.
|
TooltipDesc: Selected units will move to the desired location\n - Default activity for the target is suppressed\n - Vehicles will attempt to crush enemies at the target location\n - Helicopters will land at the target location\n - Chrono Tanks will teleport towards the target location\n\nLeft-click icon then right-click on target.\nHold {(Alt)} to activate temporarily while commanding units.
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
TooltipTemplate: BUTTON_WITH_DESC_HIGHLIGHT_TOOLTIP
|
TooltipTemplate: BUTTON_WITH_DESC_HIGHLIGHT_TOOLTIP
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -240,8 +240,6 @@ TRAN:
|
|||||||
Aircraft:
|
Aircraft:
|
||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
Speed: 128
|
Speed: 128
|
||||||
LandableTerrainTypes: Clear,Rough,Road,Ore,Beach,Gems
|
|
||||||
Crushes: crate, mine, infantry
|
|
||||||
AltitudeVelocity: 0c58
|
AltitudeVelocity: 0c58
|
||||||
WithIdleOverlay@ROTOR1AIR:
|
WithIdleOverlay@ROTOR1AIR:
|
||||||
Offset: 597,0,213
|
Offset: 597,0,213
|
||||||
|
|||||||
@@ -631,6 +631,8 @@
|
|||||||
WaitDistanceFromResupplyBase: 4c0
|
WaitDistanceFromResupplyBase: 4c0
|
||||||
TakeOffOnResupply: true
|
TakeOffOnResupply: true
|
||||||
VTOL: true
|
VTOL: true
|
||||||
|
LandableTerrainTypes: Clear, Rough, Road, Ore, Beach, Gems
|
||||||
|
Crushes: crate, mine, infantry
|
||||||
InitialFacing: 224
|
InitialFacing: 224
|
||||||
GpsDot:
|
GpsDot:
|
||||||
String: Helicopter
|
String: Helicopter
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ Container@PLAYER_WIDGETS:
|
|||||||
Background:
|
Background:
|
||||||
DisableKeySound: true
|
DisableKeySound: true
|
||||||
TooltipText: Force Move
|
TooltipText: Force Move
|
||||||
TooltipDesc: Selected units will move to the desired location\n - Default activity for the target is suppressed\n - Vehicles will attempt to crush enemies at the target location\n - Deployed units will undeploy and move to the target location\n - Carryalls will not release their cargo at the target location\n\nLeft-click icon then right-click on target.\nHold {(Alt)} to activate temporarily while commanding units.
|
TooltipDesc: Selected units will move to the desired location\n - Default activity for the target is suppressed\n - Vehicles will attempt to crush enemies at the target location\n - Deployed units will undeploy and move to the target location\n - Helicopters will land at the target location\n\nLeft-click icon then right-click on target.\nHold {(Alt)} to activate temporarily while commanding units.
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
TooltipTemplate: BUTTON_WITH_DESC_HIGHLIGHT_TOOLTIP
|
TooltipTemplate: BUTTON_WITH_DESC_HIGHLIGHT_TOOLTIP
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ DPOD:
|
|||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
Speed: 149
|
Speed: 149
|
||||||
InitialFacing: 0
|
InitialFacing: 0
|
||||||
LandableTerrainTypes: Clear,Road,Rail,DirtRoad,Rough,Tiberium,BlueTiberium,Veins
|
|
||||||
Crushes: crate, infantry
|
|
||||||
Health:
|
Health:
|
||||||
HP: 6000
|
HP: 6000
|
||||||
Armor:
|
Armor:
|
||||||
@@ -46,8 +44,6 @@ DSHP:
|
|||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
Speed: 168
|
Speed: 168
|
||||||
InitialFacing: 0
|
InitialFacing: 0
|
||||||
LandableTerrainTypes: Clear,Road,Rail,DirtRoad,Rough,Tiberium,BlueTiberium,Veins
|
|
||||||
Crushes: crate, infantry
|
|
||||||
TakeoffSounds: dropup1.aud
|
TakeoffSounds: dropup1.aud
|
||||||
LandingSounds: dropdwn1.aud
|
LandingSounds: dropdwn1.aud
|
||||||
IdealSeparation: 1275
|
IdealSeparation: 1275
|
||||||
@@ -198,8 +194,6 @@ ORCATRAN:
|
|||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
Speed: 84
|
Speed: 84
|
||||||
InitialFacing: 0
|
InitialFacing: 0
|
||||||
LandableTerrainTypes: Clear,Road,Rail,DirtRoad,Rough,Tiberium,BlueTiberium,Veins
|
|
||||||
Crushes: crate, infantry
|
|
||||||
TakeoffSounds: orcaup1.aud
|
TakeoffSounds: orcaup1.aud
|
||||||
LandingSounds: orcadwn1.aud
|
LandingSounds: orcadwn1.aud
|
||||||
IdealSeparation: 1275
|
IdealSeparation: 1275
|
||||||
@@ -233,12 +227,9 @@ TRNSPORT:
|
|||||||
Prerequisites: ~gahpad, gadept
|
Prerequisites: ~gahpad, gadept
|
||||||
Description: VTOL aircraft capable of lifting\nand transporting vehicles.\n Unarmed
|
Description: VTOL aircraft capable of lifting\nand transporting vehicles.\n Unarmed
|
||||||
Aircraft:
|
Aircraft:
|
||||||
LandWhenIdle: true
|
|
||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
Speed: 149
|
Speed: 149
|
||||||
InitialFacing: 0
|
InitialFacing: 0
|
||||||
LandableTerrainTypes: Clear,Road,Rail,DirtRoad,Rough,Tiberium,BlueTiberium,Veins
|
|
||||||
Crushes: crate, infantry
|
|
||||||
TakeoffSounds: dropup1.aud
|
TakeoffSounds: dropup1.aud
|
||||||
LandingSounds: dropdwn1.aud
|
LandingSounds: dropdwn1.aud
|
||||||
MoveIntoShroud: false
|
MoveIntoShroud: false
|
||||||
|
|||||||
@@ -875,6 +875,8 @@
|
|||||||
Voice: Move
|
Voice: Move
|
||||||
IdealSeparation: 853
|
IdealSeparation: 853
|
||||||
MaximumPitch: 120
|
MaximumPitch: 120
|
||||||
|
LandableTerrainTypes: Clear, Road, Rail, DirtRoad, Rough, Tiberium, BlueTiberium, Veins
|
||||||
|
Crushes: crate, infantry
|
||||||
Voiced:
|
Voiced:
|
||||||
VoiceSet: Heli
|
VoiceSet: Heli
|
||||||
HiddenUnderFog:
|
HiddenUnderFog:
|
||||||
|
|||||||
Reference in New Issue
Block a user