From 2d51499751b0ea8a2ae0110bb1b3e90856f415ee Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Wed, 26 Jan 2022 17:30:05 +0100 Subject: modules --- scripts/load_turrets.gd | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'scripts/load_turrets.gd') diff --git a/scripts/load_turrets.gd b/scripts/load_turrets.gd index e79a68c..10c6e44 100644 --- a/scripts/load_turrets.gd +++ b/scripts/load_turrets.gd @@ -4,6 +4,7 @@ var saveload : Node var info : Dictionary var models : Dictionary +var modules : Dictionary var thumbnails : Dictionary var loaded : bool = false @@ -13,6 +14,7 @@ func _ready(): get_saveload() load_models() load_info() + load_modules() load_thumbnails() emit_signal("done_loading") loaded = true @@ -58,3 +60,13 @@ func load_thumbnails(): var files = saveload.parse_dir("res://assets/textures/thumbnails/turrets", ".png") for turr in files: thumbnails[turr] = load("res://assets/textures/thumbnails/turrets/" + turr) + +func load_modules(): + modules.clear() + var files = saveload.parse_dir("res://assets/json", ".json") + for f in files: + if f != "modules.json": continue + var parsed = saveload.load_parse_json("res://assets/json/" + f) + if parsed != null: + for tin in parsed: + modules[tin.name] = tin -- cgit v1.2.3-54-g00ecf