Player settings
This commit is contained in:
parent
de2736c701
commit
e8127ee423
8 changed files with 109 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
|||
extends Node
|
||||
|
||||
|
||||
var SENSITIVITY: float
|
||||
var SENSITIVITY: float = 0.02
|
||||
|
|
|
|||
24
scripts/gui/client_settings_menu.gd
Normal file
24
scripts/gui/client_settings_menu.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
extends Control
|
||||
|
||||
|
||||
func _on_check_button_toggled(toggled_on: bool) -> void:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN if toggled_on else DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
|
||||
|
||||
func _on_h_slider_value_changed(value: float) -> void:
|
||||
$VBoxContainer/Sensitivity/SpinBox.set_value_no_signal(value)
|
||||
ClientSettings.SENSITIVITY = value
|
||||
|
||||
|
||||
func _on_spin_box_value_changed(value: float) -> void:
|
||||
$VBoxContainer/Sensitivity/HSlider.set_value_no_signal(value)
|
||||
ClientSettings.SENSITIVITY = value
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("menu_settings"):
|
||||
visible = not visible
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE if visible else Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
|
||||
func _on_gameplay_main_slider_value_changed(value: float) -> void:
|
||||
AudioServer.set_bus_volume_linear(1,value)
|
||||
1
scripts/gui/client_settings_menu.gd.uid
Normal file
1
scripts/gui/client_settings_menu.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ddi1alk8oyi1b
|
||||
|
|
@ -29,7 +29,7 @@ func _process(delta: float) -> void:
|
|||
func _input(event: InputEvent) -> void:
|
||||
if not is_multiplayer_authority() or disabled:
|
||||
return
|
||||
if event is InputEventMouseMotion:
|
||||
if Input.mouse_mode == Input.MouseMode.MOUSE_MODE_CAPTURED and event is InputEventMouseMotion:
|
||||
rotate_camera(-event.relative.x * ClientSettings.SENSITIVITY,-event.relative.y * ClientSettings.SENSITIVITY)
|
||||
|
||||
func rotate_camera(x,y) -> void:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ func exit() -> void:
|
|||
pass
|
||||
|
||||
func state_input(event: InputEvent) -> void:
|
||||
if not machine.is_multiplayer_authority(): return
|
||||
if not machine.is_multiplayer_authority() or Input.mouse_mode != Input.MouseMode.MOUSE_MODE_CAPTURED: return
|
||||
|
||||
if event.is_action_pressed("plr_reload"):
|
||||
init_reload.rpc()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue