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")
|
||||
|
||||
@@ -24,18 +24,29 @@ namespace OpenRA.Mods.RA.Move
|
||||
[FieldLoader.LoadUsing("LoadSpeeds")]
|
||||
[Desc("Set Water: 0 for ground units and lower the value on rough terrain.")]
|
||||
public readonly Dictionary<string, TerrainInfo> TerrainSpeeds;
|
||||
|
||||
[Desc("e.g. crate, wall, infantry")]
|
||||
public readonly string[] Crushes;
|
||||
public readonly string[] Crushes = { };
|
||||
|
||||
public readonly int WaitAverage = 5;
|
||||
|
||||
public readonly int WaitSpread = 2;
|
||||
|
||||
public readonly int InitialFacing = 128;
|
||||
|
||||
[Desc("Rate of Turning")]
|
||||
public readonly int ROT = 255;
|
||||
|
||||
public readonly int Speed = 1;
|
||||
|
||||
public readonly bool OnRails = false;
|
||||
|
||||
[Desc("Allow multiple (infantry) units in one cell.")]
|
||||
public readonly bool SharesCell = false;
|
||||
|
||||
[Desc("Can the actor be ordered to move in to shroud?")]
|
||||
public readonly bool MoveIntoShroud = true;
|
||||
|
||||
public virtual object Create(ActorInitializer init) { return new Mobile(init, this); }
|
||||
|
||||
static object LoadSpeeds(MiniYaml y)
|
||||
@@ -373,8 +384,13 @@ namespace OpenRA.Mods.RA.Move
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString == "Move")
|
||||
{
|
||||
if (!Info.MoveIntoShroud && !self.Owner.Shroud.IsExplored(order.TargetLocation))
|
||||
return;
|
||||
|
||||
PerformMove(self, self.World.Map.Clamp(order.TargetLocation),
|
||||
order.Queued && !self.IsIdle);
|
||||
}
|
||||
|
||||
if (order.OrderString == "Stop")
|
||||
self.CancelActivity();
|
||||
@@ -559,13 +575,14 @@ namespace OpenRA.Mods.RA.Move
|
||||
|
||||
var location = self.World.Map.CellContaining(target.CenterPosition);
|
||||
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
|
||||
cursor = "move";
|
||||
|
||||
if (self.Owner.Shroud.IsExplored(location))
|
||||
cursor = self.World.Map.GetTerrainInfo(location).CustomCursor ?? cursor;
|
||||
var explored = self.Owner.Shroud.IsExplored(location);
|
||||
cursor = self.World.Map.Contains(location) ?
|
||||
(self.World.Map.GetTerrainInfo(location).CustomCursor ?? "move") :
|
||||
"move-blocked";
|
||||
|
||||
if (!self.World.Map.Contains(location) || (self.Owner.Shroud.IsExplored(location) &&
|
||||
unitType.MovementCostForCell(self.World, location) == int.MaxValue))
|
||||
if ((!explored && !unitType.MoveIntoShroud) ||
|
||||
(explored && unitType.MovementCostForCell(self.World, location) == int.MaxValue))
|
||||
cursor = "move-blocked";
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user