From 30bf4542f0f3a8d37398d45e6d7ac6e7ce704b77 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Mon, 19 Apr 2021 00:03:47 -0700 Subject: [PATCH] Special case turn 0 for recruitment. We want there to be units on the front line on turn 1 regardless of factory locations, so bypass the recruitment restrictions on turn 0. https://github.com/Khopa/dcs_liberation/issues/986 --- game/event/event.py | 6 ++++++ game/theater/controlpoint.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/game/event/event.py b/game/event/event.py index 54f7bcac..0d7daa8e 100644 --- a/game/event/event.py +++ b/game/event/event.py @@ -540,6 +540,12 @@ class UnitsDeliveryEvent: ) def find_ground_unit_source(self, game: Game) -> Optional[ControlPoint]: + # This is running *after* the turn counter has been incremented, so this is the + # reaction to turn 0. On turn zero we allow units to be recruited anywhere for + # delivery on turn 1 so that turn 1 always starts with units on the front line. + if game.turn == 1: + return self.destination + # Fast path if the destination is a valid source. if self.destination.can_recruit_ground_units(game): return self.destination diff --git a/game/theater/controlpoint.py b/game/theater/controlpoint.py index 2be2feb2..9ce59a19 100644 --- a/game/theater/controlpoint.py +++ b/game/theater/controlpoint.py @@ -329,6 +329,11 @@ class ControlPoint(MissionTarget, ABC): if not game.settings.enable_new_ground_unit_recruitment: return True + if game.turn == 0: + # Allow units to be recruited anywhere on turn 0 to avoid long delays to get + # everyone to the front line. + return True + return self.has_factory def has_ground_unit_source(self, game: Game) -> bool: