diff options
Diffstat (limited to 'apworld')
-rw-r--r-- | apworld/__init__.py | 2 | ||||
-rw-r--r-- | apworld/client/effects.gd | 32 | ||||
-rw-r--r-- | apworld/client/main.gd | 5 | ||||
-rw-r--r-- | apworld/client/manager.gd | 24 | ||||
-rw-r--r-- | apworld/context.py | 7 | ||||
-rw-r--r-- | apworld/options.py | 3 | ||||
-rw-r--r-- | apworld/player_logic.py | 2 |
7 files changed, 68 insertions, 7 deletions
diff --git a/apworld/__init__.py b/apworld/__init__.py index 96f6804..1d12050 100644 --- a/apworld/__init__.py +++ b/apworld/__init__.py | |||
@@ -11,7 +11,7 @@ from .options import Lingo2Options | |||
11 | from .player_logic import Lingo2PlayerLogic | 11 | from .player_logic import Lingo2PlayerLogic |
12 | from .regions import create_regions, shuffle_entrances, connect_ports_from_ut | 12 | from .regions import create_regions, shuffle_entrances, connect_ports_from_ut |
13 | from .static_logic import Lingo2StaticLogic | 13 | from .static_logic import Lingo2StaticLogic |
14 | from ..LauncherComponents import Component, Type, components, launch as launch_component, icon_paths | 14 | from worlds.LauncherComponents import Component, Type, components, launch as launch_component, icon_paths |
15 | 15 | ||
16 | 16 | ||
17 | class Lingo2WebWorld(WebWorld): | 17 | class Lingo2WebWorld(WebWorld): |
diff --git a/apworld/client/effects.gd b/apworld/client/effects.gd new file mode 100644 index 0000000..9dc1dd8 --- /dev/null +++ b/apworld/client/effects.gd | |||
@@ -0,0 +1,32 @@ | |||
1 | extends CanvasLayer | ||
2 | |||
3 | var _label | ||
4 | |||
5 | var _disconnected = false | ||
6 | |||
7 | |||
8 | func _ready(): | ||
9 | _label = Label.new() | ||
10 | _label.name = "Label" | ||
11 | _label.offset_left = 20 | ||
12 | _label.offset_top = 20 | ||
13 | _label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT | ||
14 | _label.vertical_alignment = VERTICAL_ALIGNMENT_TOP | ||
15 | _label.theme = preload("res://assets/themes/baseUI.tres") | ||
16 | _label.add_theme_font_size_override("font_size", 36) | ||
17 | add_child(_label) | ||
18 | |||
19 | |||
20 | func set_connection_lost(arg): | ||
21 | _disconnected = arg | ||
22 | |||
23 | _update_label() | ||
24 | |||
25 | |||
26 | func _update_label(): | ||
27 | var text = [] | ||
28 | |||
29 | if _disconnected: | ||
30 | text.append("Disconnected from multiworld.") | ||
31 | |||
32 | _label.text = "\n".join(text) | ||
diff --git a/apworld/client/main.gd b/apworld/client/main.gd index bbefc02..e1f9610 100644 --- a/apworld/client/main.gd +++ b/apworld/client/main.gd | |||
@@ -66,6 +66,11 @@ func _ready(): | |||
66 | messages_instance.SCRIPT_rainbowText = runtime.load_script("rainbowText.gd") | 66 | messages_instance.SCRIPT_rainbowText = runtime.load_script("rainbowText.gd") |
67 | global.add_child(messages_instance) | 67 | global.add_child(messages_instance) |
68 | 68 | ||
69 | var effects_script = runtime.load_script("effects.gd") | ||
70 | var effects_instance = effects_script.new() | ||
71 | effects_instance.name = "Effects" | ||
72 | global.add_child(effects_instance) | ||
73 | |||
69 | var textclient_script = runtime.load_script("textclient.gd") | 74 | var textclient_script = runtime.load_script("textclient.gd") |
70 | var textclient_instance = textclient_script.new() | 75 | var textclient_instance = textclient_script.new() |
71 | textclient_instance.name = "Textclient" | 76 | textclient_instance.name = "Textclient" |
diff --git a/apworld/client/manager.gd b/apworld/client/manager.gd index a5b9db0..9212233 100644 --- a/apworld/client/manager.gd +++ b/apworld/client/manager.gd | |||
@@ -28,6 +28,7 @@ var _item_locks = {} | |||
28 | var _inverse_item_locks = {} | 28 | var _inverse_item_locks = {} |
29 | var _held_letters = {} | 29 | var _held_letters = {} |
30 | var _letters_setup = false | 30 | var _letters_setup = false |
31 | var _already_connected = false | ||
31 | 32 | ||
32 | const kSHUFFLE_LETTERS_VANILLA = 0 | 33 | const kSHUFFLE_LETTERS_VANILLA = 0 |
33 | const kSHUFFLE_LETTERS_UNLOCKED = 1 | 34 | const kSHUFFLE_LETTERS_UNLOCKED = 1 |
@@ -178,6 +179,7 @@ func connectToServer(): | |||
178 | _location_scouts = {} | 179 | _location_scouts = {} |
179 | _letters_setup = false | 180 | _letters_setup = false |
180 | _held_letters = {} | 181 | _held_letters = {} |
182 | _already_connected = false | ||
181 | 183 | ||
182 | client.connectToServer(ap_server, ap_user, ap_pass) | 184 | client.connectToServer(ap_server, ap_user, ap_pass) |
183 | 185 | ||
@@ -187,6 +189,11 @@ func getSaveFileName(): | |||
187 | 189 | ||
188 | 190 | ||
189 | func disconnect_from_ap(): | 191 | func disconnect_from_ap(): |
192 | _already_connected = false | ||
193 | |||
194 | var effects = global.get_node("Effects") | ||
195 | effects.set_connection_lost(false) | ||
196 | |||
190 | client.disconnect_from_ap() | 197 | client.disconnect_from_ap() |
191 | 198 | ||
192 | 199 | ||
@@ -353,12 +360,29 @@ func _on_checked_worldports_updated(): | |||
353 | func _client_could_not_connect(message): | 360 | func _client_could_not_connect(message): |
354 | could_not_connect.emit(message) | 361 | could_not_connect.emit(message) |
355 | 362 | ||
363 | if global.loaded: | ||
364 | var effects = global.get_node("Effects") | ||
365 | effects.set_connection_lost(true) | ||
366 | |||
367 | var messages = global.get_node("Messages") | ||
368 | messages.showMessage("Connection to multiworld lost.") | ||
369 | |||
356 | 370 | ||
357 | func _client_connect_status(message): | 371 | func _client_connect_status(message): |
358 | connect_status.emit(message) | 372 | connect_status.emit(message) |
359 | 373 | ||
360 | 374 | ||
361 | func _client_connected(slot_data): | 375 | func _client_connected(slot_data): |
376 | var effects = global.get_node("Effects") | ||
377 | effects.set_connection_lost(false) | ||
378 | |||
379 | if _already_connected: | ||
380 | var messages = global.get_node("Messages") | ||
381 | messages.showMessage("Reconnected to multiworld!") | ||
382 | return | ||
383 | |||
384 | _already_connected = true | ||
385 | |||
362 | var gamedata = global.get_node("Gamedata") | 386 | var gamedata = global.get_node("Gamedata") |
363 | 387 | ||
364 | _localdata_file = "user://archipelago_data/%s_%d" % [client._seed, client._slot] | 388 | _localdata_file = "user://archipelago_data/%s_%d" % [client._seed, client._slot] |
diff --git a/apworld/context.py b/apworld/context.py index 63645a4..e78ce35 100644 --- a/apworld/context.py +++ b/apworld/context.py | |||
@@ -254,11 +254,8 @@ class Lingo2ClientContext(CommonContext): | |||
254 | return ui | 254 | return ui |
255 | 255 | ||
256 | async def server_auth(self, password_requested: bool = False): | 256 | async def server_auth(self, password_requested: bool = False): |
257 | if password_requested: | 257 | if password_requested and not self.password: |
258 | if self.password is None: | 258 | self.manager.game_ctx.send_connection_refused("Invalid password.") |
259 | self.manager.game_ctx.send_connection_refused("Slot requires a password.") | ||
260 | else: | ||
261 | self.manager.game_ctx.send_connection_refused("Invalid password.") | ||
262 | else: | 259 | else: |
263 | self.auth = self.username | 260 | self.auth = self.username |
264 | await self.send_connect() | 261 | await self.send_connect() |
diff --git a/apworld/options.py b/apworld/options.py index 795010a..3d7c9a5 100644 --- a/apworld/options.py +++ b/apworld/options.py | |||
@@ -58,6 +58,9 @@ class ShuffleWorldports(Toggle): | |||
58 | order to change maps. This does not affect paintings, panels that teleport you, or certain other special connections | 58 | order to change maps. This does not affect paintings, panels that teleport you, or certain other special connections |
59 | like the one between The Shop and Control Center. Connections that depend on placing letters in keyholders are also | 59 | like the one between The Shop and Control Center. Connections that depend on placing letters in keyholders are also |
60 | currently not shuffled. | 60 | currently not shuffled. |
61 | |||
62 | NOTE: It is highly recommended that you turn on Shuffle Control Center Colors when using Shuffle Worldports. Not | ||
63 | doing so runs the risk of creating an unfinishable seed. | ||
61 | """ | 64 | """ |
62 | display_name = "Shuffle Worldports" | 65 | display_name = "Shuffle Worldports" |
63 | 66 | ||
diff --git a/apworld/player_logic.py b/apworld/player_logic.py index 5be066d..3ed1bb1 100644 --- a/apworld/player_logic.py +++ b/apworld/player_logic.py | |||
@@ -4,7 +4,7 @@ from .generated import data_pb2 as data_pb2 | |||
4 | from .items import SYMBOL_ITEMS | 4 | from .items import SYMBOL_ITEMS |
5 | from typing import TYPE_CHECKING, NamedTuple | 5 | from typing import TYPE_CHECKING, NamedTuple |
6 | 6 | ||
7 | from .options import VictoryCondition, ShuffleLetters, CyanDoorBehavior | 7 | from .options import ShuffleLetters, CyanDoorBehavior |
8 | 8 | ||
9 | if TYPE_CHECKING: | 9 | if TYPE_CHECKING: |
10 | from . import Lingo2World | 10 | from . import Lingo2World |