Add special welcome message

This also adds this nice banner (thanks figlet!):
_________________________________   __________                                                    ______
__  ____/_  __ \__  __ \__  ____/   ___  ____/____________ _______ ___________      _________________  /__
_  /    _  / / /_  /_/ /_  __/      __  /_   __  ___/  __ `/_  __ `__ \  _ \_ | /| / /  __ \_  ___/_  //_/
/ /___  / /_/ /_  _, _/_  /___      _  __/   _  /   / /_/ /_  / / / / /  __/_ |/ |/ // /_/ /  /   _  ,<
\____/  \____/ /_/ |_| /_____/      /_/      /_/    \__,_/ /_/ /_/ /_/\___/____/|__/ \____//_/    /_/|_|
This commit is contained in:
JeremyStar™ 2024-04-23 21:34:38 +02:00
parent 8be2024552
commit e7d0a9d9a6
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
6 changed files with 27 additions and 6 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.

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()