diff --git a/changelog.md b/changelog.md index 92cc20b4..49fd2d8b 100644 --- a/changelog.md +++ b/changelog.md @@ -39,6 +39,7 @@ * **[New Game Wizard]** Campaign errors show a dialog again and avoid CTDs * **[UI]** Landmap wasn't updating when switching to a different theater * **[Mission Results Processor]** Squadrons of a sunken carrier are now disbanded +* **[Mission Generation]** Introduced option to switch alt-type to AMSL during mission generation to avoid helicopters wanting to submerge over certain parts of the sea. # Retribution v1.3.1 #### Note: Re-save your missions in DCS' Mission Editor to avoid possible crashes due to datalink (usually the case when F-16C blk50s are used) when hosting missions on a dedicated server. diff --git a/game/missiongenerator/aircraft/waypoints/pydcswaypointbuilder.py b/game/missiongenerator/aircraft/waypoints/pydcswaypointbuilder.py index ca06399e..045cf049 100644 --- a/game/missiongenerator/aircraft/waypoints/pydcswaypointbuilder.py +++ b/game/missiongenerator/aircraft/waypoints/pydcswaypointbuilder.py @@ -65,6 +65,9 @@ class PydcsWaypointBuilder: name=self.dcs_name_for_waypoint(), ) + waypoint.alt_type = self.waypoint.alt_type + if self.flight.is_helo and self.flight.coalition.game.settings.switch_baro_fix: + self.switch_to_baro_if_in_sea(waypoint) if self.waypoint.flyover: waypoint.action = PointAction.FlyOverPoint # It seems we need to leave waypoint.type exactly as it is even @@ -75,13 +78,19 @@ class PydcsWaypointBuilder: waypoint.alt = 0 waypoint.alt_type = "RADIO" - waypoint.alt_type = self.waypoint.alt_type tot = self.flight.flight_plan.tot_for_waypoint(self.waypoint) if tot is not None: self.set_waypoint_tot(waypoint, tot) self.add_tasks(waypoint) 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) + ): + waypoint.alt_type = "BARO" + def ai_despawn( self, waypoint: MovingPoint, ignore_landing_wpt: bool = False ) -> bool: diff --git a/game/settings/settings.py b/game/settings/settings.py index 8a3afbd5..e5813523 100644 --- a/game/settings/settings.py +++ b/game/settings/settings.py @@ -798,7 +798,7 @@ class Settings: section=GAMEPLAY_SECTION, choices={v.value: v for v in StartType}, default=StartType.COLD, - detail=("Default start type for flights containing Player/Client slots."), + detail="Default start type for flights containing Player/Client slots.", ) nevatim_parking_fix: bool = boolean_option( "Force air-starts for aircraft at Nevatim and Ramon Airbase inoperable parking slots", @@ -810,6 +810,16 @@ class Settings: "which are known to work as of DCS World 2.9.4.53990." ), ) + switch_baro_fix: bool = boolean_option( + "Switch altitude type of waypoints to AMSL above seas for helicopters", + page=MISSION_GENERATOR_PAGE, + section=GAMEPLAY_SECTION, + default=True, # TODO: set to False or remove this when DCS is fixed? + detail=( + "AGL seems to reference the bottom of the sea which causes issues for helicopters" + " trying to fly at altitudes lower than the sea-bottom." + ), + ) limit_ai_radios: bool = boolean_option( "Limit AI radio callouts", page=MISSION_GENERATOR_PAGE,