CORE/src/classes/config.gd

64 lines
2.9 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-03-31 17:59:11 +02:00
## The [code]CoreConfiguration[/code] class holds the Framework's settings.[br]
2024-03-03 18:53:09 +01:00
## The default configuration is designed to be usable without any modification.
2024-02-04 21:36:30 +01:00
extends Node
class_name CoreConfiguration
@export_category("Global")
## Controls CORE's functionality.
## 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
## Allows debugging functionality if set to [code]true[/code], or not if set to [code]false[/code].[br]
## [br]
2024-03-03 18:53:09 +01:00
## Note: This will not enable the development mode automatically, only if you're developing on CORE itself.
@export var debugging: bool
## Allows or disallows custom modules.
@export var custom_modules: bool
2024-02-04 21:36:30 +01:00
@export_category("Logger")
## I don't have to explain this, do I?
2024-02-04 21:36:30 +01:00
@export var logger_level: CoreTypes.LoggerLevel
## Toggles colored output. Set to [code]false[/code] if you don't want that.
2024-02-04 21:36:30 +01:00
@export var logger_colored: bool
## The format string the logger will operate on. 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
## This example should make it clear, what this does:
## [codeblock]
## logger_newlines_override = true:
## [09:47:00] [INFO Test.gd:69] This is a test message...
## with a newline!
## logger_newlines_override = false:
## [09:47:00] [INFO Test.gd:69] This is a test message...
## with a newline!
## [/codeblock]
2024-02-04 21:36:30 +01:00
@export var logger_newlines_override: bool
## The maximum amount of characters than can appear before [code]%message%[/code] before newlines won't be overriden. Setting this variable to [code]-1[/code] disables this behaviour.
2024-02-04 21:36:30 +01:00
@export var logger_newlines_sizelimit: int
@export_category("LogUI")
## Determines if [code]LogUI[/code] should be visible or not.
@export var logui_enabled: bool
## The color the [code]LogUI[/code] background will have. Set to [code]Color.TRANSPARENT[/code] for a transparent background.
2024-02-04 21:36:30 +01:00
@export var logui_background_color: Color
## What size the graphical log should have.
2024-02-04 21:36:30 +01:00
@export var logui_font_size: int
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
debugging = false
custom_modules = false
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
# LogUI
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