Devel Sync

This commit is contained in:
patrick_pluto 2024-09-12 17:06:16 +02:00
parent 3c0be2d800
commit 34588e132a
2 changed files with 10 additions and 5 deletions

View file

@ -60,7 +60,8 @@ func _on_player_disconnected(id):
if current_character.captured_by != null: if current_character.captured_by != null:
current_character.captured_by.lost_one() current_character.captured_by.lost_one()
await get_tree().create_timer(0.5).timeout await get_tree().create_timer(0.5).timeout
current_character.free() if is_instance_valid(current_character):
current_character.free()
x += 1 x += 1
Game.player_list.erase(id) Game.player_list.erase(id)

View file

@ -108,10 +108,12 @@ func start_game():
var map = get_tree().root.get_node("./"+map_name+"/") var map = get_tree().root.get_node("./"+map_name+"/")
for i in range(player_list.size()): for i in range(player_list.size()):
var obj = objective.instantiate() var obj = objective.instantiate()
obj.name = "objective" + str(i)
obj.position = get_tree().root.get_node("./"+map_name+"/objective_spawns/"+str(i)).position obj.position = get_tree().root.get_node("./"+map_name+"/objective_spawns/"+str(i)).position
map.add_child(obj) map.add_child(obj)
for i in range(player_list.size()): for i in range(player_list.size()):
var obj = prison.instantiate() var obj = prison.instantiate()
obj.name = "prison" + str(i)
obj.position = get_tree().root.get_node("./"+map_name+"/prison_spawns/"+str(i)).position obj.position = get_tree().root.get_node("./"+map_name+"/prison_spawns/"+str(i)).position
map.add_child(obj) map.add_child(obj)
var i = 0 var i = 0
@ -142,12 +144,14 @@ func sync_player(node_path, position, rotation, rotation2):
get_tree().root.get_node(node_path).find_child("collision").rotation = rotation2 get_tree().root.get_node(node_path).find_child("collision").rotation = rotation2
func sync_hammer(node_path, rotation): func sync_hammer(node_path, rotation):
var current_character = get_tree().root.get_node(node_path) if get_tree().root.has_node(node_path):
current_character.rotation = rotation var current_character = get_tree().root.get_node(node_path)
current_character.rotation = rotation
func sync_computers(node_path, current): func sync_computers(node_path, current):
var current_character = get_tree().root.get_node(node_path) if get_tree().root.has_node(node_path):
current_character.current = current var current_character = get_tree().root.get_node(node_path)
current_character.current = current
func sync_beast(player): func sync_beast(player):
while !get_tree().root.has_node("./"+map_name+"/player"+str(player)): while !get_tree().root.has_node("./"+map_name+"/player"+str(player)):