Added flag to Mobile/AircraftInfo: MoveIntoShroud.
Does not change the audio feedback given.
This commit is contained in:
@@ -37,6 +37,9 @@ namespace OpenRA.Mods.RA.Air
|
||||
public readonly int Speed = 1;
|
||||
public readonly string[] LandableTerrainTypes = { };
|
||||
|
||||
[Desc("Can the actor be ordered to move in to shroud?")]
|
||||
public readonly bool MoveIntoShroud = true;
|
||||
|
||||
public virtual object Create(ActorInitializer init) { return new Aircraft(init, this); }
|
||||
public int GetInitialFacing() { return InitialFacing; }
|
||||
}
|
||||
@@ -248,7 +251,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
yield return new EnterAlliedActorTargeter<Building>("Enter", 5,
|
||||
target => AircraftCanEnter(target), target => !Reservable.IsReserved(target));
|
||||
|
||||
yield return new AircraftMoveOrderTargeter();
|
||||
yield return new AircraftMoveOrderTargeter(info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,13 +300,26 @@ namespace OpenRA.Mods.RA.Air
|
||||
public string OrderID { get { return "Move"; } }
|
||||
public int OrderPriority { get { return 4; } }
|
||||
|
||||
readonly AircraftInfo info;
|
||||
|
||||
public AircraftMoveOrderTargeter(AircraftInfo info) { this.info = info; }
|
||||
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
if (target.Type != TargetType.Terrain)
|
||||
return false;
|
||||
|
||||
var location = self.World.Map.CellContaining(target.CenterPosition);
|
||||
var explored = self.Owner.Shroud.IsExplored(location);
|
||||
cursor = self.World.Map.Contains(location) ?
|
||||
(self.World.Map.GetTerrainInfo(location).CustomCursor ?? "move") :
|
||||
"move-blocked";
|
||||
|
||||
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
|
||||
cursor = self.World.Map.Contains(self.World.Map.CellContaining(target.CenterPosition)) ? "move" : "move-blocked";
|
||||
|
||||
if (!explored && !info.MoveIntoShroud)
|
||||
cursor = "move-blocked";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
11
OpenRA.Mods.RA/Air/Helicopter.cs
Executable file → Normal file
11
OpenRA.Mods.RA/Air/Helicopter.cs
Executable file → Normal file
@@ -56,11 +56,16 @@ namespace OpenRA.Mods.RA.Air
|
||||
if (order.OrderString == "Move")
|
||||
{
|
||||
var cell = self.World.Map.Clamp(order.TargetLocation);
|
||||
var t = Target.FromCell(self.World, cell);
|
||||
var explored = self.Owner.Shroud.IsExplored(cell);
|
||||
|
||||
self.SetTargetLine(t, Color.Green);
|
||||
if (!explored && !Info.MoveIntoShroud)
|
||||
return;
|
||||
|
||||
var target = Target.FromCell(self.World, cell);
|
||||
|
||||
self.SetTargetLine(target, Color.Green);
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new HeliFly(self, t));
|
||||
self.QueueActivity(new HeliFly(self, target));
|
||||
|
||||
if (Info.LandWhenIdle)
|
||||
{
|
||||
|
||||
13
OpenRA.Mods.RA/Air/Plane.cs
Executable file → Normal file
13
OpenRA.Mods.RA/Air/Plane.cs
Executable file → Normal file
@@ -71,13 +71,18 @@ namespace OpenRA.Mods.RA.Air
|
||||
{
|
||||
if (order.OrderString == "Move")
|
||||
{
|
||||
var cell = self.World.Map.Clamp(order.TargetLocation);
|
||||
var explored = self.Owner.Shroud.IsExplored(cell);
|
||||
|
||||
if (!explored && !Info.MoveIntoShroud)
|
||||
return;
|
||||
|
||||
UnReserve();
|
||||
|
||||
var cell = self.World.Map.Clamp(order.TargetLocation);
|
||||
var t = Target.FromCell(self.World, cell);
|
||||
self.SetTargetLine(t, Color.Green);
|
||||
var target = Target.FromCell(self.World, cell);
|
||||
self.SetTargetLine(target, Color.Green);
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new Fly(self, t));
|
||||
self.QueueActivity(new Fly(self, target));
|
||||
self.QueueActivity(new FlyCircle());
|
||||
}
|
||||
else if (order.OrderString == "Enter")
|
||||
|
||||
Reference in New Issue
Block a user