feat: take_powerup VFX, rank fix, admin chat management
- Wire take_powerup AnimatedSprite3D on powerup pickup via add_powerup_from_item() - Make take_powerup animation one-shot (loop: false) - Fix rank Position label hidden at game start (visible = false, only shows when score > 0) - Competition ranking for tied scores in main.gd - Lobby Chat admin tab: system prefix, max messages, wipe, purge old, save config - Chat Storage admin tab: list/browse/delete individual channel messages - Backend RPCs: admin_get_chat_config, admin_set_chat_config, admin_purge_old_messages, admin_list_channel_messages, admin_delete_channel_message - Chat config applied on lobby join (max_messages, prefix injection)
This commit is contained in:
+21
-3
@@ -9,6 +9,7 @@ var _chat_messages: Array = []
|
||||
var _active_chat_context: String = "global"
|
||||
var _dm_tabs: Dictionary = {}
|
||||
var _dm_messages: Dictionary = {}
|
||||
var _chat_config: Dictionary = {"prefix": "", "max_messages": 50, "max_age_days": 0}
|
||||
|
||||
func _init(p_lobby: Control):
|
||||
lobby = p_lobby
|
||||
@@ -40,17 +41,34 @@ func join_global_chat() -> void:
|
||||
|
||||
_chat_channel = result
|
||||
print("[Chat] Joined global channel: ", _chat_channel.id)
|
||||
|
||||
|
||||
if not socket.received_channel_message.is_connected(_on_chat_message_received):
|
||||
socket.received_channel_message.connect(_on_chat_message_received)
|
||||
|
||||
|
||||
# Fetch admin chat config (prefix, max_messages, etc.)
|
||||
if BackendService.has_method("admin_get_chat_config"):
|
||||
var cfg_res = await BackendService.admin_get_chat_config()
|
||||
if cfg_res.has("config"):
|
||||
_chat_config = cfg_res["config"]
|
||||
|
||||
_chat_messages.clear()
|
||||
var history_result = await NakamaManager.client.list_channel_messages_async(NakamaManager.session, _chat_channel.id, 50, false)
|
||||
var limit: int = _chat_config.get("max_messages", 50)
|
||||
var history_result = await NakamaManager.client.list_channel_messages_async(NakamaManager.session, _chat_channel.id, limit, false)
|
||||
if not history_result.is_exception() and history_result.messages:
|
||||
var msgs = history_result.messages.duplicate()
|
||||
msgs.reverse()
|
||||
for msg in msgs:
|
||||
_add_chat_message(msg, false)
|
||||
|
||||
# Inject admin system prefix if configured
|
||||
var prefix: String = _chat_config.get("prefix", "")
|
||||
if not prefix.is_empty():
|
||||
_chat_messages.insert(0, {
|
||||
"sender": "SYSTEM",
|
||||
"content": prefix,
|
||||
"ts": _get_local_time(),
|
||||
"date": Time.get_date_string_from_system()
|
||||
})
|
||||
|
||||
_trim_old_messages()
|
||||
_refresh_chat_display()
|
||||
|
||||
Reference in New Issue
Block a user