diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-11-28 13:19:53 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-11-28 13:19:53 -0500 |
commit | 17a51b95bd07c5291192ab6036550cb238c1ef4f (patch) | |
tree | fd426d7b352227b9f497003b087d4a36e87d1901 | |
parent | 36d849d38730c04a89efc94e9f75ccaa8c7c0dd8 (diff) | |
download | lingo-archipelago-17a51b95bd07c5291192ab6036550cb238c1ef4f.tar.gz lingo-archipelago-17a51b95bd07c5291192ab6036550cb238c1ef4f.tar.bz2 lingo-archipelago-17a51b95bd07c5291192ab6036550cb238c1ef4f.zip |
Add ghost multiplayer v0.16.0
-rw-r--r-- | Archipelago/client.gd | 6 | ||||
-rw-r--r-- | Archipelago/load.gd | 6 | ||||
-rw-r--r-- | Archipelago/multiplayer.gd | 20 | ||||
-rw-r--r-- | Archipelago/settings_buttons.gd | 1 | ||||
-rw-r--r-- | Archipelago/settings_screen.gd | 6 | ||||
-rw-r--r-- | archipelago.tscn | 10 |
6 files changed, 45 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 | |||
3 | var SCRIPT_doorControl | 3 | var SCRIPT_doorControl |
4 | var SCRIPT_effects | 4 | var SCRIPT_effects |
5 | var SCRIPT_location | 5 | var SCRIPT_location |
6 | var SCRIPT_multiplayer | ||
6 | var SCRIPT_mypainting | 7 | var SCRIPT_mypainting |
7 | var SCRIPT_notifier | 8 | var SCRIPT_notifier |
8 | var SCRIPT_panel | 9 | var SCRIPT_panel |
@@ -12,6 +13,7 @@ var ap_server = "" | |||
12 | var ap_user = "" | 13 | var ap_user = "" |
13 | var ap_pass = "" | 14 | var ap_pass = "" |
14 | var confusify_world = false | 15 | var confusify_world = false |
16 | var enable_multiplayer = false | ||
15 | 17 | ||
16 | const my_version = "0.15.1" | 18 | const my_version = "0.15.1" |
17 | const ap_version = {"major": 0, "minor": 4, "build": 0, "class": "Version"} | 19 | const 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 @@ | |||
1 | extends "res://scripts/multiplayer.gd" | ||
2 | |||
3 | |||
4 | func _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 | |||
13 | func _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 | ||
diff --git a/archipelago.tscn b/archipelago.tscn index 884cbb5..917db4e 100644 --- a/archipelago.tscn +++ b/archipelago.tscn | |||
@@ -163,5 +163,15 @@ custom_icons/checked = ExtResource( 8 ) | |||
163 | custom_icons/unchecked = ExtResource( 7 ) | 163 | custom_icons/unchecked = ExtResource( 7 ) |
164 | text = "Make world more confusing" | 164 | text = "Make world more confusing" |
165 | 165 | ||
166 | [node name="multiplayer_box" type="CheckBox" parent="Panel"] | ||
167 | margin_left = 1227.0 | ||
168 | margin_top = 461.0 | ||
169 | margin_right = 1832.0 | ||
170 | margin_bottom = 549.0 | ||
171 | custom_fonts/font = ExtResource( 6 ) | ||
172 | custom_icons/checked = ExtResource( 8 ) | ||
173 | custom_icons/unchecked = ExtResource( 7 ) | ||
174 | text = "Show other players" | ||
175 | |||
166 | [connection signal="pressed" from="Panel/connect_button" to="Panel/connect_button" method="_connect_pressed"] | 176 | [connection signal="pressed" from="Panel/connect_button" to="Panel/connect_button" method="_connect_pressed"] |
167 | [connection signal="pressed" from="Panel/quit_button" to="Panel/quit_button" method="_back_pressed"] | 177 | [connection signal="pressed" from="Panel/quit_button" to="Panel/quit_button" method="_back_pressed"] |