diff options
| -rw-r--r-- | Archipelago/client.gd | 44 | ||||
| -rw-r--r-- | Archipelago/load.gd | 6 | ||||
| -rw-r--r-- | Archipelago/pause_menu.gd | 5 | ||||
| -rw-r--r-- | Archipelago/settings_screen.gd | 1 | ||||
| -rw-r--r-- | Archipelago/textclient.gd | 88 | ||||
| -rw-r--r-- | CHANGELOG.md | 10 | ||||
| -rw-r--r-- | README.md | 3 |
7 files changed, 157 insertions, 0 deletions
| diff --git a/Archipelago/client.gd b/Archipelago/client.gd index a990fa2..5f8be4e 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd | |||
| @@ -8,6 +8,7 @@ var SCRIPT_mypainting | |||
| 8 | var SCRIPT_notifier | 8 | var SCRIPT_notifier |
| 9 | var SCRIPT_panel | 9 | var SCRIPT_panel |
| 10 | var SCRIPT_pilgrimage_terminator | 10 | var SCRIPT_pilgrimage_terminator |
| 11 | var SCRIPT_textclient | ||
| 11 | var SCRIPT_uuid | 12 | var SCRIPT_uuid |
| 12 | 13 | ||
| 13 | var ap_server = "" | 14 | var ap_server = "" |
| @@ -467,6 +468,8 @@ func _on_data(): | |||
| 467 | i += 1 | 468 | i += 1 |
| 468 | 469 | ||
| 469 | elif cmd == "PrintJSON": | 470 | elif cmd == "PrintJSON": |
| 471 | parse_printjson(message) | ||
| 472 | |||
| 470 | if ( | 473 | if ( |
| 471 | !message.has("receiving") | 474 | !message.has("receiving") |
| 472 | or !message.has("item") | 475 | or !message.has("item") |
| @@ -700,6 +703,10 @@ func setValue(key, value, operation = "replace"): | |||
| 700 | ) | 703 | ) |
| 701 | 704 | ||
| 702 | 705 | ||
| 706 | func say(textdata): | ||
| 707 | sendMessage([{"cmd": "Say", "text": textdata}]) | ||
| 708 | |||
| 709 | |||
| 703 | func completedGoal(): | 710 | func completedGoal(): |
| 704 | sendMessage([{"cmd": "StatusUpdate", "status": 30}]) # CLIENT_GOAL | 711 | sendMessage([{"cmd": "StatusUpdate", "status": 30}]) # CLIENT_GOAL |
| 705 | 712 | ||
| @@ -892,6 +899,43 @@ func colorForItemType(flags): | |||
| 892 | return "#14de9e" | 899 | return "#14de9e" |
| 893 | 900 | ||
| 894 | 901 | ||
| 902 | func parse_printjson(message): | ||
| 903 | var parts = [] | ||
| 904 | for message_part in message["data"]: | ||
| 905 | if !message_part.has("type") and message_part.has("text"): | ||
| 906 | parts.append(message_part["text"]) | ||
| 907 | elif message_part["type"] == "player_id": | ||
| 908 | if int(message_part["text"]) == _slot: | ||
| 909 | parts.append("[color=#ee00ee]%s[/color]" % _player_name_by_slot[_slot]) | ||
| 910 | else: | ||
| 911 | var from = float(message_part["text"]) | ||
| 912 | parts.append("[color=#fafad2]%s[/color]" % _player_name_by_slot[from]) | ||
| 913 | elif message_part["type"] == "item_id": | ||
| 914 | var item_name = "Unknown" | ||
| 915 | var item_player_game = _game_by_player[message_part["player"]] | ||
| 916 | if _item_id_to_name[item_player_game].has(float(message_part["text"])): | ||
| 917 | item_name = _item_id_to_name[item_player_game][float(message_part["text"])] | ||
| 918 | |||
| 919 | parts.append( | ||
| 920 | "[color=%s]%s[/color]" % [colorForItemType(message_part["flags"]), item_name] | ||
| 921 | ) | ||
| 922 | elif message_part["type"] == "location_id": | ||
| 923 | var location_name = "Unknown" | ||
| 924 | var location_player_game = _game_by_player[message_part["player"]] | ||
| 925 | if _location_id_to_name[location_player_game].has(float(message_part["text"])): | ||
| 926 | location_name = _location_id_to_name[location_player_game][float( | ||
| 927 | message_part["text"] | ||
| 928 | )] | ||
| 929 | |||
| 930 | parts.append("[color=#00ff7f]%s[/color]" % location_name) | ||
| 931 | elif message_part.has("text"): | ||
| 932 | parts.append(message_part["text"]) | ||
| 933 | |||
| 934 | var textclient_node = get_tree().get_root().get_node_or_null("Spatial/AP_TextClient") | ||
| 935 | if textclient_node != null: | ||
| 936 | textclient_node.parse_printjson("".join(parts)) | ||
| 937 | |||
| 938 | |||
| 895 | func compareVersion(lhs, rhs): | 939 | func compareVersion(lhs, rhs): |
| 896 | if lhs["major"] == rhs["major"]: | 940 | if lhs["major"] == rhs["major"]: |
| 897 | if lhs["minor"] == rhs["minor"]: | 941 | if lhs["minor"] == rhs["minor"]: |
| diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 9b20e6d..ce7bba5 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd | |||
| @@ -665,6 +665,12 @@ func _load(): | |||
| 665 | effects.set_name("AP_Effects") | 665 | effects.set_name("AP_Effects") |
| 666 | self.add_child(effects) | 666 | self.add_child(effects) |
| 667 | 667 | ||
| 668 | # Create the textclient node. | ||
| 669 | var textclient_script = apclient.SCRIPT_textclient | ||
| 670 | var textclient = textclient_script.new() | ||
| 671 | textclient.set_name("AP_TextClient") | ||
| 672 | self.add_child(textclient) | ||
| 673 | |||
| 668 | # Create the multiplayer node, if needed. | 674 | # Create the multiplayer node, if needed. |
| 669 | if apclient.enable_multiplayer: | 675 | if apclient.enable_multiplayer: |
| 670 | var multiplayer_node = apclient.SCRIPT_multiplayer.new() | 676 | var multiplayer_node = apclient.SCRIPT_multiplayer.new() |
| diff --git a/Archipelago/pause_menu.gd b/Archipelago/pause_menu.gd index 40994d9..62ba6c3 100644 --- a/Archipelago/pause_menu.gd +++ b/Archipelago/pause_menu.gd | |||
| @@ -6,3 +6,8 @@ func _main_menu(): | |||
| 6 | apclient.disconnect_from_ap() | 6 | apclient.disconnect_from_ap() |
| 7 | 7 | ||
| 8 | ._main_menu() | 8 | ._main_menu() |
| 9 | |||
| 10 | |||
| 11 | func _pause_game(): | ||
| 12 | get_tree().get_root().get_node("Spatial/AP_TextClient").dismiss() | ||
| 13 | ._pause_game() | ||
| diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index 6c64b15..2ed8594 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd | |||
| @@ -32,6 +32,7 @@ func _ready(): | |||
| 32 | apclient_instance.SCRIPT_panel = load("user://maps/Archipelago/panel.gd") | 32 | apclient_instance.SCRIPT_panel = load("user://maps/Archipelago/panel.gd") |
| 33 | var pilg_term = load("user://maps/Archipelago/pilgrimage_terminator.gd") | 33 | var pilg_term = load("user://maps/Archipelago/pilgrimage_terminator.gd") |
| 34 | apclient_instance.SCRIPT_pilgrimage_terminator = pilg_term | 34 | apclient_instance.SCRIPT_pilgrimage_terminator = pilg_term |
| 35 | apclient_instance.SCRIPT_textclient = load("user://maps/Archipelago/textclient.gd") | ||
| 35 | apclient_instance.SCRIPT_uuid = load("user://maps/Archipelago/vendor/uuid.gd") | 36 | apclient_instance.SCRIPT_uuid = load("user://maps/Archipelago/vendor/uuid.gd") |
| 36 | 37 | ||
| 37 | var apdata = ResourceLoader.load("user://maps/Archipelago/gamedata.gd") | 38 | var apdata = ResourceLoader.load("user://maps/Archipelago/gamedata.gd") |
| diff --git a/Archipelago/textclient.gd b/Archipelago/textclient.gd new file mode 100644 index 0000000..7bddf38 --- /dev/null +++ b/Archipelago/textclient.gd | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | extends Node | ||
| 2 | |||
| 3 | var panel | ||
| 4 | var label | ||
| 5 | var entry | ||
| 6 | var is_open = false | ||
| 7 | |||
| 8 | |||
| 9 | func _ready(): | ||
| 10 | pause_mode = PAUSE_MODE_PROCESS | ||
| 11 | |||
| 12 | panel = Panel.new() | ||
| 13 | panel.set_name("Panel") | ||
| 14 | panel.margin_left = 100 | ||
| 15 | panel.margin_right = 1820 | ||
| 16 | panel.margin_top = 100 | ||
| 17 | panel.margin_bottom = 980 | ||
| 18 | panel.visible = false | ||
| 19 | add_child(panel) | ||
| 20 | |||
| 21 | label = RichTextLabel.new() | ||
| 22 | label.set_name("Label") | ||
| 23 | label.margin_left = 80 | ||
| 24 | label.margin_right = 1640 | ||
| 25 | label.margin_top = 80 | ||
| 26 | label.margin_bottom = 720 | ||
| 27 | label.scroll_following = true | ||
| 28 | panel.add_child(label) | ||
| 29 | |||
| 30 | var dynamic_font = DynamicFont.new() | ||
| 31 | dynamic_font.font_data = load("res://fonts/Lingo.ttf") | ||
| 32 | dynamic_font.size = 36 | ||
| 33 | label.push_font(dynamic_font) | ||
| 34 | |||
| 35 | var entry_style = StyleBoxFlat.new() | ||
| 36 | entry_style.bg_color = Color(0.9, 0.9, 0.9, 1) | ||
| 37 | |||
| 38 | entry = LineEdit.new() | ||
| 39 | entry.set_name("Entry") | ||
| 40 | entry.margin_left = 80 | ||
| 41 | entry.margin_right = 1640 | ||
| 42 | entry.margin_top = 760 | ||
| 43 | entry.margin_bottom = 840 | ||
| 44 | entry.add_font_override("font", dynamic_font) | ||
| 45 | entry.add_color_override("font_color", Color(0, 0, 0, 1)) | ||
| 46 | entry.add_color_override("cursor_color", Color(0, 0, 0, 1)) | ||
| 47 | entry.add_stylebox_override("focus", entry_style) | ||
| 48 | panel.add_child(entry) | ||
| 49 | entry.connect("text_entered", self, "text_entered") | ||
| 50 | |||
| 51 | |||
| 52 | func _input(event): | ||
| 53 | if event is InputEventKey and event.pressed: | ||
| 54 | if event.scancode == KEY_TAB: | ||
| 55 | if !get_tree().paused: | ||
| 56 | is_open = true | ||
| 57 | get_tree().paused = true | ||
| 58 | Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) | ||
| 59 | panel.visible = true | ||
| 60 | entry.grab_focus() | ||
| 61 | get_tree().set_input_as_handled() | ||
| 62 | else: | ||
| 63 | dismiss() | ||
| 64 | elif event.scancode == KEY_ESCAPE: | ||
| 65 | if is_open: | ||
| 66 | dismiss() | ||
| 67 | get_tree().set_input_as_handled() | ||
| 68 | |||
| 69 | |||
| 70 | func dismiss(): | ||
| 71 | if is_open: | ||
| 72 | get_tree().paused = false | ||
| 73 | Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) | ||
| 74 | panel.visible = false | ||
| 75 | is_open = false | ||
| 76 | |||
| 77 | |||
| 78 | func parse_printjson(text): | ||
| 79 | if !label.text.empty(): | ||
| 80 | label.append_bbcode("\n") | ||
| 81 | |||
| 82 | label.append_bbcode(text) | ||
| 83 | |||
| 84 | |||
| 85 | func text_entered(text): | ||
| 86 | var apclient = global.get_node("Archipelago") | ||
| 87 | apclient.say(text.trim_suffix("\n")) | ||
| 88 | entry.text = "" | ||
| diff --git a/CHANGELOG.md b/CHANGELOG.md index 1174ce7..d00999c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
| @@ -1,5 +1,15 @@ | |||
| 1 | # lingo-archipelago Releases | 1 | # lingo-archipelago Releases |
| 2 | 2 | ||
| 3 | ## v4.1.0 - 2024-09-02 | ||
| 4 | |||
| 5 | - Added an in-game text client, which can be used to talk to other players and | ||
| 6 | issue commands, similar to the official Archipelago Text Client app. Press TAB | ||
| 7 | to open or close the text client. | ||
| 8 | |||
| 9 | Download: | ||
| 10 | [lingo-archipelago-v4.1.0.zip](https://files.fourisland.com/releases/lingo-archipelago/lingo-archipelago-v4.1.0.zip)<br/> | ||
| 11 | Source: [v4.1.0](https://code.fourisland.com/lingo-archipelago/tag/?h=v4.1.0) | ||
| 12 | |||
| 3 | ## v4.0.2 - 2024-07-14 | 13 | ## v4.0.2 - 2024-07-14 |
| 4 | 14 | ||
| 5 | - Multiplayer mode now shows a player's alias in addition to their slot name. | 15 | - Multiplayer mode now shows a player's alias in addition to their slot name. |
| diff --git a/README.md b/README.md index a242f95..a8491d6 100644 --- a/README.md +++ b/README.md | |||
| @@ -92,6 +92,9 @@ pick and choose which ones you would like to use. | |||
| 92 | the numbering can change. You can also specify whether access to the sunwarps | 92 | the numbering can change. You can also specify whether access to the sunwarps |
| 93 | should be locked behind receiving certain items. | 93 | should be locked behind receiving certain items. |
| 94 | 94 | ||
| 95 | There is also a built-in text client you can use to talk to other players and | ||
| 96 | issue commands. You can open and close it by pressing tab. | ||
| 97 | |||
| 95 | ## Frequently Asked Questions | 98 | ## Frequently Asked Questions |
| 96 | 99 | ||
| 97 | ### What are location checks in this game? | 100 | ### What are location checks in this game? |
