From 0918549cfbc25e738b472c12c39e674e972bbb54 Mon Sep 17 00:00:00 2001 From: Thefeli73 Date: Sun, 4 Oct 2020 03:17:11 +0200 Subject: [PATCH] build structure function (working ish?) and develop society to test it --- main.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 38dd35c..321ad1a 100644 --- a/main.py +++ b/main.py @@ -168,7 +168,36 @@ def something_needs_attention(): pass def develop_society(): - pass + #state = game_layer.game_state + if len(game_layer.game_state.residences) < 1: + build("Apartments") + elif False: + pass + else: + game_layer.wait() + +def build(structure): + print("Building " + structure) + state = game_layer.game_state + global building_under_construction + for i in range(len(availableTiles)): + if isinstance(availableTiles[i], tuple): + game_layer.place_foundation(availableTiles[i], structure) + for j in range(len(state.residences)): + building = state.residences[j] + coords_to_check = (building.X, building.Y) + if coords_to_check == availableTiles[i]: + availableTiles[i] = building + building_under_construction = (building.X,building.Y) + return True + for j in range(len(state.utilities)): + building = state.utilities[j] + coords_to_check = (building.X, building.Y) + if coords_to_check == availableTiles[i]: + availableTiles[i] = building + building_under_construction = (building.X,building.Y) + return True + if __name__ == "__main__": main()