extends Node

func send_everyone(args):
	for current_client_id in Networking.clients.keys():
		if (args.size() == 1): 
			var playermodel = ServerUtils.find_playermodel_by_internal_id(Networking.clients[current_client_id]["internal_id"])
			playermodel.rpc_id(int(current_client_id), args[0])
		elif (args.size() == 2): 
			var playermodel = ServerUtils.find_playermodel_by_internal_id(Networking.clients[current_client_id]["internal_id"])
			playermodel.rpc_id(int(current_client_id), args[0], args[1])
		elif (args.size() == 3): 
			var playermodel = ServerUtils.find_playermodel_by_internal_id(Networking.clients[current_client_id]["internal_id"])
			playermodel.rpc_id(int(current_client_id), args[0], args[1], args[2])
		else: 
			var playermodel = ServerUtils.find_playermodel_by_internal_id(Networking.clients[current_client_id]["internal_id"])
			playermodel.rpc_id(int(current_client_id), args[0], args[1], args[2], args[3])

func send_everyone_except(client_id, args):
	if (typeof(args[0]) == 4): #string
		for current_client_id in Networking.clients.keys():
			if (str(current_client_id) == str(client_id)): continue
			if (args.size() == 1): 
				var playermodel = ServerUtils.find_playermodel_by_internal_id(Networking.clients[current_client_id]["internal_id"])
				playermodel.rpc_id(int(current_client_id), args[0])
			elif (args.size() == 2): 
				var playermodel = ServerUtils.find_playermodel_by_internal_id(Networking.clients[current_client_id]["internal_id"])
				playermodel.rpc_id(int(current_client_id), args[0], args[1])
			elif (args.size() == 3): 
				var playermodel = ServerUtils.find_playermodel_by_internal_id(Networking.clients[current_client_id]["internal_id"])
				playermodel.rpc_id(int(current_client_id), args[0], args[1], args[2])
			else: 
				var playermodel = ServerUtils.find_playermodel_by_internal_id(Networking.clients[current_client_id]["internal_id"])
				playermodel.rpc_id(int(current_client_id), args[0], args[1], args[2], args[3])
	else:
		for current_client_id in Networking.clients.keys():
			if (str(current_client_id) == str(client_id)): continue
			if (args.size() == 1): args[0].rpc_id(int(current_client_id))
			elif (args.size() == 2): args[0].rpc_id(int(current_client_id), args[1])
			elif (args.size() == 3): args[0].rpc_id(int(current_client_id), args[1], args[2])
			else: args[0].rpc_id(int(current_client_id), args[1], args[2], args[3])
