feat: implement player movement controller and movement state machine system
This commit is contained in:
@@ -94,6 +94,9 @@ func _physics_process(delta: float) -> void:
|
||||
_try_start_grapple()
|
||||
|
||||
if is_grapple_shooting:
|
||||
if not input_grapple:
|
||||
is_grapple_shooting = false
|
||||
else:
|
||||
grapple_shoot_time += delta
|
||||
if grapple_shoot_time >= grapple_travel_time:
|
||||
is_grapple_shooting = false
|
||||
|
||||
@@ -675,7 +675,6 @@ func _physics_process(_delta: float) -> void:
|
||||
_client_grapple_just_pressed = false
|
||||
|
||||
# Update synced properties for the grapple
|
||||
if sm.current_state == "grapple" or sm.is_grapple_shooting:
|
||||
synced_grapple_point = sm.grapple_point
|
||||
synced_is_grapple_shooting = sm.is_grapple_shooting
|
||||
|
||||
@@ -985,12 +984,16 @@ func _input(event: InputEvent) -> void:
|
||||
_on_respawn_pressed()
|
||||
|
||||
func _on_respawn_pressed() -> void:
|
||||
if death_screen:
|
||||
death_screen.visible = false
|
||||
if multiplayer.is_server():
|
||||
var spawn_pos = Vector3(randf_range(-5, 5), 5, randf_range(-5, 5))
|
||||
rpc_respawn.rpc(spawn_pos)
|
||||
else:
|
||||
rpc_request_respawn.rpc_id(1)
|
||||
|
||||
var _last_respawn_request_time: float = 0.0
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func rpc_request_respawn() -> void:
|
||||
if not multiplayer.is_server():
|
||||
@@ -999,6 +1002,11 @@ func rpc_request_respawn() -> void:
|
||||
if sender_id != 1 and sender_id != str(name).to_int():
|
||||
return
|
||||
|
||||
var now = Time.get_ticks_msec() / 1000.0
|
||||
if now - _last_respawn_request_time < 0.5:
|
||||
return
|
||||
_last_respawn_request_time = now
|
||||
|
||||
if is_dead:
|
||||
var spawn_pos = Vector3(randf_range(-5, 5), 5, randf_range(-5, 5))
|
||||
rpc_respawn.rpc(spawn_pos)
|
||||
|
||||
Reference in New Issue
Block a user