Split AircraftMoveOrderTargeter to its own file
This commit is contained in:
@@ -201,6 +201,7 @@
|
|||||||
<Compile Include="Orders\RepairOrderGenerator.cs" />
|
<Compile Include="Orders\RepairOrderGenerator.cs" />
|
||||||
<Compile Include="Orders\GlobalButtonOrderGenerator.cs" />
|
<Compile Include="Orders\GlobalButtonOrderGenerator.cs" />
|
||||||
<Compile Include="Orders\PlaceBuildingOrderGenerator.cs" />
|
<Compile Include="Orders\PlaceBuildingOrderGenerator.cs" />
|
||||||
|
<Compile Include="Orders\AircraftMoveOrderTargeter.cs" />
|
||||||
<Compile Include="Orders\UnitOrderTargeter.cs" />
|
<Compile Include="Orders\UnitOrderTargeter.cs" />
|
||||||
<Compile Include="Pathfinder\CellInfo.cs" />
|
<Compile Include="Pathfinder\CellInfo.cs" />
|
||||||
<Compile Include="PlayerExtensions.cs" />
|
<Compile Include="PlayerExtensions.cs" />
|
||||||
|
|||||||
48
OpenRA.Mods.Common/Orders/AircraftMoveOrderTargeter.cs
Normal file
48
OpenRA.Mods.Common/Orders/AircraftMoveOrderTargeter.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2015 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. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.Orders
|
||||||
|
{
|
||||||
|
class AircraftMoveOrderTargeter : IOrderTargeter
|
||||||
|
{
|
||||||
|
public string OrderID { get { return "Move"; } }
|
||||||
|
public int OrderPriority { get { return 4; } }
|
||||||
|
public bool OverrideSelection { get { return false; } }
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
if (!explored && !info.MoveIntoShroud)
|
||||||
|
cursor = "move-blocked";
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsQueued { get; protected set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -372,36 +372,4 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AircraftMoveOrderTargeter : IOrderTargeter
|
|
||||||
{
|
|
||||||
public string OrderID { get { return "Move"; } }
|
|
||||||
public int OrderPriority { get { return 4; } }
|
|
||||||
public bool OverrideSelection { get { return false; } }
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (!explored && !info.MoveIntoShroud)
|
|
||||||
cursor = "move-blocked";
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsQueued { get; protected set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user