2023-02-09 13:10:25 -07:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
var SCENE
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
func _process(delta):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
func _on_close_pressed():
|
|
|
|
self.queue_free()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_playground_pressed():
|
2023-02-22 21:31:22 -07:00
|
|
|
$mapSelected.text = "Toyland"
|
|
|
|
SCENE = "res://scenes/toyland.tscn"
|
2023-02-09 13:10:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
func _on_start_button_pressed():
|
|
|
|
var PORT = $portBox.text
|
2023-02-14 11:40:02 -07:00
|
|
|
var MAX_PLAYERS = $playerBox.text
|
2023-02-09 13:10:25 -07:00
|
|
|
var intPORT = int(PORT)
|
2023-02-14 11:40:02 -07:00
|
|
|
var intMAX = int(MAX_PLAYERS)
|
2023-02-09 13:10:25 -07:00
|
|
|
if PORT:
|
2023-02-14 11:40:02 -07:00
|
|
|
prints("Player chose port:", intPORT)
|
2023-02-09 13:10:25 -07:00
|
|
|
if SCENE:
|
2023-02-14 11:40:02 -07:00
|
|
|
print("Player chose map: ", SCENE)
|
|
|
|
if MAX_PLAYERS:
|
|
|
|
if intMAX < 1:
|
|
|
|
$mapSelected.text = "MAX PLAYERS CANNOT BE NEGATIVE"
|
|
|
|
elif intMAX > 4095:
|
|
|
|
$mapSelected.text = "MAX PLAYERS CANNOT BE ABOVE 4095"
|
|
|
|
else:
|
|
|
|
print("Player chose player limit: ", intMAX)
|
2023-02-16 13:27:34 -07:00
|
|
|
Networking.create_server(intPORT, intMAX)
|
|
|
|
Networking.load_map(SCENE)
|
2023-02-22 21:31:22 -07:00
|
|
|
Networking.add_player_node(1)
|
2023-02-21 12:53:13 -07:00
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
2023-02-14 11:40:02 -07:00
|
|
|
else:
|
|
|
|
$mapSelected.text = "NO MAX PLAYERS SELECTED"
|
2023-02-09 13:10:25 -07:00
|
|
|
else:
|
|
|
|
$mapSelected.text = "NO MAP SELECTED"
|
|
|
|
else:
|
|
|
|
$mapSelected.text = "NO PORT SPECIFIED"
|
|
|
|
|
2023-02-15 23:41:14 -07:00
|
|
|
|
|
|
|
|