45 lines
1.1 KiB
GDScript
45 lines
1.1 KiB
GDScript
## SPDX-License-Identifier: GPL-3.0-or-later
|
|
## Copyright (c) 2024 interstellardevelopment.org
|
|
|
|
extends Node
|
|
|
|
# This tells the game what the logmode is.
|
|
# 0 -> None
|
|
# 1 -> Errors
|
|
# 2 -> Errors/Warnings
|
|
# 3 -> Errors/Warnings/Infos
|
|
# 4 -> All
|
|
var logmode: int = 4
|
|
|
|
var ip: String = "127.0.0.1"
|
|
var port: int = 25262
|
|
var max_clients: int = 1024
|
|
|
|
var roomname: String = "sample"
|
|
var username: String = "sample"
|
|
var mapname: String = "Testmap"
|
|
|
|
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
|
|
"--username":
|
|
username = args[i+1]
|
|
skip = true
|
|
"--server":
|
|
if Networking.start_server() != OK:
|
|
Log.error("Failed to start server! Closing application.", "Failed to start server!")
|
|
"--client":
|
|
Networking.join_room()
|
|
"res://start.tscn":
|
|
pass # Catch in order to prevent a warning.
|
|
_:
|
|
Log.warning("Unknown argument: %s!" % args[i])
|
|
else:
|
|
skip = false
|