about summary refs log tree commit diff stats
path: root/Archipelago/messages.gd
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-04-14 11:32:40 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-04-14 11:32:40 -0400
commitdeab7140f9415f0f5fea9240a291b976e507593f (patch)
tree1ce784f6b89bd6560fff3367a9ffe3891e6edfe8 /Archipelago/messages.gd
parentce9cc1c0ef41d342802798cad51d6dbe6ae49fe4 (diff)
downloadlingo-archipelago-deab7140f9415f0f5fea9240a291b976e507593f.tar.gz
lingo-archipelago-deab7140f9415f0f5fea9240a291b976e507593f.tar.bz2
lingo-archipelago-deab7140f9415f0f5fea9240a291b976e507593f.zip
Created rudimentary message display
It shows when the player sends a location or receives an item. Currently it just shows IDs instead of names. We need to download all data packages so that we can read the names. We are also currently queueing a message when we send a location, which isn't the best because if that location turns out to contain an item for us, we'll get two messages. It would be better to hold off until we receive a PrintJSON message describing the location that was sent out.

We also now cache the ID of the most recently processed item, so that on relaunch we know which items are new and should be announced.
Diffstat (limited to 'Archipelago/messages.gd')
-rw-r--r--Archipelago/messages.gd35
1 files changed, 35 insertions, 0 deletions
diff --git a/Archipelago/messages.gd b/Archipelago/messages.gd new file mode 100644 index 0000000..63ce182 --- /dev/null +++ b/Archipelago/messages.gd
@@ -0,0 +1,35 @@
1extends Node
2
3
4func _ready():
5 var label = Label.new()
6 label.set_name("label")
7 label.margin_right = 1920.0
8 label.margin_bottom = 1080.0 - 20
9 label.margin_left = 20.0
10 label.align = Label.ALIGN_LEFT
11 label.valign = Label.VALIGN_BOTTOM
12
13 var dynamic_font = DynamicFont.new()
14 dynamic_font.font_data = load("res://fonts/Lingo.ttf")
15 dynamic_font.size = 36
16 dynamic_font.outline_color = Color(0, 0, 0, 1)
17 dynamic_font.outline_size = 2
18 label.add_font_override("font", dynamic_font)
19
20 add_child(label)
21
22
23func showMessage(text):
24 var label = self.get_node("label")
25 if !label.text == "":
26 label.text += "\n"
27 label.text += text
28
29 yield(get_tree().create_timer(10.0), "timeout")
30
31 var newline = label.text.find("\n")
32 if newline == -1:
33 label.text = ""
34 else:
35 label.text = label.text.substr(newline + 1)