From f498c08dc9536454a399c95d4866a98016f6a214 Mon Sep 17 00:00:00 2001 From: Raffson Date: Sun, 2 Apr 2023 22:07:37 +0200 Subject: [PATCH] Inject ground units to TgoConfig preset group if fill and has no unit --- changelog.md | 1 + game/theater/start_generator.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/changelog.md b/changelog.md index e3e79d55..2c2d4180 100644 --- a/changelog.md +++ b/changelog.md @@ -8,6 +8,7 @@ * **[Plugins]** Fix bug where changes to plugin options doesn't do anything. * **[Campaign Management]** Fix bug in procurement when no squadrons are present. * **[Layouts]** Fix edge-case bug layout's group size. +* **[Campaign Design]** Preset groups assigned to specific TGOs not working as intended. # Retribution 1.1.0 diff --git a/game/theater/start_generator.py b/game/theater/start_generator.py index 56446b64..b15b5cb4 100644 --- a/game/theater/start_generator.py +++ b/game/theater/start_generator.py @@ -310,6 +310,13 @@ class AirbaseGroundObjectGenerator(ControlPointGroundObjectGenerator): and all([u in self.faction.accessible_units for u in fg.units]) ) if valid_fg: + for layout in fg.layouts: + for lg in layout.groups: + for ug in lg.unit_groups: + if not fg.has_unit_for_layout_group(ug) and ug.fill: + for g in self.faction.ground_units: + if g.unit_class in ug.unit_classes: + fg.units.append(g) unit_group = fg assert fg self.armed_forces.add_or_update_force_group(fg)