summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2024-09-25 15:45:28 +0200
committertpart <tpart120@proton.me>2024-09-25 15:45:33 +0200
commit511bed5e6ed201e3464820bdd3857d3596e846f1 (patch)
tree377e826a65564c3d09409a3f14668dcce7e2babf /client
parent2e9a6d32552258337c0c1402fa4119d40d68c47b (diff)
downloadhurrycurry-511bed5e6ed201e3464820bdd3857d3596e846f1.tar
hurrycurry-511bed5e6ed201e3464820bdd3857d3596e846f1.tar.bz2
hurrycurry-511bed5e6ed201e3464820bdd3857d3596e846f1.tar.zst
Clear pinned messages
Diffstat (limited to 'client')
-rw-r--r--client/game.gd7
-rw-r--r--client/menu/communicate/popup_message/pinned_item_messages.gd10
2 files changed, 15 insertions, 2 deletions
diff --git a/client/game.gd b/client/game.gd
index 86e5737a..a1bb997c 100644
--- a/client/game.gd
+++ b/client/game.gd
@@ -108,6 +108,9 @@ func handle_packet(p):
update_players.emit(players)
"remove_player":
var player: Player = players.get(p.id)
+ if player.is_customer and player.current_item_message != null:
+ tutorial_queue.erase(player.current_item_message)
+ pinned_items.clear_item(p.id)
if p.id == player_id:
is_joined = false
left.emit()
@@ -118,6 +121,7 @@ func handle_packet(p):
players.erase(p.id)
player.queue_free()
update_players.emit(players)
+
"movement":
var player_instance: Player = players[p.player]
player_instance.update_position(p.pos, p.rot, p.boost)
@@ -191,7 +195,7 @@ func handle_packet(p):
ingredients.append_array(parsed_item.contents)
if pinned:
- pinned_items.pin_item(item_name, timeout_initial, timeout_remaining)
+ pinned_items.pin_item(item_name, timeout_initial, timeout_remaining, p.player)
var player: Player = players[p.player]
player.item_message(item_name, timeout_initial, timeout_remaining)
@@ -222,6 +226,7 @@ func handle_packet(p):
if player.is_customer and player.current_item_message != null:
tutorial_queue.erase(player.current_item_message)
player.clear_message()
+ pinned_items.clear_item(p.player)
"effect":
players[p.player].effect_message(p.name)
"set_ingame":
diff --git a/client/menu/communicate/popup_message/pinned_item_messages.gd b/client/menu/communicate/popup_message/pinned_item_messages.gd
index 7343865c..e4507fa7 100644
--- a/client/menu/communicate/popup_message/pinned_item_messages.gd
+++ b/client/menu/communicate/popup_message/pinned_item_messages.gd
@@ -19,9 +19,11 @@ class_name PinnedItemMessages
const ITEM_MESSAGE_SCENE := preload("res://menu/communicate/item/item_message.tscn")
const PAPER_PANEL_STYLE := preload("res://menu/theme/paper_panel_style.tres")
+var pinned_items := {}
+
@onready var pinned_items_container: HBoxContainer = $HBoxContainer
-func pin_item(item_name: String, timeout_initial_: float, timeout_remaining_: float):
+func pin_item(item_name: String, timeout_initial_: float, timeout_remaining_: float, player_id: float):
var item_message: ItemMessage = ITEM_MESSAGE_SCENE.instantiate()
item_message.remove_theme_stylebox_override("panel")
item_message.add_theme_stylebox_override("panel", PAPER_PANEL_STYLE)
@@ -30,3 +32,9 @@ func pin_item(item_name: String, timeout_initial_: float, timeout_remaining_: fl
item_message.set_round_corner_radius_progress(0)
item_message.set_item(item_name, timeout_initial_, timeout_remaining_)
+
+ pinned_items[player_id] = item_message
+
+func clear_item(player_id: float):
+ if player_id in pinned_items:
+ pinned_items[player_id].queue_free()