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
This commit is contained in:
Dan Albert 2021-04-19 00:03:47 -07:00
parent d11c9a4615
commit 30bf4542f0
2 changed files with 11 additions and 0 deletions

View File

@ -540,6 +540,12 @@ class UnitsDeliveryEvent:
) )
def find_ground_unit_source(self, game: Game) -> Optional[ControlPoint]: 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. # Fast path if the destination is a valid source.
if self.destination.can_recruit_ground_units(game): if self.destination.can_recruit_ground_units(game):
return self.destination return self.destination

View File

@ -329,6 +329,11 @@ class ControlPoint(MissionTarget, ABC):
if not game.settings.enable_new_ground_unit_recruitment: if not game.settings.enable_new_ground_unit_recruitment:
return True 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 return self.has_factory
def has_ground_unit_source(self, game: Game) -> bool: def has_ground_unit_source(self, game: Game) -> bool: