In-Flight spawn: Minimum AGL altitude (#2302)

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2212
This commit is contained in:
Raffson 2022-07-06 20:56:39 +02:00 committed by GitHub
parent ec425501cd
commit 746eda70ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,7 +29,8 @@ WARM_START_ALTITUDE = meters(3000)
# PG at 5700ft. This could still be too low if there are tall obstacles near the
# airfield, but the lowest we can push this the better to avoid spawning helicopters
# well above the altitude for WP1.
MINIMUM_MID_MISSION_SPAWN_ALTITUDE = feet(6000)
MINIMUM_MID_MISSION_SPAWN_ALTITUDE_MSL = feet(6000)
MINIMUM_MID_MISSION_SPAWN_ALTITUDE_AGL = feet(500)
RTB_ALTITUDE = meters(800)
RTB_DISTANCE = 5000
@ -139,8 +140,13 @@ class FlightGroupSpawner:
# We don't know where the ground is, so just make sure that any aircraft
# spawning at an MSL altitude is spawned at some minimum altitude.
# https://github.com/dcs-liberation/dcs_liberation/issues/1941
if alt_type == "BARO" and alt < MINIMUM_MID_MISSION_SPAWN_ALTITUDE:
alt = MINIMUM_MID_MISSION_SPAWN_ALTITUDE
if alt_type == "BARO" and alt < MINIMUM_MID_MISSION_SPAWN_ALTITUDE_MSL:
alt = MINIMUM_MID_MISSION_SPAWN_ALTITUDE_MSL
# Set a minimum AGL value for 'alt' if needed,
# otherwise planes might crash in trees and stuff.
if alt_type == "RADIO" and alt < MINIMUM_MID_MISSION_SPAWN_ALTITUDE_AGL:
alt = MINIMUM_MID_MISSION_SPAWN_ALTITUDE_AGL
group = self.mission.flight_group(
country=self.country,