diff options
-rw-r--r-- | Archipelago/client.gd | 6 | ||||
-rw-r--r-- | Archipelago/load.gd | 8 | ||||
-rw-r--r-- | Archipelago/messages.gd | 62 |
3 files changed, 4 insertions, 72 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index b7050b6..12e5e99 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd | |||
@@ -362,7 +362,7 @@ func _on_data(): | |||
362 | 362 | ||
363 | var item_color = colorForItemType(message["item"]["flags"]) | 363 | var item_color = colorForItemType(message["item"]["flags"]) |
364 | 364 | ||
365 | var messages_node = get_tree().get_root().get_node("Spatial/AP_Messages") | 365 | var messages_node = get_tree().get_root().get_node("Spatial/Messages") |
366 | if message["type"] == "Hint": | 366 | if message["type"] == "Hint": |
367 | var is_for = "" | 367 | var is_for = "" |
368 | if message["receiving"] != _slot: | 368 | if message["receiving"] != _slot: |
@@ -387,7 +387,7 @@ func _on_data(): | |||
387 | and message.has("data") | 387 | and message.has("data") |
388 | and message["tags"].has("DeathLink") | 388 | and message["tags"].has("DeathLink") |
389 | ): | 389 | ): |
390 | var messages_node = get_tree().get_root().get_node("Spatial/AP_Messages") | 390 | var messages_node = get_tree().get_root().get_node("Spatial/Messages") |
391 | var first_sentence = "Received Death" | 391 | var first_sentence = "Received Death" |
392 | var second_sentence = "" | 392 | var second_sentence = "" |
393 | if message["data"].has("source"): | 393 | if message["data"].has("source"): |
@@ -613,7 +613,7 @@ func processItem(item, index, from, flags): | |||
613 | 613 | ||
614 | var item_color = colorForItemType(flags) | 614 | var item_color = colorForItemType(flags) |
615 | 615 | ||
616 | var messages_node = get_tree().get_root().get_node("Spatial/AP_Messages") | 616 | var messages_node = get_tree().get_root().get_node("Spatial/Messages") |
617 | if from == _slot: | 617 | if from == _slot: |
618 | messages_node.showMessage("Found [color=%s]%s[/color]" % [item_color, item_name]) | 618 | messages_node.showMessage("Found [color=%s]%s[/color]" % [item_color, item_name]) |
619 | else: | 619 | else: |
diff --git a/Archipelago/load.gd b/Archipelago/load.gd index c637ccb..6deafa9 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd | |||
@@ -289,12 +289,6 @@ func _load(): | |||
289 | "answer_correct", apclient, "completedGoal" | 289 | "answer_correct", apclient, "completedGoal" |
290 | ) | 290 | ) |
291 | 291 | ||
292 | # Create the messages node. | ||
293 | var messages_script = ResourceLoader.load("user://maps/Archipelago/messages.gd") | ||
294 | var messages = messages_script.new() | ||
295 | messages.set_name("AP_Messages") | ||
296 | self.add_child(messages) | ||
297 | |||
298 | # Create the effects node. | 292 | # Create the effects node. |
299 | var effects_script = ResourceLoader.load("user://maps/Archipelago/effects.gd") | 293 | var effects_script = ResourceLoader.load("user://maps/Archipelago/effects.gd") |
300 | var effects = effects_script.new() | 294 | var effects = effects_script.new() |
@@ -366,5 +360,5 @@ func set_gridmap_tile(x, y, z, tile): | |||
366 | 360 | ||
367 | 361 | ||
368 | func archipelago_disconnected(reason): | 362 | func archipelago_disconnected(reason): |
369 | var messages_node = self.get_node("AP_Messages") | 363 | var messages_node = self.get_node("Messages") |
370 | messages_node.show_message(reason) | 364 | messages_node.show_message(reason) |
diff --git a/Archipelago/messages.gd b/Archipelago/messages.gd deleted file mode 100644 index fbe7564..0000000 --- a/Archipelago/messages.gd +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | extends Node | ||
2 | |||
3 | var _message_queue = [] | ||
4 | var _font | ||
5 | var _container | ||
6 | var _ordered_labels = [] | ||
7 | |||
8 | |||
9 | func _ready(): | ||
10 | _container = VBoxContainer.new() | ||
11 | _container.set_name("Container") | ||
12 | _container.anchor_bottom = 1 | ||
13 | _container.margin_left = 20.0 | ||
14 | _container.margin_right = 1920.0 | ||
15 | _container.margin_top = 0.0 | ||
16 | _container.margin_bottom = -20.0 | ||
17 | _container.alignment = BoxContainer.ALIGN_END | ||
18 | _container.mouse_filter = Control.MOUSE_FILTER_IGNORE | ||
19 | self.add_child(_container) | ||
20 | |||
21 | _font = DynamicFont.new() | ||
22 | _font.font_data = load("res://fonts/Lingo.ttf") | ||
23 | _font.size = 36 | ||
24 | _font.outline_color = Color(0, 0, 0, 1) | ||
25 | _font.outline_size = 2 | ||
26 | |||
27 | |||
28 | func _add_message(text): | ||
29 | var new_label = RichTextLabel.new() | ||
30 | new_label.push_font(_font) | ||
31 | new_label.append_bbcode(text) | ||
32 | new_label.fit_content_height = true | ||
33 | |||
34 | _container.add_child(new_label) | ||
35 | _ordered_labels.push_back(new_label) | ||
36 | |||
37 | |||
38 | func showMessage(text): | ||
39 | if _ordered_labels.size() >= 9: | ||
40 | _message_queue.append(text) | ||
41 | return | ||
42 | |||
43 | _add_message(text) | ||
44 | |||
45 | if _ordered_labels.size() > 1: | ||
46 | return | ||
47 | |||
48 | var timeout = 10.0 | ||
49 | while !_ordered_labels.empty(): | ||
50 | yield(get_tree().create_timer(timeout), "timeout") | ||
51 | |||
52 | var to_remove = _ordered_labels.pop_front() | ||
53 | var to_tween = get_tree().create_tween().bind_node(to_remove) | ||
54 | to_tween.tween_property(to_remove, "modulate:a", 0.0, 0.5) | ||
55 | to_tween.tween_callback(to_remove, "queue_free") | ||
56 | |||
57 | if !_message_queue.empty(): | ||
58 | var next_msg = _message_queue.pop_front() | ||
59 | _add_message(next_msg) | ||
60 | |||
61 | if timeout > 4: | ||
62 | timeout -= 3 | ||