CORE/docs/references/CORE.md

58 lines
2.1 KiB
Markdown
Raw Normal View History

---
hide:
- navigation
---
# CORE (/root/CORE)
The main "module"
## Constants
### version
- type `Dictionary`
- description `The CORE version. "type" is the release type, "releasebuild" the number of the latest release and "full" the full version string.`
- keys `type` (`String`, either `source`, `release` or `prerelease`), `releasebuild` (`int`) and `full` (`String`)
## Enums
### Errors
- description `Contains all possible errors CORE can throw at you.`
- keys `OK`, `CORE_PROTECTIONMODE`, `CORE_EXCEPTION`, `CORE_INVALID_MODULE`, `RESOURCEMANAGER_ALREADY_EXISTS`, `RESOURCEMANAGER_RESOURCE_MISSING`, `RESOURCEMANAGER_BATCH_EMPTY`, `SCENEMANAGER_ALREADY_LOADED`, `SCENEMANAGER_NOT_LOADED` and `SCENEMANAGER_NOT_PACKEDSCENE`
## Methods
### welcome()
- returns `void`
- description `Prints a welcome message and the CORE version.`
### reload_config()
- returns `void`
- description `Reloads the configuration file and applies any changes (made in memory).`
### get_module()
- returns `Node`
- description `Returns a CORE module. A alternative to get_node("/root/CORE/<module>")`
- argument `module_name`
- type `StringName`
- mandatory `yes`
- description `The CORE module that should be returned`
- possible values `Config`, `Preprocessor`, `Logger`, `Miscellaneous`, `DebugDisplay`, `SplashScreen`, `ResourceManager`, `SceneManager` and `Events`
- example
```gdscript
extends Node
@onready
var core = get_node("/root/CORE")
@onready
var logger = core.get_module("Logger")
func _ready() -> void:
logger.info("test.gd","Hi there!")
```
### devmode()
- returns `void`
- description `Enables the development mode`
- note `Do not call this function unless you're working on CORE. It disables limits and many more things.`
### exit_safely()
- returns `void`
- description `Exists CORE safely. Is recommended over get_tree().quit() as log messages may be stuck in processing and would get lost otherwise.`
- argument `exitcode`
- type `int`
- description `Oh, you don't know what an exitcode is? Learn cmd.exe or bash you fool!`
- mandatory `no, default value is 0`
- trivia `The only thing this method does is to enable CORE's protection mode, wait 500ms (0.5s) and then quit.`