fix(chat): support body and content fields in world and DM chat messages; feat(audio): add sound toggle switch and mute controls
checkpoint / checkpoint (push) Successful in 6m11s

This commit is contained in:
2026-09-19 13:38:23 +00:00
parent 7b693899a7
commit 7abf37ea81
13 changed files with 558 additions and 14 deletions
+41 -1
View File
@@ -188,6 +188,13 @@ func _unhandled_input(event: InputEvent) -> void:
get_viewport().set_input_as_handled()
_toggle_friends_overlay()
return
elif event.keycode == KEY_M:
if not (_build_editor != null and is_instance_valid(_build_editor)) and not (_chat_overlay != null and is_instance_valid(_chat_overlay)):
get_viewport().set_input_as_handled()
var audio_mgr = get_node_or_null("/root/AudioManager")
if audio_mgr and audio_mgr.has_method("toggle_sound"):
audio_mgr.toggle_sound()
return
if event.is_action_pressed("toggle_build_mode"):
get_viewport().set_input_as_handled()
@@ -263,6 +270,27 @@ func _setup_in_game_hud() -> void:
report_btn.pressed.connect(_toggle_report_modal)
bar.add_child(report_btn)
var sound_btn := Button.new()
sound_btn.name = "SoundButton"
_update_hud_sound_button(sound_btn)
sound_btn.pressed.connect(func():
var audio_mgr = get_node_or_null("/root/AudioManager")
if audio_mgr and audio_mgr.has_method("toggle_sound"):
audio_mgr.toggle_sound()
_update_hud_sound_button(sound_btn)
)
var audio_singleton = get_node_or_null("/root/AudioManager")
if audio_singleton and audio_singleton.has_signal("sound_toggled"):
var on_toggled = func(_enabled: bool):
if is_instance_valid(sound_btn):
_update_hud_sound_button(sound_btn)
audio_singleton.sound_toggled.connect(on_toggled)
sound_btn.tree_exiting.connect(func():
if is_instance_valid(audio_singleton) and audio_singleton.sound_toggled.is_connected(on_toggled):
audio_singleton.sound_toggled.disconnect(on_toggled)
)
bar.add_child(sound_btn)
var exit_btn := Button.new()
exit_btn.text = "🚪 Menu [ESC]"
exit_btn.pressed.connect(func():
@@ -301,7 +329,7 @@ func _setup_in_game_hud() -> void:
controls_pill.offset_right = -220
var hint_lbl := Label.new()
hint_lbl.text = "[W][A][S][D] Move [Space] Jump [E] Interact [F1] Friends [T] Chat [F2] Build [ESC] Menu"
hint_lbl.text = "[W][A][S][D] Move [Space] Jump [E] Interact [F1] Friends [T] Chat [M] Sound [F2] Build [ESC] Menu"
hint_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
hint_lbl.add_theme_font_size_override("font_size", 12)
hint_lbl.add_theme_color_override("font_color", Color(0.85, 0.9, 0.95, 0.85))
@@ -336,6 +364,18 @@ func _setup_in_game_hud() -> void:
_hud_layer.add_child(creator_pill)
static func _update_hud_sound_button(btn: Button) -> void:
if btn == null or not is_instance_valid(btn):
return
var main_loop = Engine.get_main_loop()
var audio_mgr: Node = main_loop.root.get_node_or_null("AudioManager") if main_loop is SceneTree else null
var enabled: bool = audio_mgr.is_sound_enabled() if audio_mgr and audio_mgr.has_method("is_sound_enabled") else true
if enabled:
btn.text = "🔊 Sound [M]"
else:
btn.text = "🔇 Muted [M]"
func _toggle_report_modal() -> void:
if _report_modal != null and is_instance_valid(_report_modal):
_close_report_modal()