diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-10-03 11:40:44 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-10-03 11:40:44 -0400 |
commit | e779d067a55259876a91a1abf870c4596a59f6f9 (patch) | |
tree | 3a11ce521d439c52a228852fbcd4b47acf16cc32 | |
parent | 810263d61a21d2e81c78765b93adf65cb2b4e987 (diff) | |
download | lingo2-archipelago-e779d067a55259876a91a1abf870c4596a59f6f9.tar.gz lingo2-archipelago-e779d067a55259876a91a1abf870c4596a59f6f9.tar.bz2 lingo2-archipelago-e779d067a55259876a91a1abf870c4596a59f6f9.zip |
Create stub loader
-rw-r--r-- | client/archipelago.tscn | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/client/archipelago.tscn b/client/archipelago.tscn new file mode 100644 index 0000000..1c156a3 --- /dev/null +++ b/client/archipelago.tscn | |||
@@ -0,0 +1,153 @@ | |||
1 | [gd_scene load_steps=3 format=3 uid="uid://b5mj3cq2bcesd"] | ||
2 | |||
3 | [ext_resource type="Theme" uid="uid://7w454egydi41" path="res://assets/themes/baseUI.tres" id="1_mw3f1"] | ||
4 | |||
5 | [sub_resource id=2 type="GDScript"] | ||
6 | script/source = "extends Node2D | ||
7 | |||
8 | const CACHE_PATH = \"user://apworld_path.txt\" | ||
9 | |||
10 | |||
11 | func _ready(): | ||
12 | if FileAccess.file_exists(CACHE_PATH): | ||
13 | var file = FileAccess.open(CACHE_PATH, FileAccess.READ) | ||
14 | $Panel/HBoxContainer/LineEdit.text = file.get_as_text() | ||
15 | file.close() | ||
16 | |||
17 | |||
18 | func _browse_pressed(): | ||
19 | $FileDialog.popup_centered() | ||
20 | |||
21 | |||
22 | func _file_selected(path): | ||
23 | $Panel/HBoxContainer/LineEdit.text = path | ||
24 | |||
25 | |||
26 | func _start_pressed(): | ||
27 | var apworld_path = $Panel/HBoxContainer/LineEdit.text | ||
28 | |||
29 | if not FileAccess.file_exists(apworld_path): | ||
30 | $AcceptDialog.popup_centered() | ||
31 | return | ||
32 | |||
33 | var zip_reader = ZIPReader.new() | ||
34 | zip_reader.open(apworld_path) | ||
35 | |||
36 | var inner_path = \"lingo2/client/apworld_runtime.gd\" | ||
37 | if not zip_reader.file_exists(inner_path): | ||
38 | zip_reader.close() | ||
39 | $AcceptDialog.popup_centered() | ||
40 | return | ||
41 | |||
42 | var cache_file = FileAccess.open(CACHE_PATH, FileAccess.WRITE) | ||
43 | cache_file.store_string(apworld_path) | ||
44 | cache_file.close() | ||
45 | |||
46 | var runtime_script = GDScript.new() | ||
47 | runtime_script.source_code = zip_reader.read_file(inner_path).get_string_from_utf8() | ||
48 | runtime_script.reload() | ||
49 | |||
50 | zip_reader.close() | ||
51 | |||
52 | var runtime = runtime_script.new(apworld_path) | ||
53 | runtime.name = \"Runtime\" | ||
54 | |||
55 | global.add_child(runtime) | ||
56 | |||
57 | runtime.load_script_as_scene.call_deferred(\"settings_screen.gd\", \"settings_screen\") | ||
58 | |||
59 | |||
60 | func _quit_pressed(): | ||
61 | get_tree().change_scene_to_file(\"res://objects/scenes/menus/main_menu.tscn\") | ||
62 | |||
63 | " | ||
64 | |||
65 | [node name="Node2D" type="Node2D"] | ||
66 | script = SubResource( 2 ) | ||
67 | |||
68 | [node name="Panel" type="Panel" parent="."] | ||
69 | anchors_preset = -1 | ||
70 | offset_right = 1920.0 | ||
71 | offset_bottom = 1080.0 | ||
72 | |||
73 | [node name="Label" type="Label" parent="Panel"] | ||
74 | layout_mode = 1 | ||
75 | anchors_preset = -1 | ||
76 | offset_top = 75.0 | ||
77 | offset_right = 1920.0 | ||
78 | offset_bottom = 225.0 | ||
79 | theme = ExtResource("1_mw3f1") | ||
80 | text = "archipelago" | ||
81 | horizontal_alignment = 1 | ||
82 | vertical_alignment = 1 | ||
83 | |||
84 | [node name="Label2" type="Label" parent="Panel"] | ||
85 | layout_mode = 1 | ||
86 | anchors_preset = -1 | ||
87 | anchor_right = 1.0 | ||
88 | offset_left = 80.0 | ||
89 | offset_top = 300.0 | ||
90 | offset_right = -80.0 | ||
91 | offset_bottom = 388.0 | ||
92 | theme = ExtResource("1_mw3f1") | ||
93 | theme_override_font_sizes/font_size = 56 | ||
94 | text = "Put the path to your lingo2.apworld in the below field and click start. Then, open the archipelago launcher and click \"Lingo 2 Client\"." | ||
95 | horizontal_alignment = 1 | ||
96 | autowrap_mode = 3 | ||
97 | |||
98 | [node name="HBoxContainer" type="HBoxContainer" parent="Panel"] | ||
99 | layout_mode = 1 | ||
100 | anchors_preset = -1 | ||
101 | anchor_right = 1.0 | ||
102 | offset_left = 80.0 | ||
103 | offset_top = 595.0 | ||
104 | offset_right = -80.0 | ||
105 | offset_bottom = 755.0 | ||
106 | theme_override_constants/separation = 32 | ||
107 | |||
108 | [node name="LineEdit" type="LineEdit" parent="Panel/HBoxContainer"] | ||
109 | layout_mode = 2 | ||
110 | size_flags_horizontal = 3 | ||
111 | |||
112 | [node name="Button" type="Button" parent="Panel/HBoxContainer"] | ||
113 | layout_mode = 2 | ||
114 | theme = ExtResource("1_mw3f1") | ||
115 | text = "browse" | ||
116 | |||
117 | [node name="StartButton" type="Button" parent="Panel"] | ||
118 | layout_mode = 1 | ||
119 | anchors_preset = -1 | ||
120 | offset_left = 255.0 | ||
121 | offset_top = 875.0 | ||
122 | offset_right = 891.0 | ||
123 | offset_bottom = 1025.0 | ||
124 | theme = ExtResource("1_mw3f1") | ||
125 | text = "start" | ||
126 | |||
127 | [node name="QuitButton" type="Button" parent="Panel"] | ||
128 | layout_mode = 1 | ||
129 | anchors_preset = -1 | ||
130 | offset_left = 1102.0 | ||
131 | offset_top = 875.0 | ||
132 | offset_right = 1738.0 | ||
133 | offset_bottom = 1025.0 | ||
134 | theme = ExtResource("1_mw3f1") | ||
135 | text = "back" | ||
136 | |||
137 | [node name="FileDialog" type="FileDialog" parent="."] | ||
138 | title = "Open a File" | ||
139 | size = Vector2i(512, 512) | ||
140 | ok_button_text = "Open" | ||
141 | file_mode = 0 | ||
142 | access = 2 | ||
143 | filters = PackedStringArray("*.apworld;Archipelago Worlds") | ||
144 | show_hidden_files = true | ||
145 | use_native_dialog = true | ||
146 | |||
147 | [node name="AcceptDialog" type="AcceptDialog" parent="."] | ||
148 | dialog_text = "Could not open Lingo 2 apworld. Please check that the path is correct." | ||
149 | |||
150 | [connection signal="pressed" from="Panel/HBoxContainer/Button" to="." method="_browse_pressed"] | ||
151 | [connection signal="pressed" from="Panel/StartButton" to="." method="_start_pressed"] | ||
152 | [connection signal="pressed" from="Panel/QuitButton" to="." method="_quit_pressed"] | ||
153 | [connection signal="file_selected" from="FileDialog" to="." method="_file_selected"] | ||