From 2a53e4be5a9137ff6d4176a8cb722ebef0974183 Mon Sep 17 00:00:00 2001 From: betalars Date: Wed, 3 Jun 2026 14:56:24 +0200 Subject: [PATCH] #5 REVERT ME ripping out skeleton of modal switching that was accidentally included in the wrong commit --- src/singletons/global_state.gd | 60 -------------------------- src/steam-input/steam-input-manager.gd | 4 +- 2 files changed, 2 insertions(+), 62 deletions(-) diff --git a/src/singletons/global_state.gd b/src/singletons/global_state.gd index 1efa2c8a..e22aed3a 100644 --- a/src/singletons/global_state.gd +++ b/src/singletons/global_state.gd @@ -303,66 +303,6 @@ func queue_for_stage(target: Object, index: int = 1): #endregion -#region input set handling -func _input(event: InputEvent) -> void: - if event is InputEventKey or event is InputEventMouse or event is InputEventMouseMotion or event is InputEventScreenTouch: - last_input_source = InputSource.KEYBOARD_MOUSE - if event is InputEventJoypadButton or event is InputEventJoypadMotion: - last_input_source = InputSource.JOYPAD - -signal game_context_updated(new: GameContext) -signal input_device_updated(new: InputSource) - -enum InputSource { - INVALID = -1, - KEYBOARD_MOUSE, - JOYPAD -} - -var last_input_source : InputSource = InputSource.INVALID: - set(new_source): - if new_source != last_input_source: - if new_source == InputSource.KEYBOARD_MOUSE: - _awaiting_mouse_input = false - _update_mouse_mode() - else: - Input.mouse_mode = Input.MOUSE_MODE_HIDDEN - last_input_source = new_source - input_device_updated.emit(new_source) - -enum GameContext { - ## Player moves about in the world. - WALK, - ## Player interacts with a menu. - MENU, - ## Player is in a special menu, but has not moved their mouse yet. Is never set to [current_context], but changes behavior of [update_mouse_mode]. - LISTEN -} - -var current_context: GameContext = GameContext.MENU: - set(new_context): - if new_context != current_context: - if new_context == GameContext.WALK: - current_context = GameContext.WALK - else: - current_context = GameContext.MENU - _awaiting_mouse_input = new_context == GameContext.LISTEN - - if last_input_source == InputSource.KEYBOARD_MOUSE: - _update_mouse_mode() - game_context_updated.emit() - -var _awaiting_mouse_input: bool = false -func _update_mouse_mode(): - if current_context == GameContext.WALK: - Input.mouse_mode = Input.MOUSE_MODE_CAPTURED - elif _awaiting_mouse_input: - Input.mouse_mode = Input.MOUSE_MODE_HIDDEN - else: - Input.mouse_mode = Input.MOUSE_MODE_VISIBLE - -#endregion - #region utility functions func get_room_id(if_game_active = false) -> Room.ids: diff --git a/src/steam-input/steam-input-manager.gd b/src/steam-input/steam-input-manager.gd index 500eca2d..ece67493 100644 --- a/src/steam-input/steam-input-manager.gd +++ b/src/steam-input/steam-input-manager.gd @@ -210,8 +210,8 @@ func _on_controller_disconnect(_input_handle) -> void: State.last_input_source = State.InputSource.KEYBOARD_MOUSE -func _on_set_change(new_context: State.GameContext) -> void: - current_action_set = action_set_ids["game_control_actios"] if new_context == State.GameContext.WALK else action_set_ids["menu_control_actions"] +func _on_set_change(new_context) -> void: + current_action_set = action_set_ids["game_control_actios"] if new_context == 0 else action_set_ids["menu_control_actions"] func _preload_glyphs() -> void: