Compare commits

..

2 commits

Author SHA1 Message Date
e7d0a9d9a6
Add special welcome message
This also adds this nice banner (thanks figlet!):
_________________________________   __________                                                    ______
__  ____/_  __ \__  __ \__  ____/   ___  ____/____________ _______ ___________      _________________  /__
_  /    _  / / /_  /_/ /_  __/      __  /_   __  ___/  __ `/_  __ `__ \  _ \_ | /| / /  __ \_  ___/_  //_/
/ /___  / /_/ /_  _, _/_  /___      _  __/   _  /   / /_/ /_  / / / / /  __/_ |/ |/ // /_/ /  /   _  ,<
\____/  \____/ /_/ |_| /_____/      /_/      /_/    \__,_/ /_/ /_/ /_/\___/____/|__/ \____//_/    /_/|_|
2024-04-23 21:34:38 +02:00
8be2024552
Update initialization failure messages
Update failure messages for both the determine_basepath() methods aswell as the check_godot_version() method.
2024-04-23 21:33:02 +02:00
6 changed files with 30 additions and 9 deletions

View file

@ -43,7 +43,7 @@ Stores the path to CORE's installation directory.
Do not call this (except you're using `Core.new()`).
:::
Handles the preinitialization part. Does stuff like checking the engine version, loading the config and loading all modules into memory.
### *void* <u>complete_init</u>(*bool* <u>no_success_message</u> = *false*)
### *void* <u>complete_init</u>()
Waits for all built-in and custom modules to fully initialize. \
\
This ensures that all modules are fully initialized and ready for usage. \

View file

@ -20,8 +20,8 @@ boot_splash/show_image=false
[display]
window/size/viewport_width=960
window/size/viewport_height=540
window/size/viewport_width=1440
window/size/viewport_height=810
[editor_plugins]

View file

@ -24,7 +24,7 @@ class_name CoreTypes
## Available version types, following the StarOpenSource Versioning Specification (SOSVS) version 1.
enum VersionType { RELEASE, RELEASECANDIDATE, BETA, ALPHA }
## Available log levels, followingthe StarOpenSource Logging Specification (SOSLS) version 1.
enum LoggerLevel { NONE, ERROR, WARN, INFO, VERB, DIAG }
enum LoggerLevel { NONE, SPECIAL, ERROR, WARN, INFO, VERB, DIAG }
## Available scene types.
enum SceneType { NONE, DEBUG, CUTSCENE, MENU, MAIN, BACKGROUND }
## To what degree [i]something[/i] should be blocked.

View file

@ -71,6 +71,9 @@ var loggeri: CoreLoggerInstance
## Internal, don't modify.
# Makes CORE inaccessible if true.
var disabled: bool = false
## Internal, don't modify.
# Displays the ✨ special ✨ welcome message if true
var welcomed: bool = false
# +++ initialization +++
func _init(new_config: CoreConfiguration = CoreConfiguration.new()) -> void:
@ -126,7 +129,7 @@ func initialize_scheduler() -> void:
## [br]
## This ensures that all modules are fully initialized and ready for usage.[br]
## [i][b]Not calling this function during startup may lead to runtime issues.[/b][/i]
func complete_init(no_success_message: bool = false) -> void:
func complete_init() -> void:
var modsinit_builtin: Array[String] = ["workaround"]
var modsinit_custom: Array[String] = ["workaround"]
@ -151,7 +154,20 @@ func complete_init(no_success_message: bool = false) -> void:
# Initialization complete
await get_tree().process_frame
if !no_success_message: loggeri.info("Initialized CORE successfully")
if !welcomed:
welcomed = true
logger._log(CoreTypes.LoggerLevel.SPECIAL, basepath.replace("res://", "") + "src/core.gd", """_________________________________ __________ ______
__ ____/_ __ \\__ __ \\__ ____/ ___ ____/____________ _______ ___________ _________________ /__
_ / _ / / /_ /_/ /_ __/ __ /_ __ ___/ __ `/_ __ `__ \\ _ \\_ | /| / / __ \\_ ___/_ //_/
/ /___ / /_/ /_ _, _/_ /___ _ __/ _ / / /_/ /_ / / / / / __/_ |/ |/ // /_/ / / _ ,<
\\____/ \\____/ /_/ |_| /_____/ /_/ /_/ \\__,_/ /_/ /_/ /_/\\___/____/|__/ \\____//_/ /_/|_|
Copyright (c) 2023-2024 The StarOpenSource Project & Contributors.
Licensed under the GNU Affero General Public License v3 WITHOUT ANY WARRANTY.
You should have recieved a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Consider contributing to the CORE Framework to make it even better... and remember: #TransRightsAreHumanRights
Thank you for using the CORE Framework to develop your application or game!""")
# +++ configuration +++
## Loads a (new) configuration object and applies it to all modules.
@ -368,7 +384,7 @@ func determine_basepath() -> bool:
elif FileAccess.file_exists("res://addons/CORE/.corebasepath"):
basepath = "res://addons/CORE/"
else:
assert(false, "CORE is not located at 'res://CORE/', aborting initialization")
printerr("CORE is not located at 'res://CORE/' or 'res://addons/CORE', aborting initialization.")
return false
return true
@ -378,7 +394,7 @@ func check_godot_version() -> bool:
match(version["major"]):
4: pass
_:
printerr("The CORE Framework does not support Godot versions older or newer than 4.x.x")
printerr("The CORE Framework does not support Godot versions older or newer than 4.x.x.")
return false
match(version["minor"]):
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.")
@ -388,7 +404,7 @@ func check_godot_version() -> bool:
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.")
printerr("The CORE Framework does not support unstable Godot versions. Please switch to Godot 4.2.x.stable to ensure full compatibility.")
return false
return true

View file

@ -101,6 +101,10 @@ func _log(level: CoreTypes.LoggerLevel, origin: String, message: String) -> void
format = format.replace("%level%", "ERR!")
format_newline = format_newline.replace("%level%", "ERR!")
format = format.replace("%color%", "[color=red]")
CoreTypes.LoggerLevel.SPECIAL:
format = format.replace("%level%", "UWU!")
format_newline = format_newline.replace("%level%", "HI:3")
format = format.replace("%color%", "[color=purple]")
CoreTypes.LoggerLevel.NONE:
format = format.replace("%level%", "CRSH")
format_newline = format_newline.replace("%level%", "CRSH")

View file

@ -34,6 +34,7 @@ func load_framework(config: CoreConfiguration = CoreConfiguration.new()) -> void
config.logger_level = CoreTypes.LoggerLevel.DIAG
core = Core.new(config)
get_tree().root.add_child(core)
core.welcomed = true # Hides the welcome message shown by CORE so it doesn't bloat the log
await get_tree().process_frame
await core.complete_init()