diff --git a/changelog.md b/changelog.md index 52cf2aba..d1241271 100644 --- a/changelog.md +++ b/changelog.md @@ -47,12 +47,12 @@ * **[Units/Factions]** Replaced S3-B Tanker by KC130 for most factions (More fuel) * **[Units/Factions]** WW2 factions will not have offshore oil station and other modern buildings generated. No more third-reich operated offshore stations will spawn on normandy's coast. - +* **[Units/Factions]** Aircraft carrier will try to move in the wind direction * **[Units/Factions]** Missing icons added for some aircraft * **[Mission Generator]** When playing as RED the activation trigger would not be properly generated * **[Mission Generator]** FW-190A8 is now properly considered as a flyable aircraft -* **[Mission Generator]** Changed "strike" payload for Su-24M that was innefective +* **[Mission Generator]** Changed "strike" payload for Su-24M that was ineffective * **[Mission Generator]** Changed "strike" payload for JF-17 to use LS-6 bombs instead of GBU * **[Mission Generator]** Change power station template. (Buildings could end up superposed). diff --git a/game/operation/operation.py b/game/operation/operation.py index ea45f69c..9046cc1a 100644 --- a/game/operation/operation.py +++ b/game/operation/operation.py @@ -116,6 +116,12 @@ class Operation: def generate(self): + # Generate meteo + if self.environment_settings is None: + self.environment_settings = self.envgen.generate() + else: + self.envgen.load(self.environment_settings) + # Generate ground object first self.groundobjectgen.generate() @@ -158,12 +164,6 @@ class Operation: cp = self.conflict.to_cp self.triggersgen.generate() - # env settings - if self.environment_settings is None: - self.environment_settings = self.envgen.generate() - else: - self.envgen.load(self.environment_settings) - # options self.forcedoptionsgen.generate() diff --git a/gen/groundobjectsgen.py b/gen/groundobjectsgen.py index a09a836c..c85c5746 100644 --- a/gen/groundobjectsgen.py +++ b/gen/groundobjectsgen.py @@ -117,13 +117,20 @@ class GroundObjectsGenerator: ship.heading = u.heading sg.add_unit(ship) - # TODO : make sure the point is not on Land - sg.add_waypoint(sg.points[0].position.point_from_heading(g.units[0].heading, 100000)) + # Find carrier direction (In the wind) + found_carrier_destination = False + attempt = 0 + while not found_carrier_destination and attempt < 5: + point = sg.points[0].position.point_from_heading(self.m.weather.wind_at_ground.direction, 100000-attempt*20000) + if self.game.theater.is_in_sea(point): + found_carrier_destination = True + sg.add_waypoint(point) + else: + attempt = attempt + 1 - # SET UP TACAN + # Set UP TACAN and ICLS modeChannel = "X" if not cp.tacanY else "Y" sg.points[0].tasks.append(ActivateBeaconCommand(channel=cp.tacanN, modechannel=modeChannel, callsign=cp.tacanI, unit_id=sg.units[0].id)) - if ground_object.dcs_identifier == "CARRIER" and hasattr(cp, "icls"): sg.points[0].tasks.append(ActivateICLSCommand(cp.icls, unit_id=sg.units[0].id))