aboutsummaryrefslogtreecommitdiff
path: root/client/gui
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-09-27 22:07:11 +0200
committermetamuffin <metamuffin@disroot.org>2025-09-27 22:07:19 +0200
commit46897ebdbe69145d6e9290c474c8ac426372226e (patch)
treee23e38de34c8c80f2b691228da201db828d09dac /client/gui
parent481ca4dc8d03d2e2b10fffbed5fa8ce58f7291bb (diff)
downloadhurrycurry-46897ebdbe69145d6e9290c474c8ac426372226e.tar
hurrycurry-46897ebdbe69145d6e9290c474c8ac426372226e.tar.bz2
hurrycurry-46897ebdbe69145d6e9290c474c8ac426372226e.tar.zst
Chat system messages
Diffstat (limited to 'client/gui')
-rw-r--r--client/gui/components/message/chat_message.gd14
-rw-r--r--client/gui/menus/game.gd12
2 files changed, 16 insertions, 10 deletions
diff --git a/client/gui/components/message/chat_message.gd b/client/gui/components/message/chat_message.gd
index ce3dd0ca..27403701 100644
--- a/client/gui/components/message/chat_message.gd
+++ b/client/gui/components/message/chat_message.gd
@@ -20,13 +20,15 @@ class_name ChatMessage
@onready var sender_label: Label = $Sender
@onready var message_label: Label = $MarginContainer/Message
-func set_message(username: String, message: String, username_color: Color, fade_away: bool = false, fade_time: float = 5.):
- sender_label.text = "<%s>" % username
+func set_message(username, message: String, username_color: Color, fade_away: bool = false, fade_time: float = 5.):
+ if username == null:
+ sender_label.hide()
+ message_label.add_theme_color_override("font_color", username_color)
+ else:
+ sender_label.text = "<%s>" % username
+ sender_label.add_theme_color_override("font_color", username_color.lightened(.5))
message_label.text = message
- sender_label.add_theme_color_override("font_color", username_color.lightened(.5))
-
- if fade_away:
- fade_away_timer.start(fade_time)
+ if fade_away: fade_away_timer.start(fade_time)
func _on_fade_away_timeout() -> void:
queue_free()
diff --git a/client/gui/menus/game.gd b/client/gui/menus/game.gd
index 0466d287..e0ab5de7 100644
--- a/client/gui/menus/game.gd
+++ b/client/gui/menus/game.gd
@@ -25,13 +25,12 @@ func _ready():
get_tree().get_root().go_back_requested.connect(open_ingame_menu)
super()
transition.set_loading_text(tr("c.menu.game.connecting"))
-
Settings.hook_changed_init("gameplay.first_person", "mouse_lock", func (_a): update_mouse_capture())
func _input(_event):
if Input.is_action_just_pressed("ui_menu"):
open_ingame_menu()
-
+
if Input.is_action_just_pressed("chat"):
Sound.play_click()
chat_preview.visible = false
@@ -39,13 +38,17 @@ func _input(_event):
chat_preview.visible = true
if Input.is_action_just_pressed("screenshot"):
- get_viewport().get_texture().get_image().save_png(get_shot_path("screenshot-%s.png"))
+ var path = get_shot_path("screenshot-%s.png")
+ get_viewport().get_texture().get_image().save_png(path)
+ game.system_message(tr("c.system_message.screenshot_saved").format({"path": path}))
if Input.is_action_just_pressed("sceneshot"):
+ var path = get_shot_path("sceneshot-%s.glb")
var doc := GLTFDocument.new()
var state := GLTFState.new()
doc.append_from_scene(game, state)
- doc.write_to_filesystem(state, get_shot_path("sceneshot-%s.glb"))
+ doc.write_to_filesystem(state, path)
+ game.system_message(tr("c.system_message.sceneshot_saved").format({"path": path}))
if Input.is_action_just_pressed("toggle_first_person"):
Settings.write("gameplay.first_person", not Settings.read("gameplay.first_person"))
@@ -61,6 +64,7 @@ func _menu_cover(state):
game.follow_camera.disable_input_menu = state
game.follow_camera.update_disable_input()
update_mouse_capture()
+
func _menu_exit():
super()
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE