From a9ce9a96780b169e72b98c06fed512be213a139f Mon Sep 17 00:00:00 2001 From: Thefeli73 Date: Mon, 5 Oct 2020 19:54:12 +0200 Subject: [PATCH] update construction status faster --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index d1633d1..1985ce9 100644 --- a/main.py +++ b/main.py @@ -151,9 +151,13 @@ def something_needs_attention(): elif building_under_construction is not None: #finish construction if (len(state.residences)-1 >= building_under_construction[2]) and (state.residences[building_under_construction[2]].build_progress < 100): game_layer.build((building_under_construction[0], building_under_construction[1])) + if not state.residences[building_under_construction[2]].build_progress < 100: + building_under_construction = None return True elif (len(state.utilities)-1 >= building_under_construction[2]) and (state.utilities[building_under_construction[2]].build_progress < 100): game_layer.build((building_under_construction[0], building_under_construction[1])) + if not state.residences[building_under_construction[2]].build_progress < 100: + building_under_construction = None return True else: building_under_construction = None @@ -210,8 +214,8 @@ def optimizeAvailableTiles(): print("average x,y: " + str(average_x) + ", " + str(average_y)) def build(structure): - print("Building " + structure) global building_under_construction, rounds_between_energy, state + print("Building " + structure) for i in range(len(availableTiles)): if isinstance(availableTiles[i], tuple): game_layer.place_foundation(availableTiles[i], structure)