forked from unfa/liblast
Merge branch 'main' of ssh://git.gieszer.link:2222/unfa/liblast
commit
6fdbcf69e7
|
@ -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)
|
||||
|
|
|
@ -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():
|
||||
|
|
Loading…
Reference in New Issue