From e779d067a55259876a91a1abf870c4596a59f6f9 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 3 Oct 2025 11:40:44 -0400 Subject: Create stub loader --- client/archipelago.tscn | 153 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 client/archipelago.tscn 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 @@ +[gd_scene load_steps=3 format=3 uid="uid://b5mj3cq2bcesd"] + +[ext_resource type="Theme" uid="uid://7w454egydi41" path="res://assets/themes/baseUI.tres" id="1_mw3f1"] + +[sub_resource id=2 type="GDScript"] +script/source = "extends Node2D + +const CACHE_PATH = \"user://apworld_path.txt\" + + +func _ready(): + if FileAccess.file_exists(CACHE_PATH): + var file = FileAccess.open(CACHE_PATH, FileAccess.READ) + $Panel/HBoxContainer/LineEdit.text = file.get_as_text() + file.close() + + +func _browse_pressed(): + $FileDialog.popup_centered() + + +func _file_selected(path): + $Panel/HBoxContainer/LineEdit.text = path + + +func _start_pressed(): + var apworld_path = $Panel/HBoxContainer/LineEdit.text + + if not FileAccess.file_exists(apworld_path): + $AcceptDialog.popup_centered() + return + + var zip_reader = ZIPReader.new() + zip_reader.open(apworld_path) + + var inner_path = \"lingo2/client/apworld_runtime.gd\" + if not zip_reader.file_exists(inner_path): + zip_reader.close() + $AcceptDialog.popup_centered() + return + + var cache_file = FileAccess.open(CACHE_PATH, FileAccess.WRITE) + cache_file.store_string(apworld_path) + cache_file.close() + + var runtime_script = GDScript.new() + runtime_script.source_code = zip_reader.read_file(inner_path).get_string_from_utf8() + runtime_script.reload() + + zip_reader.close() + + var runtime = runtime_script.new(apworld_path) + runtime.name = \"Runtime\" + + global.add_child(runtime) + + runtime.load_script_as_scene.call_deferred(\"settings_screen.gd\", \"settings_screen\") + + +func _quit_pressed(): + get_tree().change_scene_to_file(\"res://objects/scenes/menus/main_menu.tscn\") + +" + +[node name="Node2D" type="Node2D"] +script = SubResource( 2 ) + +[node name="Panel" type="Panel" parent="."] +anchors_preset = -1 +offset_right = 1920.0 +offset_bottom = 1080.0 + +[node name="Label" type="Label" parent="Panel"] +layout_mode = 1 +anchors_preset = -1 +offset_top = 75.0 +offset_right = 1920.0 +offset_bottom = 225.0 +theme = ExtResource("1_mw3f1") +text = "archipelago" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Label2" type="Label" parent="Panel"] +layout_mode = 1 +anchors_preset = -1 +anchor_right = 1.0 +offset_left = 80.0 +offset_top = 300.0 +offset_right = -80.0 +offset_bottom = 388.0 +theme = ExtResource("1_mw3f1") +theme_override_font_sizes/font_size = 56 +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\"." +horizontal_alignment = 1 +autowrap_mode = 3 + +[node name="HBoxContainer" type="HBoxContainer" parent="Panel"] +layout_mode = 1 +anchors_preset = -1 +anchor_right = 1.0 +offset_left = 80.0 +offset_top = 595.0 +offset_right = -80.0 +offset_bottom = 755.0 +theme_override_constants/separation = 32 + +[node name="LineEdit" type="LineEdit" parent="Panel/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Button" type="Button" parent="Panel/HBoxContainer"] +layout_mode = 2 +theme = ExtResource("1_mw3f1") +text = "browse" + +[node name="StartButton" type="Button" parent="Panel"] +layout_mode = 1 +anchors_preset = -1 +offset_left = 255.0 +offset_top = 875.0 +offset_right = 891.0 +offset_bottom = 1025.0 +theme = ExtResource("1_mw3f1") +text = "start" + +[node name="QuitButton" type="Button" parent="Panel"] +layout_mode = 1 +anchors_preset = -1 +offset_left = 1102.0 +offset_top = 875.0 +offset_right = 1738.0 +offset_bottom = 1025.0 +theme = ExtResource("1_mw3f1") +text = "back" + +[node name="FileDialog" type="FileDialog" parent="."] +title = "Open a File" +size = Vector2i(512, 512) +ok_button_text = "Open" +file_mode = 0 +access = 2 +filters = PackedStringArray("*.apworld;Archipelago Worlds") +show_hidden_files = true +use_native_dialog = true + +[node name="AcceptDialog" type="AcceptDialog" parent="."] +dialog_text = "Could not open Lingo 2 apworld. Please check that the path is correct." + +[connection signal="pressed" from="Panel/HBoxContainer/Button" to="." method="_browse_pressed"] +[connection signal="pressed" from="Panel/StartButton" to="." method="_start_pressed"] +[connection signal="pressed" from="Panel/QuitButton" to="." method="_quit_pressed"] +[connection signal="file_selected" from="FileDialog" to="." method="_file_selected"] -- cgit 1.4.1