109 lines
2.5 KiB
GDScript
109 lines
2.5 KiB
GDScript
extends Node
|
|
|
|
var BUILDINGS = {
|
|
"iron_mine": {
|
|
"name": "Iron Mine",
|
|
"description": "Pozwala wydobywać żelazo z powierzchni planety.",
|
|
"resource": "iron",
|
|
"cost": {"iron": 100, "carbon": 50},
|
|
"bonuses": {
|
|
|
|
},
|
|
"build_time": 10.0,
|
|
"texture": "res://assets/buildings/iron_mine.png",
|
|
"required_tech": null
|
|
},
|
|
"water_purifier": {
|
|
"name": "Water Purifier",
|
|
"description": "Pozwala wydobywać i oczyszczać wodę do użytku kolonii.",
|
|
"resource": "water",
|
|
"cost": {"iron": 80, "carbon": 40},
|
|
"bonuses": {
|
|
|
|
},
|
|
"build_time": 8.0,
|
|
"texture": "res://assets/buildings/water_purifier.png",
|
|
"required_tech": null
|
|
},
|
|
"copper_mine": {
|
|
"name": "Copper Mine",
|
|
"description": "Pozwala wydobywać miedź.",
|
|
"resource": "copper",
|
|
"cost": {"iron": 80, "carbon": 40},
|
|
"bonuses": {
|
|
|
|
},
|
|
"build_time": 20.0,
|
|
"texture": "res://assets/buildings/copper_mine.png",
|
|
"required_tech": null
|
|
},
|
|
"uran_mine": {
|
|
"name": "Uran Mine",
|
|
"description": "Pozwala wydobywać uran.",
|
|
"resource": "uranium",
|
|
"cost": {"iron": 80, "carbon": 40},
|
|
"bonuses": {
|
|
|
|
},
|
|
"build_time": 5.0,
|
|
"texture": "res://assets/buildings/uran_mine.png",
|
|
"required_tech": null
|
|
},
|
|
"residential_zone": {
|
|
"name": "Residential Zone",
|
|
"description": "Zwiększa limit populacji",
|
|
"bonuses": {
|
|
"total_pop_bonus": 25
|
|
},
|
|
"resource": null,
|
|
"cost": {"iron": 80, "carbon": 40},
|
|
"build_time": 5.0,
|
|
"texture": "res://assets/buildings/residential_zone.png",
|
|
"required_tech": null
|
|
},
|
|
"terraforming_center": {
|
|
"name": "Terraforming Center",
|
|
"description": "Zwiększa limit populacji",
|
|
"bonuses": {
|
|
"biosfere": 0.5
|
|
},
|
|
"resource": null,
|
|
"cost": {"iron": 80, "carbon": 40},
|
|
"build_time": 5.0,
|
|
"texture": "res://assets/buildings/terraforming_center.png",
|
|
"required_tech": null
|
|
}
|
|
}
|
|
|
|
|
|
func _ready():
|
|
_load_mod_buildings()
|
|
|
|
|
|
func _load_mod_buildings():
|
|
var mod_path = "res://mods/buildings.json"
|
|
|
|
if not FileAccess.file_exists(mod_path):
|
|
print("Brak pliku modów: ", mod_path)
|
|
return
|
|
|
|
var file = FileAccess.open(mod_path, FileAccess.READ)
|
|
if file == null:
|
|
print("Nie można otworzyć pliku modów:", mod_path)
|
|
return
|
|
|
|
var content = file.get_as_text()
|
|
file.close()
|
|
|
|
var parsed = JSON.parse_string(content)
|
|
if parsed == null or typeof(parsed) != TYPE_DICTIONARY:
|
|
print("Błąd: niepoprawny format JSON w", mod_path)
|
|
return
|
|
|
|
for key in parsed.keys():
|
|
if not BUILDINGS.has(key):
|
|
BUILDINGS[key] = parsed[key]
|
|
print("Dodano budynek z moda:", key)
|
|
else:
|
|
print("Pominięto (już istnieje):", key)
|