add extra check for controlling player

This commit is contained in:
Teatov 2025-02-15 00:35:10 +10:00
parent fa6cf57e0c
commit c3e906f33c

View File

@ -88,7 +88,10 @@ func _unhandled_input(event: InputEvent) -> void:
if not is_multiplayer_authority():
return
if not Inputer.can_control_player():
if (
not Inputer.can_control_player()
or Input.mouse_mode != Input.MOUSE_MODE_CAPTURED
):
return
if event is InputEventMouseMotion:
@ -167,9 +170,7 @@ func _lateral_movement(delta: float) -> void:
var input_dir := Input.get_vector(
"move_left", "move_right", "move_forward", "move_back"
)
var has_input := (
input_dir.length() > 0 and Inputer.can_control_player()
)
var has_input := input_dir.length() > 0 and Inputer.can_control_player()
if has_input:
var direction := (