Obsługa modów
This commit is contained in:
parent
042b7aea2b
commit
658f68365d
@ -2,3 +2,21 @@
|
|||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
bus/0/volume_db = 0.46499825
|
bus/0/volume_db = 0.46499825
|
||||||
|
bus/1/name = &"Music"
|
||||||
|
bus/1/solo = false
|
||||||
|
bus/1/mute = false
|
||||||
|
bus/1/bypass_fx = false
|
||||||
|
bus/1/volume_db = 0.0
|
||||||
|
bus/1/send = &"Master"
|
||||||
|
bus/2/name = &"SFX"
|
||||||
|
bus/2/solo = false
|
||||||
|
bus/2/mute = false
|
||||||
|
bus/2/bypass_fx = false
|
||||||
|
bus/2/volume_db = 0.0
|
||||||
|
bus/2/send = &"Master"
|
||||||
|
bus/3/name = &"Voices"
|
||||||
|
bus/3/solo = false
|
||||||
|
bus/3/mute = false
|
||||||
|
bus/3/bypass_fx = false
|
||||||
|
bus/3/volume_db = 0.0
|
||||||
|
bus/3/send = &"Master"
|
||||||
|
|||||||
12
mods/buildings.json
Normal file
12
mods/buildings.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"aluminium_ore_mine": {
|
||||||
|
"name": "Kopalnia rudy aluminium",
|
||||||
|
"description": "Wydobywa boksyt.",
|
||||||
|
"resource": "aluminium",
|
||||||
|
"cost": {"iron": 500, "carbon": 200, "uranium": 50},
|
||||||
|
"bonuses": {"biosfere": 0.1},
|
||||||
|
"build_time": 15.0,
|
||||||
|
"texture": "res://assets/buildings/fusion_plant.png",
|
||||||
|
"required_tech": "fusion_power"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
const BUILDINGS = {
|
var BUILDINGS = {
|
||||||
"iron_mine": {
|
"iron_mine": {
|
||||||
"name": "Iron Mine",
|
"name": "Iron Mine",
|
||||||
"description": "Pozwala wydobywać żelazo z powierzchni planety.",
|
"description": "Pozwala wydobywać żelazo z powierzchni planety.",
|
||||||
@ -74,3 +74,35 @@ const BUILDINGS = {
|
|||||||
"required_tech": null
|
"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)
|
||||||
|
|||||||
@ -41,7 +41,7 @@ func _generate_galaxy(count: int):
|
|||||||
print("Zatrzymano generowanie po znalezieniu %s systemów." % i)
|
print("Zatrzymano generowanie po znalezieniu %s systemów." % i)
|
||||||
break
|
break
|
||||||
star.get_node("Sprite2D").texture = load("res://assets/stars/s%d.png" % randi_range(1,8))
|
star.get_node("Sprite2D").texture = load("res://assets/stars/s%d.png" % randi_range(1,8))
|
||||||
add_child(star)
|
#add_child(star)
|
||||||
|
|
||||||
# generowanie planet dla danej gwiazdy
|
# generowanie planet dla danej gwiazdy
|
||||||
for j in range(star.planet_count):
|
for j in range(star.planet_count):
|
||||||
|
|||||||
@ -89,7 +89,7 @@ func colonize():
|
|||||||
add_building("iron_mine")
|
add_building("iron_mine")
|
||||||
add_building("water_purifier")
|
add_building("water_purifier")
|
||||||
add_building("terraforming_center")
|
add_building("terraforming_center")
|
||||||
add_building("residential_zone")
|
add_building("aluminium_ore_mine")
|
||||||
population = 100
|
population = 100
|
||||||
print_data()
|
print_data()
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ func _ready():
|
|||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
var total_days = int(GameData.game_time)
|
var total_days = int(GameData.game_time)
|
||||||
var numer_roku = 3980 + total_days / 365
|
var numer_roku = 2980 + total_days / 365
|
||||||
var day_of_year = total_days % 365
|
var day_of_year = total_days % 365
|
||||||
var dzien_cykliczny: int
|
var dzien_cykliczny: int
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user