add Menu class and refactor men-related cursor capturing

This commit is contained in:
2025-02-14 23:49:00 +10:00
parent 7ba087f6e1
commit 2d9933b627
7 changed files with 56 additions and 19 deletions

View File

@@ -88,7 +88,7 @@ func _unhandled_input(event: InputEvent) -> void:
if not is_multiplayer_authority():
return
if Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED:
if not Inputer.can_control_player():
return
if event is InputEventMouseMotion:
@@ -168,7 +168,7 @@ func _lateral_movement(delta: float) -> void:
"move_left", "move_right", "move_forward", "move_back"
)
var has_input := (
input_dir.length() > 0 and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED
input_dir.length() > 0 and Inputer.can_control_player()
)
if has_input:
@@ -203,7 +203,7 @@ func _vertical_movement(delta: float) -> void:
func _jumping() -> void:
if (
Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED
Inputer.can_control_player()
and Input.is_action_just_pressed("jump")
and is_on_floor()
):