Skip to main content

Core

The CORE Object is responsible for initializing, managing and serving the CORE Framework.

Versioning

int version_release

CORE's version number.

CoreTypes.VersionType version_type

CORE's version type. See CoreTypes.VersionType for more information.

int version_typerelease

CORE's version type number. Resets on every new version and version type.

Modules

Use these to access CORE's modules.

  • config (NEVER access this yourself. To change the configuration, use reload_configuration() instead)
  • scheduler (runs clean up tasks periodically)
  • logger
  • misc
  • logui (not important for developers, displays the log graphically)
  • sms
  • erm (formerly edl)
  • storage
  • validation

Constants

Array[String] modules = [ "logger", "misc", "sms", "logui", "erm", "storage" ]

Used internally for loading, managing and unloading modules.

Variables

String basepath

Don't modify

Do not modify this.

Stores the path to CORE's installation directory.

Functions

void _init(CoreConfiguration new_config)

Don't call

Do not call this (except you're using Core.new()).

Awaiting required

Using the await keyword is required for this function.

Handles the preinitialization part. Does stuff like checking the engine version, loading the config and loading all modules into memory.

void complete_init()

Waits for all built-in and custom modules to fully initialize.

This ensures that all modules are fully initialized and ready for usage.
Not calling this function during startup may lead to runtime issues.

bool register_custom_module(String module_name, String module_origin, CoreBaseModule module_class)

Registers a custom module.

void unregister_custom_module(String module_name)

Unregisters a custom module, making it no longer available.

CoreBaseModule get_custom_module(String module_name)

Returns a registered custom module.
Please note that you can't get CORE's built-in modules with this function.

void reload_configuration(CoreConfiguration new_config = CoreConfiguration.new())

Loads a (new) configuration object and applies it to all modules.

void cleanup()

Makes sure that CORE does not leak memory on shutdown/unload.
Unloads all custom modules, built-in modules, frees any of CORE's classes and lastly itself.
Only call this function if you're sure that your application or game no longer uses the CORE Framework.

int register_cleanup_hook(Callable callable)

Registers a new cleanup hook.
Returns the hook id.

bool unregister_cleanup_hook_by_id(int id)

Unregisters a cleanup hook by it's id.

bool unregister_cleanup_hook_by_ref(Callable callable)

Unregisters a cleanup hook by it's reference.

bool is_devmode()

Returns if the framework is in development mode.

String get_format_string(String string)

Replaces placeholders with human-friendly strings.
You can use the following placeholders:

  • %version% Returns the version number.
  • %version_type% Returns the version type number
  • %version_semantic% Returns the result of get_version_semantic(), example 5.2.3
  • %version_type% Returns the version type as a word, for example Release Candidate
  • %version_type_technical% Returns the version type as one or two lowercase letters, for example rc
  • %devmode% Returns the development mode status
  • %headless% Returns the headless mode status
  • %custommodules% Returns if custom module support is enabled

Array[int] get_version_semantic()

Returns the CORE version in the semantic versioning scheme. The first integer contains the version number, the second integer contains the version type (0 for alpha, 1 for beta, 2 for rc and 3 for release) and the last integer contains the version type number.

void quit_safely(int exitcode = 0)

Awaiting required

Using the await keyword is required for this function.

Makes sure for all log messages to be flushed and that CORE is correctly cleaned up. Using get_tree().quit() directly may cause various issues.