mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Improve AGL to AMSL transition for naval waypoints
Some maps have inaccurate bounds for sea-zones, thus waypoints that end up being too close to the shore may keep using AGL which could still lead to trouble. Adding a condition to check whether a point is "not on land" will likely fix this issue for maps that have gaps between sea-zones and inclusion-zones around the shoreline...
This commit is contained in:
parent
b5225f03a1
commit
84c4b992e0
@ -85,9 +85,11 @@ class PydcsWaypointBuilder:
|
||||
return waypoint
|
||||
|
||||
def switch_to_baro_if_in_sea(self, waypoint: MovingPoint) -> None:
|
||||
if (
|
||||
waypoint.alt_type == "RADIO"
|
||||
and self.flight.coalition.game.theater.is_in_sea(waypoint.position)
|
||||
if waypoint.alt_type == "RADIO" and (
|
||||
self.flight.coalition.game.theater.is_in_sea(waypoint.position)
|
||||
or not self.flight.coalition.game.theater.is_on_land(
|
||||
waypoint.position, ignore_exclusion=True
|
||||
)
|
||||
):
|
||||
waypoint.alt_type = "BARO"
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ class ConflictTheater:
|
||||
|
||||
return False
|
||||
|
||||
def is_on_land(self, point: Point) -> bool:
|
||||
def is_on_land(self, point: Point, ignore_exclusion: bool = False) -> bool:
|
||||
if not self.landmap:
|
||||
return True
|
||||
|
||||
@ -86,9 +86,10 @@ class ConflictTheater:
|
||||
if not is_point_included:
|
||||
return False
|
||||
|
||||
for exclusion_zone in self.landmap.exclusion_zones.geoms:
|
||||
if poly_contains(point.x, point.y, exclusion_zone):
|
||||
return False
|
||||
if not ignore_exclusion:
|
||||
for exclusion_zone in self.landmap.exclusion_zones.geoms:
|
||||
if poly_contains(point.x, point.y, exclusion_zone):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user