about summary refs log tree commit diff stats
path: root/Archipelago
diff options
context:
space:
mode:
Diffstat (limited to 'Archipelago')
-rw-r--r--Archipelago/client.gd6
-rw-r--r--Archipelago/load.gd6
-rw-r--r--Archipelago/multiplayer.gd20
-rw-r--r--Archipelago/settings_buttons.gd1
-rw-r--r--Archipelago/settings_screen.gd6
5 files changed, 35 insertions, 4 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 96e6d41..cdae2d8 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -3,6 +3,7 @@ extends Node
3var SCRIPT_doorControl 3var SCRIPT_doorControl
4var SCRIPT_effects 4var SCRIPT_effects
5var SCRIPT_location 5var SCRIPT_location
6var SCRIPT_multiplayer
6var SCRIPT_mypainting 7var SCRIPT_mypainting
7var SCRIPT_notifier 8var SCRIPT_notifier
8var SCRIPT_panel 9var SCRIPT_panel
@@ -12,6 +13,7 @@ var ap_server = ""
12var ap_user = "" 13var ap_user = ""
13var ap_pass = "" 14var ap_pass = ""
14var confusify_world = false 15var confusify_world = false
16var enable_multiplayer = false
15 17
16const my_version = "0.15.1" 18const my_version = "0.15.1"
17const ap_version = {"major": 0, "minor": 4, "build": 0, "class": "Version"} 19const ap_version = {"major": 0, "minor": 4, "build": 0, "class": "Version"}
@@ -137,6 +139,8 @@ func _init():
137 _datapackages = data[3] 139 _datapackages = data[3]
138 if data.size() > 4: 140 if data.size() > 4:
139 confusify_world = data[4] 141 confusify_world = data[4]
142 if data.size() > 5:
143 enable_multiplayer = data[5]
140 144
141 processDatapackages() 145 processDatapackages()
142 146
@@ -431,7 +435,7 @@ func saveSettings():
431 var file = File.new() 435 var file = File.new()
432 file.open("user://settings/archipelago", File.WRITE) 436 file.open("user://settings/archipelago", File.WRITE)
433 437
434 var data = [ap_server, ap_user, ap_pass, _datapackages, confusify_world] 438 var data = [ap_server, ap_user, ap_pass, _datapackages, confusify_world, enable_multiplayer]
435 file.store_var(data, true) 439 file.store_var(data, true)
436 file.close() 440 file.close()
437 441
diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 550ae1f..f536352 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd
@@ -471,6 +471,12 @@ func _load():
471 effects.set_name("AP_Effects") 471 effects.set_name("AP_Effects")
472 self.add_child(effects) 472 self.add_child(effects)
473 473
474 # Create the multiplayer node, if needed.
475 if apclient.enable_multiplayer:
476 var multiplayer_node = apclient.SCRIPT_multiplayer.new()
477 multiplayer_node.ghost_mode = true
478 add_child(multiplayer_node)
479
474 # Hook up the scene to be able to handle connection failures. 480 # Hook up the scene to be able to handle connection failures.
475 apclient.connect("could_not_connect", self, "archipelago_disconnected") 481 apclient.connect("could_not_connect", self, "archipelago_disconnected")
476 482
diff --git a/Archipelago/multiplayer.gd b/Archipelago/multiplayer.gd new file mode 100644 index 0000000..07b63b8 --- /dev/null +++ b/Archipelago/multiplayer.gd
@@ -0,0 +1,20 @@
1extends "res://scripts/multiplayer.gd"
2
3
4func _request_lobby_list():
5 var apclient = global.get_node("Archipelago")
6 Steam.addRequestLobbyListStringFilter(
7 "archipelago", apclient._seed, Steam.LOBBY_COMPARISON_EQUAL
8 )
9
10 ._request_lobby_list()
11
12
13func _on_lobby_created(result: int, lobby_id: int) -> void:
14 if result != Steam.RESULT_OK:
15 return
16
17 var apclient = global.get_node("Archipelago")
18 var _ignore = Steam.setLobbyData(lobby_id, "archipelago", apclient._seed)
19
20 ._on_lobby_created(result, lobby_id)
diff --git a/Archipelago/settings_buttons.gd b/Archipelago/settings_buttons.gd index a6bba2a..e9cff9d 100644 --- a/Archipelago/settings_buttons.gd +++ b/Archipelago/settings_buttons.gd
@@ -13,6 +13,7 @@ func _connect_pressed():
13 apclient.ap_user = self.get_parent().get_node("player_box").text 13 apclient.ap_user = self.get_parent().get_node("player_box").text
14 apclient.ap_pass = self.get_parent().get_node("password_box").text 14 apclient.ap_pass = self.get_parent().get_node("password_box").text
15 apclient.confusify_world = self.get_parent().get_node("confusing_box").pressed 15 apclient.confusify_world = self.get_parent().get_node("confusing_box").pressed
16 apclient.enable_multiplayer = self.get_parent().get_node("multiplayer_box").pressed
16 apclient.saveSettings() 17 apclient.saveSettings()
17 18
18 apclient.connectToServer() 19 apclient.connectToServer()
diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index a3305e5..8a81c4d 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd
@@ -20,6 +20,7 @@ func _ready():
20 apclient_instance.SCRIPT_doorControl = load("user://maps/Archipelago/doorControl.gd") 20 apclient_instance.SCRIPT_doorControl = load("user://maps/Archipelago/doorControl.gd")
21 apclient_instance.SCRIPT_effects = load("user://maps/Archipelago/effects.gd") 21 apclient_instance.SCRIPT_effects = load("user://maps/Archipelago/effects.gd")
22 apclient_instance.SCRIPT_location = load("user://maps/Archipelago/location.gd") 22 apclient_instance.SCRIPT_location = load("user://maps/Archipelago/location.gd")
23 apclient_instance.SCRIPT_multiplayer = load("user://maps/Archipelago/multiplayer.gd")
23 apclient_instance.SCRIPT_mypainting = load("user://maps/Archipelago/mypainting.gd") 24 apclient_instance.SCRIPT_mypainting = load("user://maps/Archipelago/mypainting.gd")
24 apclient_instance.SCRIPT_notifier = load("user://maps/Archipelago/notifier.gd") 25 apclient_instance.SCRIPT_notifier = load("user://maps/Archipelago/notifier.gd")
25 apclient_instance.SCRIPT_panel = load("user://maps/Archipelago/panel.gd") 26 apclient_instance.SCRIPT_panel = load("user://maps/Archipelago/panel.gd")
@@ -52,6 +53,7 @@ func _ready():
52 self.get_node("Panel/player_box").text = apclient.ap_user 53 self.get_node("Panel/player_box").text = apclient.ap_user
53 self.get_node("Panel/password_box").text = apclient.ap_pass 54 self.get_node("Panel/password_box").text = apclient.ap_pass
54 self.get_node("Panel/confusing_box").pressed = apclient.confusify_world 55 self.get_node("Panel/confusing_box").pressed = apclient.confusify_world
56 self.get_node("Panel/multiplayer_box").pressed = apclient.enable_multiplayer
55 57
56 # Show client version. 58 # Show client version.
57 self.get_node("Panel/title").text = "ARCHIPELAGO (%s)" % apclient.my_version 59 self.get_node("Panel/title").text = "ARCHIPELAGO (%s)" % apclient.my_version
@@ -79,9 +81,7 @@ func installScriptExtension(childScript: Resource):
79 81
80 var parentScript = childScript.get_base_script() 82 var parentScript = childScript.get_base_script()
81 var parentScriptPath = parentScript.resource_path 83 var parentScriptPath = parentScript.resource_path
82 global._print( 84 global._print("ModLoader: Installing script extension over %s" % parentScriptPath)
83 "ModLoader: Installing script extension over %s" % parentScriptPath
84 )
85 childScript.take_over_path(parentScriptPath) 85 childScript.take_over_path(parentScriptPath)
86 86
87 87