extends Node

var IP_ADDRESS: String = "localhost"
const PORT: int = 42069

var peer: ENetMultiplayerPeer

func startServer() -> void:
	peer = ENetMultiplayerPeer.new()
	peer.create_server(PORT)
	multiplayer.multiplayer_peer = peer
	print("server started")
	$/root/main/world/MultiplayerSpawner.spawnPlayer(1)


func startClient(IP_target) -> void:
	if IP_target != "":
		IP_ADDRESS = IP_target
	peer = ENetMultiplayerPeer.new()
	peer.create_client(IP_ADDRESS, PORT)
	multiplayer.multiplayer_peer = peer
	print("client started")
