Make buildings give max pop
This commit is contained in:
parent
f75456cfde
commit
21720ecc11
2 changed files with 9 additions and 3 deletions
|
@ -105,13 +105,19 @@ func place_building():
|
||||||
"key": Persister.get_value("building_key"),
|
"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"):
|
if cost.has("wood"):
|
||||||
Persister.change_value("wood", -int(cost.wood))
|
Persister.change_value("wood", -int(cost.wood))
|
||||||
if cost.has("stone"):
|
if cost.has("stone"):
|
||||||
Persister.change_value("stone", -int(cost.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)
|
Persister.persist_data("drag_mode", false)
|
||||||
|
|
||||||
|
|
||||||
|
|
4
ui.gd
4
ui.gd
|
@ -3,8 +3,8 @@ extends CanvasLayer
|
||||||
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
Persister.persist_data("wood", 5)
|
Persister.persist_data("wood", 50)
|
||||||
Persister.persist_data("stone", 5)
|
Persister.persist_data("stone", 50)
|
||||||
Persister.persist_data("population", 3)
|
Persister.persist_data("population", 3)
|
||||||
Persister.persist_data("max_population", 3)
|
Persister.persist_data("max_population", 3)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue