2024-12-04 09:42:04 +01:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
var logmode: int = 4
|
|
|
|
|
2024-12-04 21:01:24 +01:00
|
|
|
var ip: String = "127.0.0.1"
|
|
|
|
var port: int = 25262
|
|
|
|
var max_clients: int = 1024
|
|
|
|
|
2024-12-05 19:39:07 +01:00
|
|
|
var roomname: String = "sample"
|
|
|
|
var username: String = "sample"
|
2024-12-04 09:42:04 +01:00
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
var args: PackedStringArray = OS.get_cmdline_args()
|
|
|
|
var skip: bool = false
|
|
|
|
for i: int in range(args.size()):
|
|
|
|
if !skip:
|
|
|
|
Log.info("Argument %s passed." % args[i])
|
|
|
|
match args[i]:
|
|
|
|
"--logmode":
|
|
|
|
logmode = int(args[i+1])
|
|
|
|
skip = true
|
2024-12-05 19:39:07 +01:00
|
|
|
"--username":
|
|
|
|
username = args[i+1]
|
|
|
|
skip = true
|
2024-12-04 21:01:24 +01:00
|
|
|
"--server":
|
|
|
|
if Networking.start_server() != OK:
|
|
|
|
Log.error("Failed to start server! Closing application.", "Failed to start server!")
|
|
|
|
"--client":
|
|
|
|
Networking.join_room()
|
2024-12-05 10:34:01 +01:00
|
|
|
"res://start.tscn":
|
|
|
|
pass # Catch in order to prevent a warning.
|
2024-12-04 09:42:04 +01:00
|
|
|
_:
|
|
|
|
Log.warning("Unknown argument: %s!" % args[i])
|
2024-12-05 19:39:07 +01:00
|
|
|
else:
|
|
|
|
skip = false
|