2023-03-19 14:23:14 +01:00
|
|
|
# coreinit.gd
|
|
|
|
# CORE Initializer
|
|
|
|
#
|
|
|
|
# This file is part of StarOpenSource CORE (SOSCORE)
|
|
|
|
# Made by the StarOpenSource Project and Contributers
|
|
|
|
# Licensed under GNU GPLv3
|
2023-03-19 13:14:30 +01:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
@onready
|
|
|
|
var engine_version = Engine.get_version_info()
|
|
|
|
|
2023-07-07 10:58:49 +02:00
|
|
|
func _ready() -> void:
|
2023-03-19 13:14:30 +01:00
|
|
|
print("coreinit -> Checking CORE requirements")
|
|
|
|
if engine_version["major"] != 4:
|
2023-07-07 10:58:49 +02:00
|
|
|
print("coreinit -> CORE only supports Godot 4. Please upgrade/downgrade your Godot Project to Godot 4.")
|
2023-03-19 13:14:30 +01:00
|
|
|
await get_tree().create_timer(0.1).timeout
|
|
|
|
get_tree().quit(141)
|
|
|
|
return
|
2023-07-07 10:58:49 +02:00
|
|
|
if engine_version["minor"] != 0 and engine_version["minor"] != 1:
|
|
|
|
print("coreinit -> CORE only supports Godot 4.0 and 4.1. Please upgrade/downgrade your Godot Project to Godot 4.0 or 4.1.")
|
2023-03-19 13:14:30 +01:00
|
|
|
await get_tree().create_timer(0.1).timeout
|
|
|
|
get_tree().quit(142)
|
|
|
|
return
|
|
|
|
if engine_version["status"] != "stable":
|
2023-07-07 18:22:15 +02:00
|
|
|
print("coreinit -> CORE only supports stable Godot 4 releases. Please upgrade/downgrade your Godot Project to a stable version.")
|
2023-03-19 13:14:30 +01:00
|
|
|
await get_tree().create_timer(0.1).timeout
|
|
|
|
get_tree().quit(143)
|
|
|
|
return
|
|
|
|
if get_node_or_null(NodePath("/root/Logger")) == null:
|
2023-07-07 18:48:06 +02:00
|
|
|
print("coreinit -> The CORE logger is missing in your autoload project settings!")
|
2023-03-19 13:14:30 +01:00
|
|
|
await get_tree().create_timer(0.1).timeout
|
|
|
|
get_tree().quit(144)
|
|
|
|
return
|
|
|
|
if get_node_or_null(NodePath("/root/Preprocessor")) == null:
|
2023-07-07 18:48:06 +02:00
|
|
|
print("coreinit -> The CORE preprocessor is missing in your autoload project settings!")
|
2023-03-19 13:14:30 +01:00
|
|
|
await get_tree().create_timer(0.1).timeout
|
|
|
|
get_tree().quit(145)
|
|
|
|
return
|
2023-07-07 18:22:15 +02:00
|
|
|
if !FileAccess.file_exists("res://CORE/config.gd"):
|
|
|
|
print("coreinit -> The CORE configuration file (config.gd) is missing! Please copy the config.gd.example file and rename it to config.gd!")
|
|
|
|
await get_tree().create_timer(0.1).timeout
|
|
|
|
get_tree().quit(146)
|
|
|
|
return
|
2023-03-19 13:14:30 +01:00
|
|
|
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"))
|