From ca777bcebb3dce39e2c66097821a01eabfc9d0de Mon Sep 17 00:00:00 2001 From: Khopa Date: Sat, 7 Nov 2020 16:23:46 +0100 Subject: [PATCH] Tuned base defense location generator for big airbases. (Some would end up without any base defenses before) --- theater/start_generator.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/theater/start_generator.py b/theater/start_generator.py index 9e679f6c..602470aa 100644 --- a/theater/start_generator.py +++ b/theater/start_generator.py @@ -382,7 +382,17 @@ class AirbaseGroundObjectGenerator(ControlPointGroundObjectGenerator): def generate_sam(self, index: int) -> None: position = find_location(True, self.control_point.position, - self.game.theater, 800, 3200, [], True) + self.game.theater, 400, 3200, [], True) + + # Retry once, searching a bit further (On some big airbase, 3200 is too short (Ex : Incirlik)) + # But searching farther on every base would be problematic, as some base defense units + # would end up very far away from small airfields. + # (I know it's not good for performance, but this is only done on campaign generation) + # TODO : Make the whole process less stupid with preset possible positions for each airbase + if position is None: + position = find_location(True, self.control_point.position, + self.game.theater, 3200, 4800, [], True) + if position is None: logging.error("Could not find position for " f"{self.control_point} base defense")