diff --git a/BuildingLevel.gd b/BuildingLevel.gd index 0032be0..2062aef 100644 --- a/BuildingLevel.gd +++ b/BuildingLevel.gd @@ -105,12 +105,18 @@ func place_building(): "key": Persister.get_value("building_key"), } - var cost = Data.data.buildings[Persister.get_value("building_key")].cost + var build_data = Data.data.buildings[Persister.get_value("building_key")] + var cost = build_data.cost if cost.has("wood"): Persister.change_value("wood", -int(cost.wood)) if cost.has("stone"): Persister.change_value("stone", -int(cost.stone)) + + if build_data.type == "housing": + Persister.change_value("max_population", int(build_data.amount)) + building_data[tile].max_population = int(build_data.amount) + building_data[tile].population = 0 # TODO: handle overflowing pop? Persister.persist_data("drag_mode", false) diff --git a/ui.gd b/ui.gd index f47a0a1..8bd59e1 100644 --- a/ui.gd +++ b/ui.gd @@ -3,8 +3,8 @@ extends CanvasLayer @onready var animation_player: AnimationPlayer = $AnimationPlayer func _ready() -> void: - Persister.persist_data("wood", 5) - Persister.persist_data("stone", 5) + Persister.persist_data("wood", 50) + Persister.persist_data("stone", 50) Persister.persist_data("population", 3) Persister.persist_data("max_population", 3)