diff --git a/src/player/camera_controller.gd b/src/player/camera_controller.gd index cf4d3f3..180ec36 100644 --- a/src/player/camera_controller.gd +++ b/src/player/camera_controller.gd @@ -11,7 +11,7 @@ const FOCUS_ACCELERATION := 8 func _unhandled_input(event: InputEvent) -> void: if event is InputEventMouseMotion: - if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: + if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED and player.look_enabled: camera_motion((event as InputEventMouseMotion).relative) elif event is InputEventMouseButton: Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) diff --git a/src/player/player.gd b/src/player/player.gd index f3d0759..d7b833c 100644 --- a/src/player/player.gd +++ b/src/player/player.gd @@ -2,6 +2,11 @@ class_name Player extends CharacterBody3D #region Exported Properties +@export_category("Status") +@export var movement_enabled := true +@export var activity_enabled := true +@export var look_enabled := true + @export_category("Movement") @export_group("Speed") @export var run_speed := 80.0 @@ -138,42 +143,47 @@ func _physics_process(delta: float) -> void: if interactive: interactive.select() - # World interaction - if interactive and Input.is_action_just_pressed("interact"): - interactive.activate() + if activity_enabled: + # World interaction + if interactive and Input.is_action_just_pressed("interact"): + interactive.activate() - # Tool selection - if Input.is_action_just_pressed("select_next_tool"): - tool_mount.set_active_relative(1) - elif Input.is_action_just_pressed("select_prev_tool"): - tool_mount.set_active_relative(-1) - elif Input.is_action_just_pressed("select_point_spray"): - tool_mount.set_active(point_spray) - elif Input.is_action_just_pressed("select_wide_spray"): - tool_mount.set_active(wide_spray) - elif Input.is_action_just_pressed("select_brush"): - tool_mount.set_active(toothbrush) + # Tool selection + if Input.is_action_just_pressed("select_next_tool"): + tool_mount.set_active_relative(1) + elif Input.is_action_just_pressed("select_prev_tool"): + tool_mount.set_active_relative(-1) + elif Input.is_action_just_pressed("select_point_spray"): + tool_mount.set_active(point_spray) + elif Input.is_action_just_pressed("select_wide_spray"): + tool_mount.set_active(wide_spray) + elif Input.is_action_just_pressed("select_brush"): + tool_mount.set_active(toothbrush) - # Tool use - if Input.is_action_pressed("fire"): - get_tool().fire() - firing = true - else: - get_tool().idle() - firing = false - - if Input.is_action_just_pressed("switch_mode"): - get_tool().switch_mode() - - # Two sneaking modes -- hold and toggle - if Game.settings.hold_to_sneak: - if Input.is_action_pressed("sneak"): - crouch() + # Tool use + if Input.is_action_pressed("fire"): + get_tool().fire() + firing = true else: - uncrouch() - else: - if Input.is_action_just_pressed("sneak"): - toggle_crouch() + get_tool().idle() + firing = false + + if Input.is_action_just_pressed("switch_mode"): + get_tool().switch_mode() + + # Two sneaking modes -- hold and toggle + if Game.settings.hold_to_sneak: + if Input.is_action_pressed("sneak"): + crouch() + else: + uncrouch() + else: + if Input.is_action_just_pressed("sneak"): + toggle_crouch() + + # Jumping + if Input.is_action_just_pressed("jump") and is_on_floor(): + velocity.y = jump_force if is_on_floor(): if not _was_on_floor and not sneaking: @@ -184,14 +194,13 @@ func _physics_process(delta: float) -> void: velocity += gravity * delta # Input movement - var input_dir := Input.get_vector("move_left", "move_right", "move_forward", "move_back") - var rel_input := input_dir.rotated(-camera_pivot.global_rotation.y) - var direction := Vector3(rel_input.x, 0, rel_input.y).normalized() - var movement := direction * get_speed() * delta - velocity.x += movement.x - velocity.z += movement.z - if Input.is_action_just_pressed("jump") and is_on_floor(): - velocity.y = jump_force + if movement_enabled: + var input_dir := Input.get_vector("move_left", "move_right", "move_forward", "move_back") + var rel_input := input_dir.rotated(-camera_pivot.global_rotation.y) + var direction := Vector3(rel_input.x, 0, rel_input.y).normalized() + var movement := direction * get_speed() * delta + velocity.x += movement.x + velocity.z += movement.z # Friction var friction := get_friction() diff --git a/src/world/world.gd b/src/world/world.gd index 7296227..5096ab6 100644 --- a/src/world/world.gd +++ b/src/world/world.gd @@ -1,6 +1,8 @@ class_name World extends Node ## Access and flow control for the game world. +@export var pause_enabled := true + @export var spook_manager: SpookManager @export_category("Game Scenes") @@ -20,7 +22,7 @@ func _ready() -> void: func _unhandled_input(event: InputEvent) -> void: - if event.is_action_pressed("pause"): + if event.is_action_pressed("pause") and pause_enabled: pause()