extends CharacterBody3D class_name PlayerCharacter ##TODO make it so that you can easily tweak settings from here, cascading to the components @export_category("Movement") @export var SPEED = 5.0 ##base walking speed @export var SPRINT_MULTIPLIER = 1.5 ##how much faster should you move, when sprinting @export var SPRINT_STAMINA_COST = 10.0 ##how much stamina should be consumed each frame while sprinting (delta * SPRINT_STAMINA_COST) @export var CROUCH_SPEED_MULTIPLIER = .5 ##how much slower you should be going while crouching @export_category("Jump") @export var JUMP_VELOCITY = 4.5 ##how high you can jump @export var JUMP_STAMINA_COST = 10 ##how much stamina each jump consumes @export_category("Camera") @export var LOOK_SENSITIVITY = 1.0 ##camera sensitivity @export var CAMERA_VELOCITY_MULTIPLIER = 1.5 ##how heavy should the UI movement feel @export var CAMERA_BOB_FREQUENCY = 2.4 ##how quick the camera bobs whilst moving @export var CAMERA_BOB_AMPLITUDE = 0.08 ##how hard the camera bobs whilst moving @export var CAMERA_BOB_MULTIPLIER = 200.0 ##how much the ui reacts to head bobbing @export var CAMERA_SIDEWAYS_BOB_AMPLITUDE = 0.003 ## how many degrees does the camera bob sideways @export_category("UI") @export var UI_SCALE: float = 1 ##rational scale of the ui @export var UI_MOVEMENT_SENSITIVITY = 0.5 ##how much the UI moves when you move the camera @export var UI_MOVEMENT_SPEED = 15.0 ##how fast the UI moves when you move the camera @export var UI_MOVEMENT_VELOCITY_MULTIPLIER = 2.0 ##how much the ui leans when walking or strafing @export_category("Inventory") @export var INVENTORY_MAX = 3 ##max number of items that can be in the player's inventory @export var INVENTORY_ITEMS: Array = [] ##the items in the player's inventory @export_category("Audio") @export var AUDIO_LOUDNESS: float = 100.0 @export var NORMAL_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##normal footsteps -- walking @export var HEAVY_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##heavy footsteps -- running @export var LIGHT_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##light footsteps -- crouching @export var SHUFFLE_FOOTSTEP_SOUNDS: Array[AudioStreamWAV] ##shuffling -- random chance of playing while running @export var FLASHLIGHT_CLICK_SOUNDS: Array[AudioStreamWAV] ##flashlight click @export var SHUFFLE_CHANCE: float = 20 ##percentage of chance for a shuffle noise to be played whilst running @export_category("Grabbing") @export var GRAB_POWER: float = 15.0 ##how fast the grabbed object snaps to the hold position @export var GRAB_ROTATION_POWER: float = 15.0 ##how fast the object rotates towards the player @export var GRAB_PANEL: PackedScene ##panel that goes over the grabbable object to show its grabbable @export_category("Player Physics") @export_flags_3d_physics var PLAYER_COLLISION_MASK: int = 16 # components @onready var procedural_camera_mover: Node = %ProceduralCameraMover @onready var sound_controller: Node = %SoundController @onready var ui_handler: Node = %UiHandler @onready var input_controller: Node = %InputController @onready var player_state: Node = %PlayerState @onready var player_properties: Node = %PlayerProperties