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:
2026-06-19 17:13:24 +08:00
parent cd584f5599
commit 15043b5655
12 changed files with 818 additions and 7 deletions
+138
View File
@@ -544,6 +544,144 @@ text = "Load Current"
unique_name_in_owner = true
custom_minimum_size = Vector2(160, 36)
layout_mode = 2
[node name="Lobby Chat" type="VBoxContainer" parent="Margin/VBox/Tabs"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="PrefixRow" type="HBoxContainer" parent="Margin/VBox/Tabs/Lobby Chat"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="Label" type="Label" parent="Margin/VBox/Tabs/Lobby Chat/PrefixRow"]
layout_mode = 2
custom_minimum_size = Vector2(220, 0)
text = "System Prefix:"
[node name="PrefixEdit" type="LineEdit" parent="Margin/VBox/Tabs/Lobby Chat/PrefixRow"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
placeholder_text = "[SERVER]"
[node name="MaxMsgRow" type="HBoxContainer" parent="Margin/VBox/Tabs/Lobby Chat"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="Label" type="Label" parent="Margin/VBox/Tabs/Lobby Chat/MaxMsgRow"]
layout_mode = 2
custom_minimum_size = Vector2(220, 0)
text = "Max messages loaded:"
[node name="MaxMsgSpin" type="SpinBox" parent="Margin/VBox/Tabs/Lobby Chat/MaxMsgRow"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(120, 0)
min_value = 10.0
max_value = 200.0
step = 10.0
value = 50.0
[node name="MaxAgeRow" type="HBoxContainer" parent="Margin/VBox/Tabs/Lobby Chat"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="Label" type="Label" parent="Margin/VBox/Tabs/Lobby Chat/MaxAgeRow"]
layout_mode = 2
custom_minimum_size = Vector2(220, 0)
text = "Delete messages older than (days):"
[node name="MaxAgeSpin" type="SpinBox" parent="Margin/VBox/Tabs/Lobby Chat/MaxAgeRow"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(120, 0)
min_value = 0.0
max_value = 365.0
step = 1.0
value = 0.0
tooltip_text = "0 = don't auto-delete, use manual purge only"
[node name="ChatActions" type="HBoxContainer" parent="Margin/VBox/Tabs/Lobby Chat"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="WipeChatBtn" type="Button" parent="Margin/VBox/Tabs/Lobby Chat/ChatActions"]
unique_name_in_owner = true
custom_minimum_size = Vector2(140, 36)
layout_mode = 2
text = "Wipe Chat"
[node name="PurgeOldBtn" type="Button" parent="Margin/VBox/Tabs/Lobby Chat/ChatActions"]
unique_name_in_owner = true
custom_minimum_size = Vector2(140, 36)
layout_mode = 2
text = "Purge Old"
[node name="SaveConfigBtn" type="Button" parent="Margin/VBox/Tabs/Lobby Chat/ChatActions"]
unique_name_in_owner = true
custom_minimum_size = Vector2(140, 36)
layout_mode = 2
text = "Save Config"
[node name="ChatStatusLabel" type="Label" parent="Margin/VBox/Tabs/Lobby Chat"]
unique_name_in_owner = true
layout_mode = 2
text = ""
[node name="Chat Storage" type="VBoxContainer" parent="Margin/VBox/Tabs"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="ChannelIdRow" type="HBoxContainer" parent="Margin/VBox/Tabs/Chat Storage"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="Label" type="Label" parent="Margin/VBox/Tabs/Chat Storage/ChannelIdRow"]
layout_mode = 2
text = "Channel ID:"
[node name="ChannelIdEdit" type="LineEdit" parent="Margin/VBox/Tabs/Chat Storage/ChannelIdRow"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
placeholder_text = "Enter channel ID..."
[node name="LoadMessagesBtn" type="Button" parent="Margin/VBox/Tabs/Chat Storage/ChannelIdRow"]
unique_name_in_owner = true
custom_minimum_size = Vector2(100, 0)
layout_mode = 2
text = "Load"
[node name="ChatTree" type="Tree" parent="Margin/VBox/Tabs/Chat Storage"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
columns = 4
column_titles_visible = true
allow_reselect = true
hide_root = true
select_mode = 1
[node name="ChatStorageActionBar" type="HBoxContainer" parent="Margin/VBox/Tabs/Chat Storage"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="RefreshChatBtn" type="Button" parent="Margin/VBox/Tabs/Chat Storage/ChatStorageActionBar"]
unique_name_in_owner = true
custom_minimum_size = Vector2(100, 36)
layout_mode = 2
text = "Refresh"
[node name="Spacer" type="Control" parent="Margin/VBox/Tabs/Chat Storage/ChatStorageActionBar"]
layout_mode = 2
size_flags_horizontal = 3
[node name="DeleteSelectedBtn" type="Button" parent="Margin/VBox/Tabs/Chat Storage/ChatStorageActionBar"]
unique_name_in_owner = true
custom_minimum_size = Vector2(120, 36)
layout_mode = 2
text = "Delete Selected"
[node name="HistoryDialog" type="AcceptDialog" parent="."]
unique_name_in_owner = true
title = "User History"
+21 -3
View File
@@ -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()