Limit budynków na planecie

This commit is contained in:
Tomasz Boruc 2025-11-20 21:03:03 +01:00
parent e12d39664e
commit 127eb90018
3 changed files with 22 additions and 4 deletions

View File

@ -26,7 +26,8 @@ var resources := {}
var buildings := []
var bonuses = {
"total_pop_bonus": 0, # w %
"biosfere": 0.0, # mnożnik bazowy
"biosfere": 0.0,
"water_bonus": 0.0, # mnożnik bazowy
}
# słownik z ID -> stan budynku

View File

@ -100,6 +100,18 @@ func _create_building_buttons():
btn.texture_normal = load(b_data.texture)
btn.connect("pressed", Callable(self, "_on_building_pressed").bind(b_id))
var cost_text = ""
for cost_name in b_data.cost.keys():
cost_text += "%s: %d " % [tr(cost_name), b_data.cost[cost_name]]
btn.tooltip_text = "%s\n%s\n%s %s" % [
tr(b_data.name),
tr(b_data.description),
tr("Koszt:"),
cost_text.strip_edges()
]
buildings_container.add_child(btn)
@ -110,6 +122,11 @@ func _on_building_pressed(b_id):
var b_data = BuildingsList.BUILDINGS[b_id]
if planet.buildings.size() >= planet.size*2:
print("Planeta osiągnęła maksymalną liczbę budynków!")
return
# Sprawdź czy planeta ma wymagany surowiec
if b_data.has("resource") and b_data["resource"] != null:
var required_resource = b_data["resource"]

View File

@ -18,14 +18,14 @@ const TECHNOLOGIES = {
},
"hydro_engineering": {
"name": "Inżynieria Hydrotermalna",
"description": "Zwiększa wydobycie wody o 15%.",
"description": "Zwiększa wydobycie wody o 50%.",
"time": 10,
"cost": {
"science": 1
},
"texture": "res://assets/tech/hydro_engineering.png",
"unlock_effects": {
"water_efficiency": 1.15
},
"requires": ["advanced_mining"]
},
@ -40,7 +40,7 @@ const TECHNOLOGIES = {
},
"texture": "res://assets/tech/terraforming.png",
"unlock_effects": {
"water_efficiency": 1.15
},
"requires": ["hydro_engineering"]
}