crouching, walking and jumping

This commit is contained in:
Rendo 2025-12-03 21:50:14 +05:00
commit f312e0a4a6
9 changed files with 71 additions and 60 deletions

View file

@ -10,6 +10,7 @@ var crouching: bool = false
var scoping: bool = false
var walking: bool = false
signal jumped
signal drop
signal switch_weapon(to_slot: StringName)
signal fire_begin
@ -70,7 +71,7 @@ func _input(event: InputEvent) -> void:
crouch_on_server.rpc_id(1,false)
if event.is_action_released("plr_crouch") and not ClientSettings.TOGGLE_CROUCH and crouching:
crouching = false
crouch_on_server.rpc_id(1,false)
crouch_on_server.rpc_id(1,true)
if event.is_action_pressed("plr_walk"):
if ClientSettings.TOGGLE_WALK:
@ -81,7 +82,7 @@ func _input(event: InputEvent) -> void:
walk_on_server.rpc_id(1,false)
if event.is_action_released("plr_walk") and not ClientSettings.TOGGLE_WALK and walking:
walking = false
walk_on_server.rpc_id(1,false)
walk_on_server.rpc_id(1,true)
if event.is_action_pressed("plr_scope"):
if ClientSettings.TOGGLE_SCOPE:
@ -92,7 +93,7 @@ func _input(event: InputEvent) -> void:
scope_on_server.rpc_id(1,false)
if event.is_action_released("plr_scope") and not ClientSettings.TOGGLE_SCOPE and scoping:
scoping = false
scope_on_server.rpc_id(1,false)
scope_on_server.rpc_id(1,true)
if event.is_action_pressed("plr_reload"):
reload_on_server.rpc_id(1)
@ -101,6 +102,9 @@ func _input(event: InputEvent) -> void:
interact_on_server.rpc_id(1,false)
if event.is_action_released("plr_interact"):
interact_on_server.rpc_id(1,true)
if event.is_action_pressed("plr_jump"):
jump_on_server.rpc_id(1)
@rpc("authority","call_local","reliable")
func switch_on_server(slot: StringName) -> void:
@ -166,3 +170,8 @@ func interact_on_server(end: bool) -> void:
interact_end.emit()
else:
interact_begin.emit()
@rpc("authority","call_local","reliable")
func jump_on_server() -> void:
if not multiplayer.is_server(): return
jumped.emit()