about summary refs log tree commit diff stats
path: root/client/Archipelago/settings_screen.gd
blob: 0611bab367d54200835f2391e0196d729a15afbc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Inte
extends Node2D


func _ready():
	
ass="o">._print("Provisioning successful! Build ID: %d" % Steam.getAppBuildId()) else: global._print("Provisioning failed.") # Undo the load screen removing our cursor get_tree().get_root().set_disable_input(false) Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) # Increase the WebSocket input buffer size so that we can download large # data packages. ProjectSettings.set_setting("network/limits/websocket_client/max_in_buffer_kb", 8192) # Create the global AP manager, if it doesn't already exist. if not global.has_node("Archipelago"): var ap_script = ResourceLoader.load("user://maps/Archipelago/manager.gd") var ap_instance = ap_script.new() ap_instance.name = "Archipelago" #apclient_instance.SCRIPT_doorControl = load("user://maps/Archipelago/doorControl.gd") #apclient_instance.SCRIPT_effects = load("user://maps/Archipelago/effects.gd") #apclient_instance.SCRIPT_location = load("user://maps/Archipelago/location.gd") #apclient_instance.SCRIPT_mypainting = load("user://maps/Archipelago/mypainting.gd") #apclient_instance.SCRIPT_panel = load("user://maps/Archipelago/panel.gd") #apclient_instance.SCRIPT_textclient = load("user://maps/Archipelago/textclient.gd") ap_instance.SCRIPT_client = load("user://maps/Archipelago/client.gd") ap_instance.SCRIPT_locationListener = load("user://maps/Archipelago/locationListener.gd") ap_instance.SCRIPT_uuid = load("user://maps/Archipelago/vendor/uuid.gd") global.add_child(ap_instance) # Let's also inject any scripts we need to inject now. installScriptExtension(ResourceLoader.load("user://maps/Archipelago/animationListener.gd")) installScriptExtension(ResourceLoader.load("user://maps/Archipelago/door.gd")) installScriptExtension(ResourceLoader.load("user://maps/Archipelago/painting.gd")) installScriptExtension(ResourceLoader.load("user://maps/Archipelago/player.gd")) installScriptExtension(ResourceLoader.load("user://maps/Archipelago/saver.gd")) installScriptExtension(ResourceLoader.load("user://maps/Archipelago/teleportListener.gd")) installScriptExtension(ResourceLoader.load("user://maps/Archipelago/worldportListener.gd")) var proto_script = load("user://maps/Archipelago/generated/proto.gd") var gamedata_script = load("user://maps/Archipelago/gamedata.gd") var gamedata_instance = gamedata_script.new(proto_script) gamedata_instance.load( FileAccess.get_file_as_bytes("user://maps/Archipelago/generated/data.binpb") ) gamedata_instance.name = "Gamedata" global.add_child(gamedata_instance) var messages_script = load("user://maps/Archipelago/messages.gd") var messages_instance = messages_script.new() messages_instance.name = "Messages" global.add_child(messages_instance) var ap = global.get_node("Archipelago") ap.connect("ap_connected", connectionSuccessful) ap.connect("could_not_connect", connectionUnsuccessful) ap.connect("connect_status", connectionStatus) # Populate textboxes with AP settings. $Panel/server_box.text = ap.ap_server $Panel/player_box.text = ap.ap_user $Panel/password_box.text = ap.ap_pass var history_box = $Panel/connection_history if ap.connection_history.is_empty(): history_box.disabled = true else: history_box.disabled = false var i = 0 for details in ap.connection_history: history_box.get_popup().add_item("%s (%s)" % [details[1], details[0]], i) i += 1 history_box.get_popup().connect("id_pressed", historySelected) # Show client version. $Panel/title.text = "ARCHIPELAGO (%s)" % ap.my_version # Increase font size in text boxes. $Panel/server_box.add_theme_font_size_override("font_size", 36) $Panel/player_box.add_theme_font_size_override("font_size", 36) $Panel/password_box.add_theme_font_size_override("font_size", 36) # Adapted from https://gitlab.com/Delta-V-Modding/Mods/-/blob/main/game/ModLoader.gd func installScriptExtension(childScript: Resource): # Force Godot to compile the script now. # We need to do this here to ensure that the inheritance chain is # properly set up, and multiple mods can chain-extend the same # class multiple times. # This is also needed to make Godot instantiate the extended class # when creating singletons. # The actual instance is thrown away. childScript.new() var parentScript = childScript.get_base_script() var parentScriptPath = parentScript.resource_path global._print("ModLoader: Installing script extension over %s" % parentScriptPath) childScript.take_over_path(parentScriptPath) func connectionStatus(message): var popup = self.get_node("Panel/AcceptDialog") popup.title = "Connecting to Archipelago" popup.dialog_text = message popup.exclusive = true popup.get_ok_button().visible = false popup.popup_centered() func connectionSuccessful(): var ap = global.get_node("Archipelago") # Save connection details var connection_details = [ap.ap_server, ap.ap_user, ap.ap_pass] if ap.connection_history.has(connection_details): ap.connection_history.erase(connection_details) ap.connection_history.push_front(connection_details) if ap.connection_history.size() > 10: ap.connection_history.resize(10) ap.saveSettings() # Switch to the_entry Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) global.user = ap.getSaveFileName() global.universe = "lingo" global.map = "the_entry" unlocks.resetKeys() unlocks.resetCollectables() unlocks.resetData() unlocks.loadKeys() unlocks.loadCollectables() unlocks.loadData() unlocks.unlockKey("capslock", 1) clearResourceCache("res://objects/meshes/gridDoor.tscn") clearResourceCache("res://objects/nodes/door.tscn") clearResourceCache("res://objects/nodes/listeners/animationListener.tscn") clearResourceCache("res://objects/nodes/listeners/teleportListener.tscn") clearResourceCache("res://objects/nodes/listeners/worldportListener.tscn") clearResourceCache("res://objects/nodes/player.tscn") clearResourceCache("res://objects/nodes/saver.tscn") var paintings_dir = DirAccess.open("res://objects/meshes/paintings") if paintings_dir: paintings_dir.list_dir_begin() var file_name = paintings_dir.get_next() while file_name != "": if not paintings_dir.current_is_dir() and file_name.ends_with(".tscn"): clearResourceCache("res://objects/meshes/paintings/" + file_name) file_name = paintings_dir.get_next() switcher.switch_map("res://objects/scenes/the_entry.tscn") func connectionUnsuccessful(error_message): $Panel/connect_button.disabled = false var popup = $Panel/AcceptDialog popup.title = "Could not connect to Archipelago" popup.dialog_text = error_message popup.exclusive = true popup.get_ok_button().visible = true popup.popup_centered() func historySelected(index): var ap = global.get_node("Archipelago") var details = ap.connection_history[index] $Panel/server_box.text = details[0] $Panel/player_box.text = details[1] $Panel/password_box.text = details[2] func clearResourceCache(path): ResourceLoader.load_threaded_request(path, "", false, ResourceLoader.CACHE_MODE_REPLACE) ResourceLoader.load_threaded_get(path)