update
This commit is contained in:
@@ -138,10 +138,22 @@ const MESSAGE_DURATION := 4.0
|
||||
@onready var message_bar: PanelContainer = $MessageBar
|
||||
@onready var message_container: VBoxContainer = $MessageBar/MarginContainer/MessageContainer
|
||||
|
||||
var last_messages = {} # {player_name: {text: String, time: int}}
|
||||
|
||||
# Message types for different styling
|
||||
enum MessageType {NORMAL, POWERUP, GOAL, CYCLE, WARNING}
|
||||
|
||||
func add_message_to_bar(player_name: String, message: String, type: int = MessageType.NORMAL):
|
||||
# Deduplication check
|
||||
var current_time = Time.get_ticks_msec()
|
||||
if player_name in last_messages:
|
||||
var last = last_messages[player_name]
|
||||
# Ignore if same message within 2 seconds
|
||||
if last.text == message and current_time - last.time < 2000:
|
||||
return
|
||||
|
||||
last_messages[player_name] = {"text": message, "time": current_time}
|
||||
|
||||
if not message_container:
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user