Merge pull request #4036 from pchote/aircraft-polish

C&C aircraft polish.
This commit is contained in:
Matthias Mailänder
2013-11-01 14:17:23 -07:00
19 changed files with 231 additions and 126 deletions

View File

@@ -172,6 +172,9 @@ namespace OpenRA.GameRules
if (target.Type == TargetType.Terrain)
{
var cell = target.CenterPosition.ToCPos();
if (!world.Map.IsInMap(cell))
return false;
if (ValidTargets.Contains("Ground") && world.GetTerrainType(cell) != "Water")
return true;

View File

@@ -124,6 +124,15 @@ namespace OpenRA
r.Next(w.Map.Bounds.Top, w.Map.Bounds.Bottom));
}
public static WRange DistanceToMapEdge(this World w, WPos pos, WVec dir)
{
var tl = w.Map.Bounds.TopLeftAsCPos().TopLeft;
var br = w.Map.Bounds.BottomRightAsCPos().BottomRight;
var x = dir.X == 0 ? int.MaxValue : ((dir.X < 0 ? tl.X : br.X) - pos.X) / dir.X;
var y = dir.Y == 0 ? int.MaxValue : ((dir.Y < 0 ? tl.Y : br.Y) - pos.Y) / dir.Y;
return new WRange(Math.Min(x, y) * dir.Length);
}
public static bool HasVoices(this Actor a)
{
var selectable = a.Info.Traits.GetOrDefault<SelectableInfo>();