From 49209d18a4a5a78f5ad997b948d7812a22e9da4e Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 4 Jan 2024 13:36:37 -0500 Subject: Stack/double proxying --- Archipelago/load.gd | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'Archipelago/load.gd') diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 2835bb4..409b8c8 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd @@ -22,6 +22,7 @@ func _load(): global._print("Hooked Load Start") var apclient = global.get_node("Archipelago") + var panels_parent = self.get_node("Panels") # Override the YOU panel with the AP slot name. if self.get_node_or_null("Panels/Color Arrow Room/Panel_you") != null: @@ -117,7 +118,6 @@ func _load(): # This is the best time to create the location nodes, since the map is now # 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 = 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): @@ -437,6 +437,27 @@ func _load(): script_instance.name = "Hunt_Notifier" script_instance.key = "Hunt|%d" % panel["loc"] panel_node.add_child(script_instance) + + # Make stack/double puzzles into proxies, unless panelsanity is on. + if apclient._location_classification_bit != apclient.kCLASSIFICATION_LOCAL_INSANITY: + var proxyscript = load("res://scripts/panelProxy.gd") + + var extradata_proxies = apclient.get_node("Extradata").proxies + for truepanel in extradata_proxies: + var proxies = extradata_proxies[truepanel] + for proxypanel in proxies: + var proxynode = panels_parent.get_node(proxypanel) + var oldparent = proxynode.get_parent() + oldparent.remove_child(proxynode) + var oldtext = proxynode.text + var oldanswer = proxynode.answer + proxynode.set_script(proxyscript) + proxynode.text = oldtext + proxynode.answer = oldanswer + proxynode.proxied_panels = ["../../%s" % truepanel] + proxynode.exact_proxy = true + proxynode.request_ready() + oldparent.add_child(proxynode) # Attach a script to every panel so that we can do things like conditionally # disable them. -- cgit 1.4.1