CORE/src/classes/config.gd

92 lines
4 KiB
GDScript3
Raw Normal View History

# CORE FRAMEWORK SOURCE FILE
# Copyright (c) 2024 The StarOpenSource Project & Contributors
2024-03-03 18:53:09 +01:00
# Licensed in the Public Domain
2024-04-08 20:14:38 +02:00
## The framework configuration
##
## Provides the default configuration for the CORE Framework.
2024-02-04 21:36:30 +01:00
extends Node
class_name CoreConfiguration
@export_category("Global")
2024-04-08 02:43:31 +02:00
## Controls CORE's functionality.[br]
## Renders GUI-related modules useless when set to [code]false[/code], which is the recommended behaviour on servers. For CORE's full functionality, set this to [code]true[/code].
2024-02-04 21:36:30 +01:00
@export var headless: bool
2024-04-09 00:53:43 +02:00
## Puts the framework into development mode.[br]
## Unlocks experimental features.
@export var development: bool
## Allows or disallows custom modules.
@export var custom_modules: bool
2024-04-14 14:23:05 +02:00
## If [method Core.quit_safely] (and by extension [method Core.cleanup]) should be called when pressing the X.
@export var automatic_shutdown: bool
2024-02-04 21:36:30 +01:00
@export_category("Logger")
2024-04-08 20:14:38 +02:00
## The minimum log level you want to be displayed.
2024-02-04 21:36:30 +01:00
@export var logger_level: CoreTypes.LoggerLevel
2024-04-08 20:14:38 +02:00
## Determines if the logger's output should be colored.
2024-02-04 21:36:30 +01:00
@export var logger_colored: bool
## Determines if the logger should check if running in verbose mode (see [method OS.is_stdout_verbose]).[br]
## Comes with a huge performance penalty on startup, delaying startup by about one to two seconds.[br]
## Update [code]verbose_mode[/code] accordingly yourself if you've disabled this, or diagnostic log messages might appear messed up.[br]
## [b]Warning: [i]Updating this during runtime does nothing.[/i][/b]
@export var logger_detect_verbose_mode: bool
2024-04-08 20:14:38 +02:00
## The template for all log messages.[br]
## Available placeholders are: [code]%time%[/code], [code]%time_ms%[/code], [code]%level%[/code], [code]%color%[/code], [code]%message%[/code], [code]%source%[/code], [code]%source_raw%[/code], [code]%function%[/code] and [code]%line%[/code]
2024-02-04 21:36:30 +01:00
@export var logger_format: String
2024-04-08 20:14:38 +02:00
## Determines if identation should be provided if the logger encounters a newline.
2024-02-04 21:36:30 +01:00
@export var logger_newlines_override: bool
2024-04-08 20:14:38 +02:00
## The maximum amount of characters excluding the message before newlines are no longer idented. Set to [code]-1[/code] to disable this behaviour.
2024-02-04 21:36:30 +01:00
@export var logger_newlines_sizelimit: int
2024-04-08 20:14:38 +02:00
@export_category("Log UI")
## Enables or disables Log UI.
@export var logui_enabled: bool
2024-04-08 20:14:38 +02:00
## The Log UI background color. Set to [code]Color.TRANSPARENT[/code] for a transparent background.
2024-02-04 21:36:30 +01:00
@export var logui_background_color: Color
2024-04-08 20:14:38 +02:00
## What font size the graphical log should have.
2024-02-04 21:36:30 +01:00
@export var logui_font_size: int
@export_category("Miscellaneous")
## Shows or hides the type when calling [code]stringify_variables[/code].
@export var misc_stringify_show_type: bool
## Determines how [code]stringify_variables[/code] should display [class Color] variables.[br]
## Will display colors from [code]0[/code] to [code]255[/code] if [code]true[/code] or from [code]-1.0[/code] to [code]1.0[/code] if [code]false[/code].
@export var misc_stringify_color_range8: bool
## Determines if [class Array]s should be processed by [code]stringify_variables[/code].
@export var misc_stringify_array: bool
## Determines if [class Dictionary]s should be processed by [code]stringify_variables[/code].
@export var misc_stringify_dictionary: bool
@export_category("Easy Request Maker")
## Determines how unsecure requests should be handled.
@export var erm_unsecure_requests: CoreTypes.BlockadeLevel
2024-02-04 21:36:30 +01:00
2024-03-03 18:53:09 +01:00
# Populates configuration with default values
2024-02-04 21:36:30 +01:00
func _init() -> void:
# Global
headless = false
2024-04-09 00:53:43 +02:00
development = false
custom_modules = false
2024-04-14 14:23:05 +02:00
automatic_shutdown = true
2024-02-04 21:36:30 +01:00
# Logger
logger_level = CoreTypes.LoggerLevel.INFO
logger_colored = true
2024-03-05 21:32:13 +01:00
logger_format = "%color%[%time%] [%level% %origin%] %message%"
2024-02-04 21:36:30 +01:00
logger_newlines_override = true
logger_newlines_sizelimit = 40
2024-04-08 20:14:38 +02:00
# Log UI
logui_enabled = true
logui_background_color = Color.BLACK # To disable the background, use Color.TRANSPARENT
2024-02-04 21:36:30 +01:00
logui_font_size = 14
# Misc
misc_stringify_show_type = true
misc_stringify_color_range8 = true
misc_stringify_array = true
misc_stringify_dictionary = true
# Easy Request Maker
erm_unsecure_requests = CoreTypes.BlockadeLevel.BLOCK