51 lines
2.4 KiB
GDScript
51 lines
2.4 KiB
GDScript
extends Node
|
|
|
|
@onready
|
|
var engine_version = Engine.get_version_info()
|
|
|
|
func _ready():
|
|
print("coreinit -> Checking CORE requirements")
|
|
if engine_version["major"] != 4:
|
|
print("coreinit -> CORE only supports Godot 4.x.x. Please upgrade/downgrade your Godot Project to Godot 4.")
|
|
await get_tree().create_timer(0.1).timeout
|
|
get_tree().quit(141)
|
|
return
|
|
if engine_version["minor"] != 0:
|
|
print("coreinit -> CORE only supports Godot 4.0.x. Please upgrade/downgrade your Godot Project to Godot 4.0.")
|
|
await get_tree().create_timer(0.1).timeout
|
|
get_tree().quit(142)
|
|
return
|
|
if engine_version["status"] != "stable":
|
|
print("coreinit -> CORE only supports stable Godot 4 releases. Please upgrade/downgrade your Godot Project to Godot 4.0.stable.")
|
|
await get_tree().create_timer(0.1).timeout
|
|
get_tree().quit(143)
|
|
return
|
|
if get_node_or_null(NodePath("/root/Logger")) == null:
|
|
print("coreinit -> The CORE logger is missing in your autoload project settings! Please retry installing CORE.")
|
|
await get_tree().create_timer(0.1).timeout
|
|
get_tree().quit(144)
|
|
return
|
|
if get_node_or_null(NodePath("/root/Preprocessor")) == null:
|
|
print("coreinit -> The CORE preprocessor is missing in your autoload project settings! Please retry installing CORE.")
|
|
await get_tree().create_timer(0.1).timeout
|
|
get_tree().quit(145)
|
|
return
|
|
if get_tree().root.get_children().size() != 3:
|
|
print("coreinit -> CORE only supports projects without autoload singletons (excluding CORE). Please remove them from your project settings and register them using core.autoloader in your init script.")
|
|
await get_tree().create_timer(0.1).timeout
|
|
get_tree().quit(146)
|
|
return
|
|
for i in get_tree().root.get_children():
|
|
if i.name != "coreinit" and i.name != "Logger" and i.name != "Preprocessor":
|
|
print("coreinit -> CORE only supports projects without autoload singletons (excluding CORE). Please remove them from your project settings and register them using core.autoloader in your init script.")
|
|
await get_tree().create_timer(0.1).timeout
|
|
get_tree().quit(147)
|
|
return
|
|
print("coreinit -> Constructing coreloader")
|
|
var coreloader = Control.new()
|
|
coreloader.name = "coreloader"
|
|
coreloader.set_script(ResourceLoader.load("res://CORE/coreloader.gd"))
|
|
print("coreinit -> Injecting coreloader")
|
|
get_tree().root.add_child.call_deferred(coreloader)
|
|
print("coreinit -> Switching to COREBackground")
|
|
get_tree().change_scene_to_packed(ResourceLoader.load("res://CORE/background.tscn"))
|