Merge pull request #12458 from pchote/map-top-targetability

Reduce aircraft not being targetable at the north edge of the map.
This commit is contained in:
Oliver Brakmann
2016-12-21 21:14:19 +01:00
committed by GitHub
7 changed files with 25 additions and 8 deletions

View File

@@ -230,6 +230,15 @@ namespace OpenRA.Mods.Common.Traits
repulsionForce += GetRepulsionForce(actor);
}
// Actors outside the map bounds receive an extra nudge towards the center of the map
if (!self.World.Map.Contains(self.Location))
{
// The map bounds are in projected coordinates, which is technically wrong for this,
// but we avoid the issues in practice by guessing the middle of the map instead of the edge
var center = WPos.Lerp(self.World.Map.ProjectedTopLeft, self.World.Map.ProjectedBottomRight, 1, 2);
repulsionForce += new WVec(1024, 0, 0).Rotate(WRot.FromYaw((self.CenterPosition - center).Yaw));
}
if (Info.CanHover)
return repulsionForce;

View File

@@ -31,7 +31,11 @@ namespace OpenRA.Mods.Common.Traits
if (Info.Type == VisibilityType.Footprint)
return byPlayer.Shroud.AnyVisible(self.OccupiesSpace.OccupiedCells());
return byPlayer.Shroud.IsVisible(self.CenterPosition);
var pos = self.CenterPosition;
if (Info.Type == VisibilityType.GroundPosition)
pos -= new WVec(WDist.Zero, WDist.Zero, self.World.Map.DistanceAboveTerrain(pos));
return byPlayer.Shroud.IsVisible(pos);
}
}
}

View File

@@ -42,7 +42,11 @@ namespace OpenRA.Mods.Common.Traits
if (Info.Type == VisibilityType.Footprint)
return byPlayer.Shroud.AnyExplored(self.OccupiesSpace.OccupiedCells());
return byPlayer.Shroud.IsExplored(self.CenterPosition);
var pos = self.CenterPosition;
if (Info.Type == VisibilityType.GroundPosition)
pos -= new WVec(WDist.Zero, WDist.Zero, self.World.Map.DistanceAboveTerrain(pos));
return byPlayer.Shroud.IsExplored(pos);
}
public bool IsVisible(Actor self, Player byPlayer)