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)

View File

@@ -206,7 +206,7 @@
CruisingCondition: cruising
CanHover: True
HiddenUnderFog:
Type: CenterPosition
Type: GroundPosition
ActorLostNotification:
Explodes:
Weapon: HeliExplode
@@ -502,7 +502,7 @@
AppearsOnRadar:
UseLocation: yes
HiddenUnderFog:
Type: CenterPosition
Type: GroundPosition
AlwaysVisibleStances: None
ActorLostNotification:
AttackMove:

View File

@@ -299,7 +299,7 @@
AppearsOnRadar:
UseLocation: true
HiddenUnderFog:
Type: CenterPosition
Type: GroundPosition
AlwaysVisibleStances: None
ActorLostNotification:
AttackMove:

View File

@@ -436,7 +436,7 @@
TargetTypes: Air
RequiresCondition: airborne
HiddenUnderFog:
Type: CenterPosition
Type: GroundPosition
AttackMove:
Guard:
Guardable:

View File

@@ -579,7 +579,7 @@
Voiced:
VoiceSet: Heli
HiddenUnderFog:
Type: CenterPosition
Type: GroundPosition
AttackMove:
Voice: Move
ActorLostNotification:
@@ -622,7 +622,7 @@
Armor:
Type: Heavy
HiddenUnderFog:
Type: CenterPosition
Type: GroundPosition
AutoTargetIgnore:
ScriptTriggers:
Tooltip: