Optimize/change version checking

This commit is contained in:
JeremyStar™ 2024-03-03 19:08:20 +01:00
parent b739c8ad53
commit 3db90ed612

View file

@ -57,7 +57,7 @@ var custom_modules_node: Node
# Preinitialization
func _init(new_config: CoreConfiguration = CoreConfiguration.new()) -> void:
name = "CORE"
if !check_godot_version(): queue_free()
if !check_godot_version(): return
if !determine_basepath(): queue_free()
custom_modules_node = Node.new()
reload_configuration(new_config)
@ -270,12 +270,16 @@ func check_godot_version() -> bool:
match(version["major"]):
4: pass
_:
assert(true, "The CORE Framework does not support Godot versions older or newer than 4.x.x")
return true
printerr("The CORE Framework does not support Godot versions older or newer than 4.x.x")
return false
match(version["minor"]):
0: print("The CORE Framework does not support Godot versions older than 4.2.x. Please update to Godot 4.2.x to ensure full compatibility.")
1: print("The CORE Framework does not support Godot versions older than 4.2.x. Please update to Godot 4.2.x to ensure full compatibility.")
0: printerr("The CORE Framework does not support Godot versions older than 4.2.x. Please update to Godot 4.2.x to ensure full compatibility.")
1: printerr("The CORE Framework does not support Godot versions older than 4.2.x. Please update to Godot 4.2.x to ensure full compatibility.")
2: pass
_: print("The CORE Framework does not support Godot versions newer than 4.2.x. Please downgrade to Godot 4.2.x to ensure full compatibility.")
if version["status"] != "stable": print("The CORE Framework does not support unstable Godot versions. Please switch to Godot stable 4.2.1 to ensure full compatibility.")
_:
printerr("The CORE Framework does not support Godot versions newer than 4.2.x. Please downgrade to Godot 4.2.x.")
return false
if version["status"] != "stable":
printerr("The CORE Framework does not support unstable Godot versions. Please switch to Godot stable 4.2.x.")
return false
return true