From b4a046026e687a3b44ce2be0cbab1150bd3545ca Mon Sep 17 00:00:00 2001 From: tpart Date: Tue, 30 Sep 2025 14:34:30 +0200 Subject: Store if correct explanation for input device was shown in profile --- client/game.gd | 9 +++++---- client/gui/overlays/controls_visualization/explanation.gd | 11 ++++++++--- client/system/profile.gd | 6 ++++-- client/system/settings.gd | 3 +-- locale/en.ini | 1 - 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/client/game.gd b/client/game.gd index 9d2f7177..465c1aec 100644 --- a/client/game.gd +++ b/client/game.gd @@ -312,10 +312,11 @@ func handle_packet(p): elif not is_replay: menu.submenu("res://gui/menus/ingame.tscn") elif not in_lobby and not is_replay and not Global.using_touch and p.state: - if Global.hand_count == 1 and not Profile.read("controls_one_handed_explained"): - menu.submenu("res://gui/overlays/controls_visualization/explanation.tscn", false) - elif Global.hand_count == 2 and not Profile.read("controls_two_handed_explained"): - menu.submenu("res://gui/overlays/controls_visualization/explanation.tscn", true) + var using_joypad: bool = Global.using_joypad + var two_handed: bool = Global.hand_count >= 2 + var profile_name: String = "controls_%s_%s_handed_explained" % [("joypad" if using_joypad else "keyboard"), ("two" if two_handed else "one")] + if not Profile.read(profile_name): + menu.submenu("res://gui/overlays/controls_visualization/explanation.tscn", [profile_name, using_joypad, two_handed]) else: mp.send_ready() "score": diff --git a/client/gui/overlays/controls_visualization/explanation.gd b/client/gui/overlays/controls_visualization/explanation.gd index 47716a42..77147f1d 100644 --- a/client/gui/overlays/controls_visualization/explanation.gd +++ b/client/gui/overlays/controls_visualization/explanation.gd @@ -16,6 +16,8 @@ extends Menu class_name ControlsExplanation +var profile_name: String +var using_joypad: bool var two_handed: bool @onready var game: Game = $"../Game" @@ -25,15 +27,18 @@ var two_handed: bool @onready var controller_explanation: ControllerExplanation = $MarginContainer/PanelContainer/SmartMarginContainer/VBoxContainer/ControllerExplanation func _ready(): - two_handed = data + profile_name = data[0] + using_joypad = data[1] + two_handed = data[2] + @warning_ignore("incompatible_ternary") - var explanation: DeviceExplanation = controller_explanation if Global.using_joypad else keyboard_explanation + var explanation: DeviceExplanation = controller_explanation if using_joypad else keyboard_explanation explanation.visible = true explanation.toggle_double_handed(two_handed) title.text = tr("c.controls_explanation.two_handed") if two_handed else tr("c.settings.input") super() func _on_accept_pressed() -> void: - Profile.write("controls_" + ("two" if two_handed else "one") + "_handed_explained", true) + Profile.write(profile_name, true) game.mp.send_ready() exit() diff --git a/client/system/profile.gd b/client/system/profile.gd index 89496af5..dd4da430 100644 --- a/client/system/profile.gd +++ b/client/system/profile.gd @@ -26,8 +26,10 @@ static var default_profile := { "last_server_url": "", "tutorial_ingredients_played": [], "registry_asked": false, - "controls_one_handed_explained": false, - "controls_two_handed_explained": false + "controls_keyboard_one_handed_explained": false, + "controls_keyboard_two_handed_explained": false, + "controls_joypad_one_handed_explained": false, + "controls_joypad_two_handed_explained": false } # profile is stored in a Dictionary[String, Any] diff --git a/client/system/settings.gd b/client/system/settings.gd index 734492ae..e7f3e2f7 100644 --- a/client/system/settings.gd +++ b/client/system/settings.gd @@ -26,7 +26,6 @@ static func get_root(): ToggleSetting.new("interpolate_camera_rotation", false), ButtonSetting.new("setup_completed", false, launch_setup), ToggleSetting.new("tutorial_disabled", false), - ToggleSetting.new("hints_started", false), ToggleSetting.new("accessible_movement", false), ToggleSetting.new("first_person", false), DropdownSetting.new("interact_target", "dirsnap", ["dir", "dirsnap"]), @@ -195,4 +194,4 @@ static func h_fullscreen(mode: String): "keep": pass "always": DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN) "never": if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN: - DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) \ No newline at end of file + DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) diff --git a/locale/en.ini b/locale/en.ini index b5b3849b..20e5718f 100644 --- a/locale/en.ini +++ b/locale/en.ini @@ -101,7 +101,6 @@ c.settings.audio.sfx_volume=SFX Volume c.settings.audio=Audio c.settings.gameplay.accessible_movement=Accessible movement controls c.settings.gameplay.first_person=Enable first-person mode (reduces playability) -c.settings.gameplay.hints_started=Hints started c.settings.gameplay.interact_target.dir=Based on look direction (old behaviour) c.settings.gameplay.interact_target.dirsnap=Snap to interactable tile close to look direction c.settings.gameplay.interact_target=Interact Target Behaviour -- cgit v1.2.3-70-g09d2