diff --git a/Game/Assets/Characters/Player.gd b/Game/Assets/Characters/Player.gd index b6a61c5..aa28f9c 100644 --- a/Game/Assets/Characters/Player.gd +++ b/Game/Assets/Characters/Player.gd @@ -3,6 +3,8 @@ extends CharacterBody3D @export var mouse_sensitivity := 0.15 @onready var main = get_tree().root.get_node("Main") +@onready var gui = main.get_node("GUI") +@onready var settings = gui.settings @onready var hud = main.get_node("HUD") @onready var crosshair = hud.get_node("Crosshair") @onready var vignette = hud.get_node("Vignette") @@ -121,17 +123,21 @@ func aim(event) -> void: var mouse_motion = event as InputEventMouseMotion if mouse_motion: - rotation.y -= deg2rad(mouse_motion.relative.x * mouse_sensitivity / view_zoom) + var adjusted_mouse_sensitivity = 1.0 + if "Sensitivity" in settings.keys(): + adjusted_mouse_sensitivity = mouse_sensitivity * settings["Sensitivity"] + + rotation.y -= deg2rad(mouse_motion.relative.x * adjusted_mouse_sensitivity / view_zoom) var current_tilt: float = head.rotation.x - current_tilt -= deg2rad(mouse_motion.relative.y * mouse_sensitivity / view_zoom) + current_tilt -= deg2rad(mouse_motion.relative.y * adjusted_mouse_sensitivity / view_zoom) head.rotation.x = clamp(current_tilt, deg2rad(-90), deg2rad(90)) func _input(event) -> void: if not input_active: return - #assert(is_network_authority() == true, "input_active is true, even though the node is not network_authority") + assert(is_network_authority() == true, "input_active is true, even though the node is not network_authority") if Input.is_action_just_pressed("view_zoom"): # tween.remove_all() @@ -165,7 +171,7 @@ func _process(delta): if not input_active: return - #assert(is_network_authority() == true, "input_active is true, even though the node is not network_authority") + assert(is_network_authority() == true, "input_active is true, even though the node is not network_authority") if view_zoom_direction and view_zoom < view_zoom_target: view_zoom = min(view_zoom_target, view_zoom + delta * 4) diff --git a/Game/Assets/UI/GUI.gd b/Game/Assets/UI/GUI.gd index 93ec0c2..35837d9 100644 --- a/Game/Assets/UI/GUI.gd +++ b/Game/Assets/UI/GUI.gd @@ -28,7 +28,7 @@ func load_settings(): settings = file.get_var() file.close() - if settings == null: + if typeof(settings) != TYPE_DICTIONARY: settings = {} func apply_settings():