about summary refs log tree commit diff stats
path: root/apworld
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-09-25 14:14:22 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2025-09-25 14:14:22 -0400
commitcb2eca4fed1eb3692eaa13715f65ebcaf8472b64 (patch)
tree7d11ad1db462c0af4de9da02bde8e44899e0e282 /apworld
parent72b9d1f0952aee6e72b9478118dc99e08ff1fa54 (diff)
downloadlingo2-archipelago-cb2eca4fed1eb3692eaa13715f65ebcaf8472b64.tar.gz
lingo2-archipelago-cb2eca4fed1eb3692eaa13715f65ebcaf8472b64.tar.bz2
lingo2-archipelago-cb2eca4fed1eb3692eaa13715f65ebcaf8472b64.zip
Client can be run from zipped apworld now
Diffstat (limited to 'apworld')
-rw-r--r--apworld/__init__.py68
-rw-r--r--apworld/client/apworld_runtime.gd44
-rw-r--r--apworld/client/main.gd62
-rw-r--r--apworld/client/pauseMenu.gd2
-rw-r--r--apworld/client/run_from_apworld.tscn30
-rw-r--r--apworld/client/run_from_source.tscn3
-rw-r--r--apworld/client/settings_screen.gd153
-rw-r--r--apworld/client/settings_screen.tscn173
-rw-r--r--apworld/client/source_runtime.gd16
9 files changed, 320 insertions, 231 deletions
diff --git a/apworld/__init__.py b/apworld/__init__.py index 9d7d149..523c00c 100644 --- a/apworld/__init__.py +++ b/apworld/__init__.py
@@ -3,6 +3,7 @@ Archipelago init file for Lingo 2
3""" 3"""
4import asyncio 4import asyncio
5import os.path 5import os.path
6import pkgutil
6import subprocess 7import subprocess
7from typing import ClassVar 8from typing import ClassVar
8 9
@@ -20,29 +21,6 @@ from .version import APWORLD_VERSION
20from ..LauncherComponents import Component, Type, components 21from ..LauncherComponents import Component, Type, components
21 22
22 23
23async def run_game():
24 exe_file = settings.get_settings().lingo2_options.exe_file
25
26 subprocess.Popen(
27 [
28 exe_file,
29 "--scene",
30 Utils.local_path("worlds", "lingo2", "client", "run_from_source.tscn"),
31 "--",
32 Utils.local_path("worlds", "lingo2", "client"),
33 ],
34 cwd=os.path.dirname(exe_file),
35 )
36
37
38async def client_main():
39 Utils.async_start(run_game())
40
41
42def launch_client(*args):
43 asyncio.run(client_main())
44
45
46class Lingo2WebWorld(WebWorld): 24class Lingo2WebWorld(WebWorld):
47 rich_text_options_doc = True 25 rich_text_options_doc = True
48 theme = "grass" 26 theme = "grass"
@@ -183,6 +161,50 @@ class Lingo2World(World):
183 # we are using re_gen_passthrough over modifying the world here due to complexities with ER 161 # we are using re_gen_passthrough over modifying the world here due to complexities with ER
184 return slot_data 162 return slot_data
185 163
164
165async def run_game():
166 exe_file = settings.get_settings().lingo2_options.exe_file
167
168 if Lingo2World.zip_path is not None:
169 # This is a packaged apworld.
170 init_scene = pkgutil.get_data(__name__, "client/run_from_apworld.tscn")
171 init_path = Utils.local_path("data", "lingo2_init.tscn")
172
173 with open(init_path, "wb") as file_handle:
174 file_handle.write(init_scene)
175
176 subprocess.Popen(
177 [
178 exe_file,
179 "--scene",
180 init_path,
181 "--",
182 str(Lingo2World.zip_path.absolute()),
183 ],
184 cwd=os.path.dirname(exe_file),
185 )
186 else:
187 # The world is unzipped and being run in source.
188 subprocess.Popen(
189 [
190 exe_file,
191 "--scene",
192 Utils.local_path("worlds", "lingo2", "client", "run_from_source.tscn"),
193 "--",
194 Utils.local_path("worlds", "lingo2", "client"),
195 ],
196 cwd=os.path.dirname(exe_file),
197 )
198
199
200async def client_main():
201 Utils.async_start(run_game())
202
203
204def launch_client(*args):
205 asyncio.run(client_main())
206
207
186component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client, 208component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client,
187 description="Open Lingo 2.") 209 description="Open Lingo 2.")
188components.append(component) 210components.append(component)
diff --git a/apworld/client/apworld_runtime.gd b/apworld/client/apworld_runtime.gd new file mode 100644 index 0000000..faf8e0c --- /dev/null +++ b/apworld/client/apworld_runtime.gd
@@ -0,0 +1,44 @@
1extends Node
2
3var apworld_reader
4
5
6func _init(path):
7 apworld_reader = ZIPReader.new()
8 apworld_reader.open(path)
9
10
11func _get_true_path(path):
12 if path.begins_with("../"):
13 return "lingo2/%s" % path.substr(3)
14 else:
15 return "lingo2/client/%s" % path
16
17
18func load_script(path):
19 var true_path = _get_true_path(path)
20
21 var script = GDScript.new()
22 script.source_code = apworld_reader.read_file(true_path).get_string_from_utf8()
23 script.reload()
24
25 return script
26
27
28func read_path(path):
29 var true_path = _get_true_path(path)
30 return apworld_reader.read_file(true_path)
31
32
33func load_script_as_scene(path, scene_name):
34 var script = load_script(path)
35 var instance = script.new()
36 instance.name = scene_name
37
38 get_tree().unload_current_scene()
39 _load_scene.call_deferred(instance)
40
41
42func _load_scene(instance):
43 get_tree().get_root().add_child(instance)
44 get_tree().current_scene = instance
diff --git a/apworld/client/main.gd b/apworld/client/main.gd index a31eb89..cff92bc 100644 --- a/apworld/client/main.gd +++ b/apworld/client/main.gd
@@ -22,59 +22,59 @@ func _ready():
22 22
23 # Create the global AP manager, if it doesn't already exist. 23 # Create the global AP manager, if it doesn't already exist.
24 if not global.has_node("Archipelago"): 24 if not global.has_node("Archipelago"):
25 var ap_script = runtime.load_path("manager.gd") 25 var ap_script = runtime.load_script("manager.gd")
26 var ap_instance = ap_script.new() 26 var ap_instance = ap_script.new()
27 ap_instance.name = "Archipelago" 27 ap_instance.name = "Archipelago"
28 28
29 ap_instance.SCRIPT_client = runtime.load_path("client.gd") 29 ap_instance.SCRIPT_client = runtime.load_script("client.gd")
30 ap_instance.SCRIPT_keyboard = runtime.load_path("keyboard.gd") 30 ap_instance.SCRIPT_keyboard = runtime.load_script("keyboard.gd")
31 ap_instance.SCRIPT_locationListener = runtime.load_path("locationListener.gd") 31 ap_instance.SCRIPT_locationListener = runtime.load_script("locationListener.gd")
32 ap_instance.SCRIPT_minimap = runtime.load_path("minimap.gd") 32 ap_instance.SCRIPT_minimap = runtime.load_script("minimap.gd")
33 ap_instance.SCRIPT_uuid = runtime.load_path("vendor/uuid.gd") 33 ap_instance.SCRIPT_uuid = runtime.load_script("vendor/uuid.gd")
34 ap_instance.SCRIPT_victoryListener = runtime.load_path("victoryListener.gd") 34 ap_instance.SCRIPT_victoryListener = runtime.load_script("victoryListener.gd")
35 35
36 global.add_child(ap_instance) 36 global.add_child(ap_instance)
37 37
38 # Let's also inject any scripts we need to inject now. 38 # Let's also inject any scripts we need to inject now.
39 installScriptExtension(runtime.load_path("animationListener.gd")) 39 installScriptExtension(runtime.load_script("animationListener.gd"))
40 installScriptExtension(runtime.load_path("collectable.gd")) 40 installScriptExtension(runtime.load_script("collectable.gd"))
41 installScriptExtension(runtime.load_path("door.gd")) 41 installScriptExtension(runtime.load_script("door.gd"))
42 installScriptExtension(runtime.load_path("keyHolder.gd")) 42 installScriptExtension(runtime.load_script("keyHolder.gd"))
43 installScriptExtension(runtime.load_path("keyHolderChecker.gd")) 43 installScriptExtension(runtime.load_script("keyHolderChecker.gd"))
44 installScriptExtension(runtime.load_path("keyHolderResetterListener.gd")) 44 installScriptExtension(runtime.load_script("keyHolderResetterListener.gd"))
45 installScriptExtension(runtime.load_path("painting.gd")) 45 installScriptExtension(runtime.load_script("painting.gd"))
46 installScriptExtension(runtime.load_path("panel.gd")) 46 installScriptExtension(runtime.load_script("panel.gd"))
47 installScriptExtension(runtime.load_path("pauseMenu.gd")) 47 installScriptExtension(runtime.load_script("pauseMenu.gd"))
48 installScriptExtension(runtime.load_path("player.gd")) 48 installScriptExtension(runtime.load_script("player.gd"))
49 installScriptExtension(runtime.load_path("saver.gd")) 49 installScriptExtension(runtime.load_script("saver.gd"))
50 installScriptExtension(runtime.load_path("teleport.gd")) 50 installScriptExtension(runtime.load_script("teleport.gd"))
51 installScriptExtension(runtime.load_path("teleportListener.gd")) 51 installScriptExtension(runtime.load_script("teleportListener.gd"))
52 installScriptExtension(runtime.load_path("visibilityListener.gd")) 52 installScriptExtension(runtime.load_script("visibilityListener.gd"))
53 installScriptExtension(runtime.load_path("worldport.gd")) 53 installScriptExtension(runtime.load_script("worldport.gd"))
54 installScriptExtension(runtime.load_path("worldportListener.gd")) 54 installScriptExtension(runtime.load_script("worldportListener.gd"))
55 55
56 var proto_script = runtime.load_path("../generated/proto.gd") 56 var proto_script = runtime.load_script("../generated/proto.gd")
57 var gamedata_script = runtime.load_path("gamedata.gd") 57 var gamedata_script = runtime.load_script("gamedata.gd")
58 var gamedata_instance = gamedata_script.new(proto_script) 58 var gamedata_instance = gamedata_script.new(proto_script)
59 gamedata_instance.load(runtime.read_path("../generated/data.binpb")) 59 gamedata_instance.load(runtime.read_path("../generated/data.binpb"))
60 gamedata_instance.name = "Gamedata" 60 gamedata_instance.name = "Gamedata"
61 global.add_child(gamedata_instance) 61 global.add_child(gamedata_instance)
62 62
63 var messages_script = runtime.load_path("messages.gd") 63 var messages_script = runtime.load_script("messages.gd")
64 var messages_instance = messages_script.new() 64 var messages_instance = messages_script.new()
65 messages_instance.name = "Messages" 65 messages_instance.name = "Messages"
66 messages_instance.SCRIPT_rainbowText = runtime.load_path("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 textclient_script = runtime.load_path("textclient.gd") 69 var textclient_script = runtime.load_script("textclient.gd")
70 var textclient_instance = textclient_script.new() 70 var textclient_instance = textclient_script.new()
71 textclient_instance.name = "Textclient" 71 textclient_instance.name = "Textclient"
72 global.add_child(textclient_instance) 72 global.add_child(textclient_instance)
73 73
74 var compass_overlay_script = runtime.load_path("compass_overlay.gd") 74 var compass_overlay_script = runtime.load_script("compass_overlay.gd")
75 var compass_overlay_instance = compass_overlay_script.new() 75 var compass_overlay_instance = compass_overlay_script.new()
76 compass_overlay_instance.name = "Compass" 76 compass_overlay_instance.name = "Compass"
77 compass_overlay_instance.SCRIPT_compass = runtime.load_path("compass.gd") 77 compass_overlay_instance.SCRIPT_compass = runtime.load_script("compass.gd")
78 global.add_child(compass_overlay_instance) 78 global.add_child(compass_overlay_instance)
79 79
80 var ap = global.get_node("Archipelago") 80 var ap = global.get_node("Archipelago")
diff --git a/apworld/client/pauseMenu.gd b/apworld/client/pauseMenu.gd index 448f690..8bc12c6 100644 --- a/apworld/client/pauseMenu.gd +++ b/apworld/client/pauseMenu.gd
@@ -39,7 +39,7 @@ func _main_menu():
39 musicPlayer.stop() 39 musicPlayer.stop()
40 40
41 var runtime = global.get_node("Runtime") 41 var runtime = global.get_node("Runtime")
42 get_tree().change_scene_to_packed(runtime.load_path("settings_screen.tscn")) 42 runtime.load_script_as_scene.call_deferred("settings_screen.gd", "settings_screen")
43 43
44 44
45func _toggle_compass(): 45func _toggle_compass():
diff --git a/apworld/client/run_from_apworld.tscn b/apworld/client/run_from_apworld.tscn new file mode 100644 index 0000000..11373e0 --- /dev/null +++ b/apworld/client/run_from_apworld.tscn
@@ -0,0 +1,30 @@
1[gd_scene load_steps=11 format=2]
2
3[sub_resource id=2 type="GDScript"]
4script/source = "extends Node2D
5
6
7func _ready():
8 var args = OS.get_cmdline_user_args()
9 var apworld_path = args[0]
10
11 var zip_reader = ZIPReader.new()
12 zip_reader.open(apworld_path)
13
14 var runtime_script = GDScript.new()
15 runtime_script.source_code = zip_reader.read_file(\"lingo2/client/apworld_runtime.gd\").get_string_from_utf8()
16 runtime_script.reload()
17
18 zip_reader.close()
19
20 var runtime = runtime_script.new(apworld_path)
21 runtime.name = \"Runtime\"
22
23 global.add_child(runtime)
24
25 runtime.load_script_as_scene.call_deferred(\"settings_screen.gd\", \"settings_screen\")
26
27"
28
29[node name="loader" type="Node2D"]
30script = SubResource( 2 )
diff --git a/apworld/client/run_from_source.tscn b/apworld/client/run_from_source.tscn index b710677..59a914d 100644 --- a/apworld/client/run_from_source.tscn +++ b/apworld/client/run_from_source.tscn
@@ -14,8 +14,7 @@ func _ready():
14 14
15 global.add_child(runtime) 15 global.add_child(runtime)
16 16
17 var settings_screen = runtime.load_path(\"settings_screen.tscn\") 17 runtime.load_script_as_scene.call_deferred(\"settings_screen.gd\", \"settings_screen\")
18 get_tree().change_scene_to_packed(settings_screen)
19 18
20" 19"
21 20
diff --git a/apworld/client/settings_screen.gd b/apworld/client/settings_screen.gd new file mode 100644 index 0000000..b430b17 --- /dev/null +++ b/apworld/client/settings_screen.gd
@@ -0,0 +1,153 @@
1extends Node
2
3
4func _ready():
5 var theme = preload("res://assets/themes/baseUI.tres")
6
7 var simple_style_box = StyleBoxFlat.new()
8 simple_style_box.bg_color = Color(0, 0, 0, 0)
9
10 var panel = Panel.new()
11 panel.name = "Panel"
12 panel.offset_right = 1920.0
13 panel.offset_bottom = 1080.0
14 add_child(panel)
15
16 var title = Label.new()
17 title.name = "title"
18 title.offset_left = 0.0
19 title.offset_top = 75.0
20 title.offset_right = 1920.0
21 title.offset_bottom = 225.0
22 title.text = "ARCHIPELAGO"
23 title.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
24 title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
25 title.theme = theme
26 panel.add_child(title)
27
28 var connect_button = Button.new()
29 connect_button.name = "connect_button"
30 connect_button.offset_left = 255.0
31 connect_button.offset_top = 875.0
32 connect_button.offset_right = 891.0
33 connect_button.offset_bottom = 1025.0
34 connect_button.add_theme_color_override("font_color_hover", Color(1, 0.501961, 0, 1))
35 connect_button.text = "CONNECT"
36 connect_button.theme = theme
37 panel.add_child(connect_button)
38
39 var quit_button = Button.new()
40 quit_button.name = "quit_button"
41 quit_button.offset_left = 1102.0
42 quit_button.offset_top = 875.0
43 quit_button.offset_right = 1738.0
44 quit_button.offset_bottom = 1025.0
45 quit_button.add_theme_color_override("font_color_hover", Color(1, 0, 0, 1))
46 quit_button.text = "QUIT"
47 quit_button.theme = theme
48 panel.add_child(quit_button)
49
50 var credit2 = Label.new()
51 credit2.name = "credit2"
52 credit2.offset_left = -105.0
53 credit2.offset_top = 346.0
54 credit2.offset_right = 485.0
55 credit2.offset_bottom = 410.0
56 credit2.add_theme_stylebox_override("normal", simple_style_box)
57 credit2.text = "SERVER"
58 credit2.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
59 credit2.theme = theme
60 panel.add_child(credit2)
61
62 var credit3 = Label.new()
63 credit3.name = "credit3"
64 credit3.offset_left = -105.0
65 credit3.offset_top = 519.0
66 credit3.offset_right = 485.0
67 credit3.offset_bottom = 583.0
68 credit3.add_theme_stylebox_override("normal", simple_style_box)
69 credit3.text = "PLAYER"
70 credit3.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
71 credit3.theme = theme
72 panel.add_child(credit3)
73
74 var credit4 = Label.new()
75 credit4.name = "credit4"
76 credit4.offset_left = -105.0
77 credit4.offset_top = 704.0
78 credit4.offset_right = 485.0
79 credit4.offset_bottom = 768.0
80 credit4.add_theme_stylebox_override("normal", simple_style_box)
81 credit4.text = "PASSWORD"
82 credit4.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
83 credit4.theme = theme
84 panel.add_child(credit4)
85
86 var credit5 = Label.new()
87 credit5.name = "credit5"
88 credit5.offset_left = 1239.0
89 credit5.offset_top = 422.0
90 credit5.offset_right = 1829.0
91 credit5.offset_bottom = 486.0
92 credit5.add_theme_stylebox_override("normal", simple_style_box)
93 credit5.text = "OPTIONS"
94 credit5.theme = theme
95 panel.add_child(credit5)
96
97 var server_box = LineEdit.new()
98 server_box.name = "server_box"
99 server_box.offset_left = 502.0
100 server_box.offset_top = 295.0
101 server_box.offset_right = 1144.0
102 server_box.offset_bottom = 445.0
103 server_box.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
104 server_box.caret_blink = true
105 panel.add_child(server_box)
106
107 var player_box = LineEdit.new()
108 player_box.name = "player_box"
109 player_box.offset_left = 502.0
110 player_box.offset_top = 477.0
111 player_box.offset_right = 1144.0
112 player_box.offset_bottom = 627.0
113 player_box.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
114 player_box.caret_blink = true
115 panel.add_child(player_box)
116
117 var password_box = LineEdit.new()
118 password_box.name = "password_box"
119 password_box.offset_left = 502.0
120 password_box.offset_top = 659.0
121 password_box.offset_right = 1144.0
122 password_box.offset_bottom = 809.0
123 password_box.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
124 password_box.caret_blink = true
125 panel.add_child(password_box)
126
127 var accept_dialog = AcceptDialog.new()
128 accept_dialog.name = "AcceptDialog"
129 accept_dialog.offset_right = 83.0
130 accept_dialog.offset_bottom = 58.0
131 panel.add_child(accept_dialog)
132
133 var version_mismatch = ConfirmationDialog.new()
134 version_mismatch.name = "VersionMismatch"
135 version_mismatch.offset_right = 83.0
136 version_mismatch.offset_bottom = 58.0
137 panel.add_child(version_mismatch)
138
139 var connection_history = MenuButton.new()
140 connection_history.name = "connection_history"
141 connection_history.offset_left = 1239.0
142 connection_history.offset_top = 276.0
143 connection_history.offset_right = 1829.0
144 connection_history.offset_bottom = 372.0
145 connection_history.text = "connection history"
146 connection_history.flat = false
147 panel.add_child(connection_history)
148
149 var runtime = global.get_node("Runtime")
150 var main_script = runtime.load_script("main.gd")
151 var main_node = main_script.new()
152 main_node.name = "Main"
153 add_child(main_node)
diff --git a/apworld/client/settings_screen.tscn b/apworld/client/settings_screen.tscn deleted file mode 100644 index 63d5dbe..0000000 --- a/apworld/client/settings_screen.tscn +++ /dev/null
@@ -1,173 +0,0 @@
1[gd_scene load_steps=11 format=2]
2
3[ext_resource path="res://images/unchecked.png" type="Texture" id=7]
4[ext_resource path="res://images/checked.png" type="Texture" id=8]
5[ext_resource type="Theme" uid="uid://7w454egydi41" path="res://assets/themes/baseUI.tres" id="2_g4bvn"]
6
7[sub_resource type="StyleBoxFlat" id=1]
8bg_color = Color( 0, 0, 0, 0 )
9
10[sub_resource type="StyleBoxFlat" id=2]
11bg_color = Color( 1, 1, 1, 1 )
12border_width_left = 1
13border_width_top = 1
14border_width_right = 1
15border_width_bottom = 1
16border_color = Color( 1, 1, 0, 1 )
17border_blend = true
18corner_radius_top_left = 3
19corner_radius_top_right = 3
20corner_radius_bottom_right = 3
21corner_radius_bottom_left = 3
22expand_offset_left = 5.0
23expand_offset_right = 5.0
24expand_offset_top = 5.0
25expand_offset_bottom = 5.0
26
27[sub_resource id=4 type="GDScript"]
28script/source = "extends Node2D
29
30
31func _ready():
32 var runtime = global.get_node(\"Runtime\")
33 var main_script = runtime.load_path(\"main.gd\")
34 var main_node = main_script.new()
35 main_node.name = \"Main\"
36 add_child(main_node)
37
38"
39
40[node name="settings_screen" type="Node2D"]
41script = SubResource( 4 )
42
43[node name="Panel" type="Panel" parent="."]
44offset_right = 1920.0
45offset_bottom = 1080.0
46
47[node name="title" parent="Panel" type="Label"]
48offset_left = 0.0
49offset_top = 75.0
50offset_right = 1920.0
51offset_bottom = 225.0
52text = "ARCHIPELAGO"
53valign = 1
54horizontal_alignment = 1
55theme = ExtResource("2_g4bvn")
56
57[node name="credit" parent="Panel" type="Label"]
58visible = false
59offset_left = 1278.0
60offset_top = 974.0
61offset_right = 1868.0
62offset_bottom = 1034.0
63text = "Brenton Wildes"
64theme = ExtResource("2_g4bvn")
65
66[node name="connect_button" parent="Panel" type="Button"]
67offset_left = 255.0
68offset_top = 875.0
69offset_right = 891.0
70offset_bottom = 1025.0
71custom_colors/font_color_hover = Color( 1, 0.501961, 0, 1 )
72text = "CONNECT"
73theme = ExtResource("2_g4bvn")
74
75[node name="quit_button" parent="Panel" type="Button"]
76offset_left = 1102.0
77offset_top = 875.0
78offset_right = 1738.0
79offset_bottom = 1025.0
80custom_colors/font_color_hover = Color( 1, 0, 0, 1 )
81text = "QUIT"
82theme = ExtResource("2_g4bvn")
83
84[node name="credit2" parent="Panel" type="Label"]
85offset_left = -105.0
86offset_top = 346.0
87offset_right = 485.0
88offset_bottom = 410.0
89custom_styles/normal = SubResource( 1 )
90text = "SERVER"
91align = 2
92theme = ExtResource("2_g4bvn")
93
94[node name="credit5" parent="Panel" type="Label"]
95offset_left = 1239.0
96offset_top = 422.0
97offset_right = 1829.0
98offset_bottom = 486.0
99custom_styles/normal = SubResource( 1 )
100text = "OPTIONS"
101theme = ExtResource("2_g4bvn")
102
103[node name="credit3" parent="Panel" type="Label"]
104offset_left = -105.0
105offset_top = 519.0
106offset_right = 485.0
107offset_bottom = 583.0
108custom_styles/normal = SubResource( 1 )
109text = "PLAYER"
110align = 2
111theme = ExtResource("2_g4bvn")
112
113[node name="credit4" parent="Panel" type="Label"]
114offset_left = -105.0
115offset_top = 704.0
116offset_right = 485.0
117offset_bottom = 768.0
118custom_styles/normal = SubResource( 1 )
119text = "PASSWORD"
120align = 2
121theme = ExtResource("2_g4bvn")
122
123[node name="server_box" type="LineEdit" parent="Panel"]
124offset_left = 502.0
125offset_top = 295.0
126offset_right = 1144.0
127offset_bottom = 445.0
128custom_colors/selection_color = Color( 0.482353, 0, 0, 1 )
129custom_colors/cursor_color = Color( 0, 0, 0, 1 )
130custom_colors/font_color = Color( 0, 0, 0, 1 )
131custom_styles/focus = SubResource( 2 )
132align = 1
133caret_blink = true
134
135[node name="player_box" type="LineEdit" parent="Panel"]
136offset_left = 502.0
137offset_top = 477.0
138offset_right = 1144.0
139offset_bottom = 627.0
140custom_colors/selection_color = Color( 0.482353, 0, 0, 1 )
141custom_colors/cursor_color = Color( 0, 0, 0, 1 )
142custom_colors/font_color = Color( 0, 0, 0, 1 )
143custom_styles/focus = SubResource( 2 )
144align = 1
145caret_blink = true
146
147[node name="password_box" type="LineEdit" parent="Panel"]
148offset_left = 502.0
149offset_top = 659.0
150offset_right = 1144.0
151offset_bottom = 809.0
152custom_colors/selection_color = Color( 0.482353, 0, 0, 1 )
153custom_colors/cursor_color = Color( 0, 0, 0, 1 )
154custom_colors/font_color = Color( 0, 0, 0, 1 )
155custom_styles/focus = SubResource( 2 )
156align = 1
157caret_blink = true
158
159[node name="AcceptDialog" type="AcceptDialog" parent="Panel"]
160offset_right = 83.0
161offset_bottom = 58.0
162
163[node name="VersionMismatch" type="ConfirmationDialog" parent="Panel"]
164offset_right = 83.0
165offset_bottom = 58.0
166
167[node name="connection_history" type="MenuButton" parent="Panel"]
168offset_left = 1239.0
169offset_top = 276.0
170offset_right = 1829.0
171offset_bottom = 372.0
172text = "connection history"
173flat = false
diff --git a/apworld/client/source_runtime.gd b/apworld/client/source_runtime.gd index fbb7009..35428ea 100644 --- a/apworld/client/source_runtime.gd +++ b/apworld/client/source_runtime.gd
@@ -7,9 +7,23 @@ func _init(path):
7 source_path = path 7 source_path = path
8 8
9 9
10func load_path(path): 10func load_script(path):
11 return ResourceLoader.load("%s/%s" % [source_path, path]) 11 return ResourceLoader.load("%s/%s" % [source_path, path])
12 12
13 13
14func read_path(path): 14func read_path(path):
15 return FileAccess.get_file_as_bytes("%s/%s" % [source_path, path]) 15 return FileAccess.get_file_as_bytes("%s/%s" % [source_path, path])
16
17
18func load_script_as_scene(path, scene_name):
19 var script = load_script(path)
20 var instance = script.new()
21 instance.name = scene_name
22
23 get_tree().unload_current_scene()
24 _load_scene.call_deferred(instance)
25
26
27func _load_scene(instance):
28 get_tree().get_root().add_child(instance)
29 get_tree().current_scene = instance