diff options
author | metamuffin <metamuffin@disroot.org> | 2025-09-24 00:00:36 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-09-24 00:00:36 +0200 |
commit | a759c6743dccbc77464df91173b670339208afa4 (patch) | |
tree | 85bc7ccd49842372ba207e198f66b7942749fb1a /client/gui/menus/game.gd | |
parent | 83903a571109a47d74d0be2892cc51ed8c26a335 (diff) | |
download | hurrycurry-a759c6743dccbc77464df91173b670339208afa4.tar hurrycurry-a759c6743dccbc77464df91173b670339208afa4.tar.bz2 hurrycurry-a759c6743dccbc77464df91173b670339208afa4.tar.zst |
Improve first person controller
Diffstat (limited to 'client/gui/menus/game.gd')
-rw-r--r-- | client/gui/menus/game.gd | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/client/gui/menus/game.gd b/client/gui/menus/game.gd index a730e385..0466d287 100644 --- a/client/gui/menus/game.gd +++ b/client/gui/menus/game.gd @@ -25,6 +25,8 @@ 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"): @@ -55,8 +57,17 @@ func get_shot_path(template: String) -> String: return "%s/%s" % [path, filename] func _menu_cover(state): + super(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 + +func update_mouse_capture(): + var cap = Settings.read("gameplay.first_person") and not covered + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED if cap else Input.MOUSE_MODE_VISIBLE func open_ingame_menu(): if popup != null: return |