despawn runner or chaser on disconnect

This commit is contained in:
2025-02-21 17:59:23 +09:00
parent 591225996d
commit ca63d4594c
15 changed files with 85 additions and 97 deletions
+4 -10
View File
@@ -1,12 +1,10 @@
extends State
func process_physics(delta: float) -> State:
if not multiplayer.is_server() and (multiplayer.get_unique_id() != subject.player_id or not subject.client_prediction):
return
if not Main.is_server_or_predicting(subject.player_id, subject.client_prediction): return
var input_direction = %Input.direction
if input_direction.length() < 0.05:
return %Idle
if input_direction.length() < 0.05: return %Idle
var move_direction = Vector3(input_direction.x, 0, input_direction.y)
var target_velocity = Vector3(move_direction.x * subject.walk_speed, subject.velocity.y, move_direction.z * subject.walk_speed)
@@ -19,10 +17,6 @@ func process_physics(delta: float) -> State:
var target_angle := Vector3.FORWARD.signed_angle_to(subject.last_direction, Vector3.UP)
subject.skin.global_rotation.y = lerp_angle(subject.skin.rotation.y, target_angle, subject.rotation_speed * delta)
if not %Input.walking:
return %Run
if not subject.is_on_floor():
return %Fall
if not %Input.walk: return %Run
if not subject.is_on_floor(): return %Fall
return