WIP: Handle player disconnected

This commit is contained in:
2025-01-30 10:09:40 +01:00
parent c62b2d7a09
commit c877e81562
5 changed files with 11 additions and 10 deletions

View File

@ -32,6 +32,10 @@ func spawn_players(spawn_location: SpawnController, id: int) -> Error:
func remove_player(id: int) -> Error:
if multiplayer.is_server():
_get_root().find_child("PlayerPlaceholder_" + str(id)).queue_free()
var found_childen: Array[Node] =_get_root().get_children()
for found_child in found_childen:
if found_child.owner_id:
if found_child.owner_id == id:
found_child.queue_free()
return OK
return ERR_UNAUTHORIZED