From 4549d52359eab2511cef1e3edd02c41eb34394c7 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 22 Nov 2023 22:13:32 -0500 Subject: Preload all scripts in settings_screen --- Archipelago/client.gd | 12 +++++++++--- Archipelago/load.gd | 14 +++++++------- Archipelago/settings_screen.gd | 8 ++++++++ 3 files changed, 24 insertions(+), 10 deletions(-) (limited to 'Archipelago') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 40fa4db..3cb46d3 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -1,5 +1,13 @@ extends Node +var SCRIPT_doorControl +var SCRIPT_effects +var SCRIPT_location +var SCRIPT_mypainting +var SCRIPT_notifier +var SCRIPT_panel +var SCRIPT_uuid + var ap_server = "" var ap_user = "" var ap_pass = "" @@ -71,8 +79,6 @@ var _location_name_to_id = {} # LINGO only var _remote_version = {"major": 0, "minor": 0, "build": 0} -const uuid_util = preload("user://maps/Archipelago/vendor/uuid.gd") - # TODO: caching per MW/slot, reset between connections var _authenticated = false var _seed = "" @@ -518,7 +524,7 @@ func connectToRoom(): "password": ap_pass, "game": "Lingo", "name": ap_user, - "uuid": uuid_util.v4(), + "uuid": SCRIPT_uuid.v4(), "version": ap_version, "items_handling": 0b111, # always receive our items "tags": [], diff --git a/Archipelago/load.gd b/Archipelago/load.gd index b6d0fba..8360185 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd @@ -41,7 +41,7 @@ func _load(): set_gridmap_tile(-3.5, 6.5, 57.5, "MeshInstance5") var door_scene = load("res://nodes/door.tscn") - var door_script = load("user://maps/Archipelago/doorControl.gd") + var door_script = apclient.SCRIPT_doorControl var wanderer_entrance = door_scene.instance() wanderer_entrance.name = "Door_wanderer_entrance" wanderer_entrance.translation = Vector3(7.5, 5, 53) @@ -113,7 +113,7 @@ func _load(): # loaded but the panels haven't been solved from the save file yet. var gamedata = apclient.get_node("Gamedata") var panels_parent = self.get_node("Panels") - var location_script = ResourceLoader.load("user://maps/Archipelago/location.gd") + var location_script = apclient.SCRIPT_location for location_id in gamedata.panel_ids_by_location_id.keys(): if not (gamedata.classification_by_location_id[location_id] & apclient._location_classification_bit): continue @@ -296,7 +296,7 @@ func _load(): if apclient._early_color_hallways: var painting_scene = load("res://nodes/paintings/dan_L1_gate.tscn") - var mypainting_script = ResourceLoader.load("user://maps/Archipelago/mypainting.gd") + var mypainting_script = apclient.SCRIPT_mypainting var exit_painting = painting_scene.instance() exit_painting.set_name("color_exit_painting") @@ -413,7 +413,7 @@ func _load(): get_node("Doors/Naps Room Doors").add_child(fearless_door) # Set up notifiers for each achievement panel, for the tracker. - var notifier_script = ResourceLoader.load("user://maps/Archipelago/notifier.gd") + var notifier_script = apclient.SCRIPT_notifier for panel in gamedata.panels: if "achievement" in panel: var panel_node = panels_parent.get_node(panel["id"]) @@ -431,7 +431,7 @@ func _load(): # Attach a script to every panel so that we can do things like conditionally # disable them. - var panel_script = ResourceLoader.load("user://maps/Archipelago/panel.gd") + var panel_script = apclient.SCRIPT_panel for panel in gamedata.panels: var panel_node if panel["id"].begins_with("EndPanel"): @@ -462,7 +462,7 @@ func _load(): ) # Create the effects node. - var effects_script = ResourceLoader.load("user://maps/Archipelago/effects.gd") + var effects_script = apclient.SCRIPT_effects var effects = effects_script.new() effects.set_name("AP_Effects") self.add_child(effects) @@ -515,7 +515,7 @@ func instantiate_painting(name, scene): new_painting.translation = old_painting.translation new_painting.rotation = old_painting.rotation - var mypainting_script = ResourceLoader.load("user://maps/Archipelago/mypainting.gd") + var mypainting_script = apclient.SCRIPT_mypainting var mps_inst = mypainting_script.new() mps_inst.set_name("Script") diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index 3769809..213bc84 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd @@ -17,6 +17,14 @@ func _ready(): apclient_instance.name = "Archipelago" global.add_child(apclient_instance) + apclient_instance.SCRIPT_doorControl = load("user://maps/Archipelago/doorControl.gd") + apclient_instance.SCRIPT_effects = load("user://maps/Archipelago/effects.gd") + apclient_instance.SCRIPT_location = load("user://maps/Archipelago/location.gd") + apclient_instance.SCRIPT_mypainting = load("user://maps/Archipelago/mypainting.gd") + apclient_instance.SCRIPT_notifier = load("user://maps/Archipelago/notifier.gd") + apclient_instance.SCRIPT_panel = load("user://maps/Archipelago/panel.gd") + apclient_instance.SCRIPT_uuid = load("user://maps/Archipelago/vendor/uuid.gd") + var apdata = ResourceLoader.load("user://maps/Archipelago/gamedata.gd") var apdata_instance = apdata.new() apdata_instance.name = "Gamedata" -- cgit 1.4.1