And once again
This commit is contained in:
32
godot/src/entrypoint.gd
Normal file
32
godot/src/entrypoint.gd
Normal file
@ -0,0 +1,32 @@
|
||||
extends EntryPoint
|
||||
|
||||
# -- A path to the config file for setting up the dedicated server
|
||||
var config_file_path: String = ""
|
||||
|
||||
# -- Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
parse_args()
|
||||
|
||||
if OS.has_feature("dedicated_server") or DisplayServer.get_name() == "headless":
|
||||
var err := start_dedicated_server()
|
||||
if err != OK:
|
||||
push_error("Couldn't start the dedicated server, err: " + str(err))
|
||||
else:
|
||||
var err := start_game()
|
||||
if err != OK:
|
||||
push_error("Couldn't start the game, err: " + str(err))
|
||||
|
||||
# -- Parse command line arguments
|
||||
func parse_args() -> void:
|
||||
var args := Array(OS.get_cmdline_args())
|
||||
var config_arg: String = "--config"
|
||||
if args.has(config_arg):
|
||||
var index := args.find(config_arg)
|
||||
config_file_path = args[index + 1]
|
||||
|
||||
func start_dedicated_server() -> Error:
|
||||
push_error("Dedicated server is not yet implemented")
|
||||
return ERR_METHOD_NOT_FOUND
|
||||
|
||||
func start_game() -> Error:
|
||||
return OK
|
9
godot/src/entrypoint.tscn
Normal file
9
godot/src/entrypoint.tscn
Normal file
@ -0,0 +1,9 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://0hsqnr1kunv5"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/entrypoint.gd" id="1_ce80t"]
|
||||
|
||||
[node name="Entrypoint" type="EntryPoint"]
|
||||
script = ExtResource("1_ce80t")
|
||||
|
||||
[node name="LevelPlaceholder" type="Node3D" parent="."]
|
||||
editor_description = "This node should be used for storing the map that is currently loaded"
|
Reference in New Issue
Block a user