Limit budynków na planecie
This commit is contained in:
parent
e12d39664e
commit
127eb90018
@ -26,7 +26,8 @@ var resources := {}
|
|||||||
var buildings := []
|
var buildings := []
|
||||||
var bonuses = {
|
var bonuses = {
|
||||||
"total_pop_bonus": 0, # w %
|
"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
|
# słownik z ID -> stan budynku
|
||||||
|
|
||||||
|
|||||||
@ -100,6 +100,18 @@ func _create_building_buttons():
|
|||||||
btn.texture_normal = load(b_data.texture)
|
btn.texture_normal = load(b_data.texture)
|
||||||
|
|
||||||
btn.connect("pressed", Callable(self, "_on_building_pressed").bind(b_id))
|
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)
|
buildings_container.add_child(btn)
|
||||||
|
|
||||||
|
|
||||||
@ -110,6 +122,11 @@ func _on_building_pressed(b_id):
|
|||||||
|
|
||||||
var b_data = BuildingsList.BUILDINGS[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
|
# Sprawdź czy planeta ma wymagany surowiec
|
||||||
if b_data.has("resource") and b_data["resource"] != null:
|
if b_data.has("resource") and b_data["resource"] != null:
|
||||||
var required_resource = b_data["resource"]
|
var required_resource = b_data["resource"]
|
||||||
|
|||||||
@ -18,14 +18,14 @@ const TECHNOLOGIES = {
|
|||||||
},
|
},
|
||||||
"hydro_engineering": {
|
"hydro_engineering": {
|
||||||
"name": "Inżynieria Hydrotermalna",
|
"name": "Inżynieria Hydrotermalna",
|
||||||
"description": "Zwiększa wydobycie wody o 15%.",
|
"description": "Zwiększa wydobycie wody o 50%.",
|
||||||
"time": 10,
|
"time": 10,
|
||||||
"cost": {
|
"cost": {
|
||||||
"science": 1
|
"science": 1
|
||||||
},
|
},
|
||||||
"texture": "res://assets/tech/hydro_engineering.png",
|
"texture": "res://assets/tech/hydro_engineering.png",
|
||||||
"unlock_effects": {
|
"unlock_effects": {
|
||||||
"water_efficiency": 1.15
|
|
||||||
},
|
},
|
||||||
"requires": ["advanced_mining"]
|
"requires": ["advanced_mining"]
|
||||||
},
|
},
|
||||||
@ -40,7 +40,7 @@ const TECHNOLOGIES = {
|
|||||||
},
|
},
|
||||||
"texture": "res://assets/tech/terraforming.png",
|
"texture": "res://assets/tech/terraforming.png",
|
||||||
"unlock_effects": {
|
"unlock_effects": {
|
||||||
"water_efficiency": 1.15
|
|
||||||
},
|
},
|
||||||
"requires": ["hydro_engineering"]
|
"requires": ["hydro_engineering"]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user