created settings for class types, embeeded spawnpoint config

This commit is contained in:
leca 2024-02-21 15:52:46 +03:00
parent a1cefe5e5a
commit d1e3e3d313
2 changed files with 16 additions and 1 deletions

View File

@ -93,6 +93,14 @@ func find_weapon_by_number(number):
break
return found_weapon
func find_class_type_by_number(number):
var found_class
var classtypes = settings["game"]["classTypes"]
for classtype in classtypes:
if classtypes[classtype]["number"] == number:
found_class = classtypes[classtype].duplicate()
break
return found_class
func _Peer_Connected(client_id):
print("User " + str(client_id) + " has conected")
@ -122,7 +130,8 @@ func client_ready(client_id):
clients[client_id]["ready"] = true
var client_cb3d = find_cb3d_by_internal_id(internal_id)
client_cb3d.teleport.rpc_id(client_id, Vector3(0, 5, 0))
var class_spawnpoint = find_class_type_by_number(client["class_type"])["spawnpoint"]
client_cb3d.teleport.rpc_id(client_id, Vector3(class_spawnpoint[0], class_spawnpoint[1], class_spawnpoint[2]))
func _Peer_Disconnected(client_id):
print("User " + str(client_id) + " has disconnected")

View File

@ -40,6 +40,12 @@
"ammo": 100,
"range": 100
}
},
"classTypes": {
"spectator": {
"number": 0,
"spawnpoint": [0, 4, 0]
}
}
}
}