about summary refs log tree commit diff stats
path: root/Archipelago/settings_screen.gd
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-04-13 18:09:30 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-04-13 18:09:30 -0400
commit617e31fce21eb18d1ffccdc9c377d25535157351 (patch)
treec1fbcee75a67062663a0fe1ff00f4be1db382be1 /Archipelago/settings_screen.gd
parent679bba3b46ea30a329c617b3cc47645d540a261f (diff)
downloadlingo-archipelago-617e31fce21eb18d1ffccdc9c377d25535157351.tar.gz
lingo-archipelago-617e31fce21eb18d1ffccdc9c377d25535157351.tar.bz2
lingo-archipelago-617e31fce21eb18d1ffccdc9c377d25535157351.zip
It WORKS!
You can send checks and receive door items!
Diffstat (limited to 'Archipelago/settings_screen.gd')
-rw-r--r--Archipelago/settings_screen.gd26
1 files changed, 26 insertions, 0 deletions
diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index 0854a8b..9624693 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd
@@ -13,6 +13,11 @@ func _ready():
13 apclient_instance.name = "Archipelago" 13 apclient_instance.name = "Archipelago"
14 global.add_child(apclient_instance) 14 global.add_child(apclient_instance)
15 15
16 # Let's also inject any scripts we need to inject now.
17 installScriptExtension("user://maps/Archipelago/doorControl.gd")
18 installScriptExtension("user://maps/Archipelago/load.gd")
19 installScriptExtension("user://maps/Archipelago/painting_eye.gd")
20
16 global.get_node("Archipelago").connect("client_connected", self, "connectionSuccessful") 21 global.get_node("Archipelago").connect("client_connected", self, "connectionSuccessful")
17 22
18 # Populate textboxes with AP settings. 23 # Populate textboxes with AP settings.
@@ -21,6 +26,27 @@ func _ready():
21 self.get_node("Panel/password_box").text = global.get_node("Archipelago").ap_pass 26 self.get_node("Panel/password_box").text = global.get_node("Archipelago").ap_pass
22 27
23 28
29# Adapted from https://gitlab.com/Delta-V-Modding/Mods/-/blob/main/game/ModLoader.gd
30func installScriptExtension(childScriptPath: String):
31 var childScript = ResourceLoader.load(childScriptPath)
32
33 # Force Godot to compile the script now.
34 # We need to do this here to ensure that the inheritance chain is
35 # properly set up, and multiple mods can chain-extend the same
36 # class multiple times.
37 # This is also needed to make Godot instantiate the extended class
38 # when creating singletons.
39 # The actual instance is thrown away.
40 childScript.new()
41
42 var parentScript = childScript.get_base_script()
43 var parentScriptPath = parentScript.resource_path
44 global._print(
45 "ModLoader: Installing script extension: %s <- %s" % [parentScriptPath, childScriptPath]
46 )
47 childScript.take_over_path(parentScriptPath)
48
49
24func connectionSuccessful(): 50func connectionSuccessful():
25 # Switch to LL1 51 # Switch to LL1
26 Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) 52 Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)