Uncringe the project
This commit is contained in:
parent
6643152e93
commit
ed4647c750
98 changed files with 16057 additions and 3029 deletions
0
.corebasepath
Normal file
0
.corebasepath
Normal file
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,3 +1,2 @@
|
|||
*.import
|
||||
config.gd
|
||||
devprj
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
|
|
64
Makefile
64
Makefile
|
@ -1,64 +0,0 @@
|
|||
#!/bin/make
|
||||
CORE=$(shell pwd)
|
||||
ASSETS=$(CORE)/assets
|
||||
DOCSCONF=$(CORE)/mkdocs.yml
|
||||
DOCSOUT=$(CORE)/docs_out
|
||||
TESTPROJECT=$(CORE)/devprj
|
||||
|
||||
dist: help
|
||||
help:
|
||||
@echo "Available tasks: docs-deps (installs the docs dependencies via pip)"
|
||||
@echo " docs-deps-paru (install the docs dependencies via paru)"
|
||||
@echo " docs-serve (starts development server)"
|
||||
@echo " docs-build (export prod ready documentation as html)"
|
||||
@echo " docs-clean (removes the built documentation)"
|
||||
@echo " mkdevprj (creates a dev project for development)"
|
||||
@echo " rmdevprj (removes the dev project)"
|
||||
docs-deps:
|
||||
@echo ":: Installing documentation dependencies"
|
||||
@echo " This may take a few minutes"
|
||||
@pip install -r requirements.txt
|
||||
docs-deps-paru:
|
||||
@echo ":: Installing documentation dependencies"
|
||||
@echo " This may take a few minutes"
|
||||
@paru -Sy --needed python-pyyaml-env-tag python-mergedeep python-six python-smmap python-gitdb python-urllib3 python-idna python-dateutil python-pytz python-babel python-requests python-regex python-pygments python-colorama python-watchdog python-packaging python-ghp-import python-click python-jinja python-yaml python-gitpython python-markupsafe pymdown-extensions mkdocs-material-pymdownx-extras mkdocs-git-revision-date-localized-plugin mkdocs-material mkdocs
|
||||
docs-serve:
|
||||
@echo ":: Serving documentation, press CTRL+C to exit"
|
||||
@bash -c "mkdocs serve --dirtyreload --config-file "$(DOCSCONF)";exit 0"
|
||||
docs-build:
|
||||
@make docs-clean
|
||||
@echo ":: Building documentation"
|
||||
@mkdocs build --site-dir "$(DOCSOUT)" --config-file "$(DOCSCONF)"
|
||||
docs-clean:
|
||||
@echo ":: Removing built documentation"
|
||||
@rm -rf "$(DOCSOUT)"
|
||||
mkdevprj:
|
||||
@echo ":: Creating development project"
|
||||
@cp -r $(ASSETS)/testproject $(TESTPROJECT)
|
||||
@ln -s $(CORE) $(TESTPROJECT)/CORE
|
||||
@mv $(TESTPROJECT)/config.gd $(TESTPROJECT)/CORE/config.gd
|
||||
@echo ":: Development project created."
|
||||
@echo " You can now launch Godot and open '$(TESTPROJECT)'."
|
||||
@echo " If you want to submit your changes, remember to execute 'make rmdevprj' first!"
|
||||
rmdevprj:
|
||||
@echo ":: Removing development project"
|
||||
@echo ":: !!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
@echo ":: ! IMPORTANT WARNING !"
|
||||
@echo ":: !!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
@echo ":: ! Please remove the CORE !"
|
||||
@echo ":: ! development project from !"
|
||||
@echo ":: ! your project list or you !"
|
||||
@echo ":: ! will experience bugs if !"
|
||||
@echo ":: ! you edit the dev project !"
|
||||
@echo ":: ! again in the future! !"
|
||||
@echo ":: !!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
@echo ":: If you have done that, press [ENTER]."
|
||||
@read -rs
|
||||
@echo ":: Removing directory"
|
||||
@rm -rf $(TESTPROJECT)
|
||||
@rm -rf config.gd
|
||||
@echo ":: Removing 'uid://' strings"
|
||||
@#bash -c "for file in *.tscn; do cat \"\$$file\"|sed -E 's/\ uid=\"[^\"]*\"//g'|tee \$$file;done &> /dev/null"
|
||||
@echo ":: Please open all .tscn files and remove all 'uid=uid://' strings"
|
||||
@echo ":: If you have done that, press [ENTER]."
|
||||
@read -rs
|
95
README.md
95
README.md
|
@ -1,90 +1,13 @@
|
|||
<p align=center><img width=200px height=200px src="https://git.staropensource.de/staropensource/core/raw/branch/develop/soscore.png" alt="SOSCore icon"/></p>
|
||||
<div align="center">
|
||||
|
||||
# StarOpenSource CORE (aka. SOSCORE aka. CORE)
|
||||
SOSCORE/CORE is a framework that simplifies development for games and applications made in Godot 4.
|
||||
<a href="https://core.staropensource.de">
|
||||
<img src="https://git.staropensource.de/StarOpenSource/core/raw/branch/develop/dist/core.png" alt="CORE Framework" style="border-radius:50%" width="400"/>
|
||||
</a>
|
||||
|
||||
# Development status
|
||||
CORE is under heavy development and can be very unstable. Please do not use CORE in conjunction with your game/application for now (except if you want to debug your game 24/7 and read a lot of gdscript files).
|
||||
**The framework that simplifies your game/application development**
|
||||
|
||||
# Roadmap to release <img width=32 src="https://net.staropensource.de/system/custom_emojis/images/000/016/921/static/1696fdec3a625c30.png" alt=":blobfoxbongo:"/>
|
||||
- Mod loading system
|
||||
- Notification API
|
||||
- Basic debugging tool (CTRL+C to crash, F3 to toggle statistics)
|
||||
- ~~Better documentation (docs4everything)~~
|
||||
- ~~Everything commented and explained~~
|
||||
- Documentation page explaining what does what (for CORE noobies)
|
||||
- ~~Autoload singleton check removal~~
|
||||
- ~~More wmgr functions~~ (the window manager got removed in the rewrite)
|
||||
- ~~Website~~
|
||||
- ~~Silencing startup messages (info -> diag)~~
|
||||
- ~~Remove autoload component~~
|
||||
- ~~Fix syntax (set return types missing)~~
|
||||
- ~~Much more configuration options~~ (CORE's already pretty configurable)
|
||||
- Implement preprocessor placeholders
|
||||
- Clipboard content
|
||||
- CORE version
|
||||
- Dark mode
|
||||
- Dark mode support
|
||||
- Delta
|
||||
- Device hardware
|
||||
- Device model
|
||||
- CPU name
|
||||
- CPU count
|
||||
- FPS
|
||||
- Game process
|
||||
- Executable
|
||||
- Command line options
|
||||
- PID
|
||||
- Debug build
|
||||
- Language
|
||||
- Operating system
|
||||
- Operating system name
|
||||
- Operating system version
|
||||
- Distribution name
|
||||
- Project name
|
||||
- Project description
|
||||
- Rendertime
|
||||
- Window
|
||||
- Size
|
||||
- Size with decorations
|
||||
- Position
|
||||
- Title
|
||||
- Mode
|
||||
- Minimal size
|
||||
- Maximal size
|
||||
- Vsync status
|
||||
- Screen
|
||||
- Size
|
||||
- ID (main window)
|
||||
- Count
|
||||
- DPI
|
||||
- Orientation
|
||||
- Refresh rate
|
||||
- Scale
|
||||
---
|
||||
<a href="https://core.staropensource.de">Documentation</a>
|
||||
---
|
||||
|
||||
# Documentaton
|
||||
[You can access the documentation by clicking this text](https://git.staropensource.de/StarOpenSource/core/wiki)[.](https://takeb1nzyto.space)
|
||||
|
||||
# Can I use CORE in an existing project?
|
||||
Yes, in theory you can refactor your entire codebase and make a giant mess, but we don't recommend doing that.
|
||||
|
||||
# Requirements
|
||||
- Godot 4.1 (stable releases only)
|
||||
- Good experience with Godot 4 and GDScript
|
||||
|
||||
# Recommendations
|
||||
- Use the Scene Manager instead of manually managing scenes or CORE will break apart. If you don't want headaches, use the Scene Manager.
|
||||
- Use the CORE's logger implementation instead of print(). It supports rich formatting (using tags, handled by our Preprocessor™) and is generally better than using print() for everything.
|
||||
|
||||
# How to install
|
||||
- Download the [CORE manager](https://git.staropensource.de/StarOpenSource/core-manager#download) and open it
|
||||
- Enter the path to your Godot project
|
||||
- Click `Install` and wait 0-2 seconds for it to download
|
||||
- Reload your project (`Project -> Reload current project`) and start your game
|
||||
- If Godot complains that it could not load `res://`, then you successfully installed CORE. [You can now follow the post install guide](https://git.staropensource.de/StarOpenSource/core/wiki/Using-CORE)
|
||||
|
||||
# How to update
|
||||
Open the CORE manager, enter the path to your Godot project and click `Update`. Check [this documentation page](https://git.staropensource.de/StarOpenSource/core/wiki/Breaking-commits) for important commits that can cause breakage.
|
||||
|
||||
# Why is CORE not a addon?
|
||||
CORE does not add one single functionality that can be easily removed, no, it is a whole framework providing many useful functions for your game and removing it would mean lots of refactoring and headaches for you. So no, no addon.
|
||||
</div>
|
||||
|
|
51
Test.gd
Normal file
51
Test.gd
Normal file
|
@ -0,0 +1,51 @@
|
|||
##############################################################################
|
||||
### CORE FRAMEWORK SOURCE FILE ###
|
||||
### Copyright (c) 2024 The StarOpenSource Project & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### Test.gd (Testing script) ###
|
||||
### ###
|
||||
### This script is used to test CORE's behaviour during development. ###
|
||||
### It's state should be reverted to how it was before committing. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
|
||||
# CORE Configuration
|
||||
var config: CoreConfiguration = CoreConfiguration.new()
|
||||
# CORE Object
|
||||
var core: Core
|
||||
|
||||
func _ready() -> void:
|
||||
configure_core()
|
||||
# Initialize CORE with custom config
|
||||
core = Core.new(config)
|
||||
# Inject CORE
|
||||
add_child(core)
|
||||
# Print information about CORE
|
||||
core.logger.info(await core.get_formatted_string("""Version information:
|
||||
Release (semantic) = %release_semantic%
|
||||
Release = %release%
|
||||
Type = %type%
|
||||
Type (technical) = %type_technical%
|
||||
Typerelease = %release_type%
|
||||
Development mode = %devmode%
|
||||
Headless mode = %headless%"""))
|
||||
|
||||
# Update CORE configuration
|
||||
func configure_core() -> void:
|
||||
config.headless = false
|
||||
config.debug_allow = true
|
||||
config.logger_level = CoreTypes.LoggerLevel.DIAG
|
12
Test.tscn
Normal file
12
Test.tscn
Normal file
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://ckhfu6nkw6c6g"]
|
||||
|
||||
[ext_resource type="Script" path="res://Test.gd" id="1_87mte"]
|
||||
|
||||
[node name="Test" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_87mte")
|
|
@ -1,24 +0,0 @@
|
|||
extends Node
|
||||
|
||||
var core_initscript: String = "res://init.gd"
|
||||
|
||||
var preprocessor_enabled: bool = true
|
||||
var preprocessor_diagnostic: bool = false
|
||||
|
||||
var logger_enabled: bool = true
|
||||
var logger_diagnostic: bool = false
|
||||
|
||||
var corelog_enabled: bool = true
|
||||
|
||||
var debugdisplay_enabled: bool = false
|
||||
var debugdisplay_fps: bool = true
|
||||
var debugdisplay_delta: bool = true
|
||||
var debugdisplay_rendertime: bool = true
|
||||
var debugdisplay_memory: bool = true
|
||||
|
||||
var resourcemanager_load_invalid_file_as_null: bool = false
|
||||
|
||||
var splash_enabled: bool = false
|
||||
var splash_image: String = "res://CORE/soscore.png"
|
||||
var splash_image_size: int = 256
|
||||
var splash_color: String = "000000"
|
|
@ -1,9 +0,0 @@
|
|||
extends Node
|
||||
|
||||
@onready
|
||||
var core: Node = get_node("/root/CORE")
|
||||
@onready
|
||||
var logger: Node = core.get_module("Logger")
|
||||
|
||||
func _ready() -> void:
|
||||
logger.info("init.gd","init.gd loaded.")
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"wanted": {
|
||||
"min_version": 1,
|
||||
"max_version": 1,
|
||||
"min_api": 1,
|
||||
"max_api": 1
|
||||
},
|
||||
"mod": {
|
||||
"name": "CORE Test Mod",
|
||||
"version": 1,
|
||||
"version_friendly": 1.0,
|
||||
"authors": [
|
||||
"The CORE Team"
|
||||
],
|
||||
"license": "GNU General Public License v3",
|
||||
"entrypoint": "testmod.gd"
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
extends Node
|
||||
|
||||
@onready
|
||||
var core: Node = get_node("/root/core")
|
||||
@onready
|
||||
var logger: Node = core.get_module("Logger")
|
||||
|
||||
func _start() -> String:
|
||||
await get_tree().create_timer(0).timeout
|
||||
logger.info("testmod","_start() has been called.")
|
||||
return ""
|
||||
|
||||
func _stop() -> void:
|
||||
await get_tree().create_timer(0).timeout
|
||||
logger.info("testmod","_stop() has been called.")
|
126
cml.gd
126
cml.gd
|
@ -1,126 +0,0 @@
|
|||
######################################
|
||||
# THE CORE FRAMEWORK #
|
||||
# MADE BY THE STAROPENSOURCE PROJECT #
|
||||
# AND CONTRIBUTERS (THANK YOU!) #
|
||||
# #
|
||||
# COPYRIGHT 2023 THE STAROPENSOURCE #
|
||||
# PROJECT AND CONTRIBUTERS #
|
||||
# #
|
||||
# LICENSED UNDER THE GNU GENERAL #
|
||||
# PUBLIC LICENSE VERSION 3 (ONLY) #
|
||||
######################################
|
||||
extends Node
|
||||
|
||||
# CORE modules
|
||||
var core: Node = null
|
||||
var logger: Node = null
|
||||
|
||||
# Configuration
|
||||
var config_loadpath = null
|
||||
var config_wanted_name = null
|
||||
var config_wanted_version = null
|
||||
var config_wanted_api = null
|
||||
|
||||
# Modification list
|
||||
var modlist = []
|
||||
# Hook list
|
||||
var hooks = {}
|
||||
|
||||
func load_mods() -> Array:
|
||||
if core.protection_mode: return []
|
||||
var errors: Array = []
|
||||
for directory in DirAccess.get_directories_at(config_loadpath):
|
||||
var return_value: String = await load_mod(directory)
|
||||
if return_value != "":
|
||||
errors.append(return_value)
|
||||
return errors
|
||||
|
||||
func load_mod(mod_name:String) -> String:
|
||||
logger.info("CORE/cml.gd","Loading modification \"" + mod_name + "\"")
|
||||
if modlist.has(mod_name):
|
||||
logger.error("CORE/cml.gd","Modification \"" + mod_name + "\" is already loaded")
|
||||
if !FileAccess.file_exists(config_loadpath + "/" + mod_name + "/" + config_wanted_name + ".coremod"):
|
||||
logger.error("CORE/cml.gd","Modification located at " + config_loadpath + "/" + mod_name + " does not contain a " + config_wanted_name + ".coremod file")
|
||||
return "Modification located at " + config_loadpath + "/" + mod_name + " does not contain a " + config_wanted_name + ".coremod file"
|
||||
var modinfo_raw: FileAccess = FileAccess.open(config_loadpath + "/" + mod_name + "/" + config_wanted_name + ".coremod",FileAccess.READ)
|
||||
var modinfo: Dictionary = JSON.parse_string(modinfo_raw.get_as_text())
|
||||
modinfo_raw.close()
|
||||
if modinfo == null:
|
||||
logger.error("CORE/cml.gd","Failed modinfo parsing for modification located at " + config_loadpath + "/" + mod_name)
|
||||
return "Failed modinfo parsing for modification located at " + config_loadpath + "/" + mod_name
|
||||
if !modinfo.has_all(["wanted","mod"]):
|
||||
logger.error("CORE/cml.gd","The modinfo of modification located at " + config_loadpath + "/" + mod_name + " does not contain wanted, mod or both")
|
||||
return "The modinfo of modification located at " + config_loadpath + "/" + mod_name + " does not contain wanted, mod or both"
|
||||
if !modinfo["wanted"].has_all(["min_version","max_version","min_api","max_api"]):
|
||||
logger.error("CORE/cml.gd","The modinfo of modification located at " + config_loadpath + "/" + mod_name + " does not contain wanted.min_version, wanted.max_version, wanted.min_api or wanted.max_api or some combination of them.")
|
||||
return "The modinfo of modification located at " + config_loadpath + "/" + mod_name + " does not contain wanted.min_version, wanted.max_version, wanted.min_api or wanted.max_api or some combination of them."
|
||||
if !modinfo["mod"].has_all(["name","version","authors","license","entrypoint"]):
|
||||
logger.error("CORE/cml.gd","The modinfo of modification located at " + config_loadpath + "/" + mod_name + " does not contain mod.name, mod.version, mod.authors, mod.license or mod.entrypoint or some combination of them.")
|
||||
return "The modinfo of modification located at " + config_loadpath + "/" + mod_name + " does not contain mod.name, mod.version, mod.authors, mod.license or mod.entrypoint or some combination of them."
|
||||
if not modinfo["wanted"]["min_version"] <= config_wanted_version or not modinfo["wanted"]["max_version"] >= config_wanted_version:
|
||||
logger.error("CORE/cml.gd","The modification \"" + modinfo["mod"]["name"] + " does not match wanted version " + str(config_wanted_version))
|
||||
return "The modification \"" + modinfo["mod"]["name"] + " does not match wanted version " + str(config_wanted_version)
|
||||
if not modinfo["wanted"]["min_api"] <= config_wanted_api or not modinfo["wanted"]["max_api"] >= config_wanted_api:
|
||||
logger.error("CORE/cml.gd","The modification \"" + modinfo["mod"]["name"] + " does not match wanted api " + str(config_wanted_api))
|
||||
return "The modification \"" + modinfo["mod"]["name"] + " does not match wanted api " + str(config_wanted_api)
|
||||
if !FileAccess.file_exists(config_loadpath + "/" + mod_name + "/" + modinfo["mod"]["entrypoint"]):
|
||||
logger.error("CORE/cml.gd","The entrypoint for the modification \"" + modinfo["mod"]["name"] + "\" located at \"" + config_loadpath + "/" + mod_name + "/" + modinfo["mod"]["entrypoint"] + "\" does not exist")
|
||||
return "The entrypoint for the modification \"" + modinfo["mod"]["name"] + "\" located at \"" + config_loadpath + "/" + mod_name + "/" + modinfo["mod"]["entrypoint"] + "\" does not exist"
|
||||
|
||||
var entrypoint_script: Script = ResourceLoader.load(config_loadpath + "/" + mod_name + "/" + modinfo["mod"]["entrypoint"])
|
||||
var entrypoint: Node = Node.new()
|
||||
entrypoint.name = mod_name
|
||||
entrypoint.set_script(entrypoint_script)
|
||||
get_tree().root.add_child(entrypoint)
|
||||
var mod_err: String = await get_node("/root/" + mod_name)._start()
|
||||
if mod_err == "":
|
||||
modlist.append(mod_name)
|
||||
return ""
|
||||
else:
|
||||
get_tree().root.remove_child(entrypoint)
|
||||
return "Modification \"" + mod_name + "\" could not be loaded as it returned this error: " + mod_err
|
||||
|
||||
func unload_mods() -> void:
|
||||
for mod in modlist:
|
||||
await unload_mod(mod)
|
||||
|
||||
func unload_mod(mod_name:String) -> void:
|
||||
logger.info("CORE/cml.gd","Unloading modification \"" + mod_name + "\"")
|
||||
if !modlist.has(mod_name):
|
||||
logger.error("CORE/cml.gd","Modification \"" + mod_name + "\" is not loaded")
|
||||
if get_tree().root.get_node_or_null(mod_name) == null:
|
||||
core.exception("CORE/cml.gd","Could not locate mod entrypoint script for mod \"" + mod_name + "\" during unload")
|
||||
return
|
||||
await get_node("/root/" + mod_name)._stop()
|
||||
get_tree().root.remove_child(get_node("/root/" + mod_name))
|
||||
modlist.erase(mod_name)
|
||||
|
||||
func register_hook(mod_name:String,hook_name:String,hook_action:int,method:Callable) -> bool:
|
||||
if !modlist.has(mod_name):
|
||||
core.exception("CORE/cml.gd","Failed registering hook \"" + hook_name + "\" for mod \"" + mod_name + "\" as it does not exist or is not loaded")
|
||||
return false
|
||||
core.exception("CORE/cml.gd","Function not implemented")
|
||||
return true
|
||||
|
||||
func get_list() -> Array:
|
||||
return modlist
|
||||
|
||||
func get_info(mod_name:String) -> Dictionary:
|
||||
if !modlist.has(mod_name):
|
||||
return {"error":"Modification \"" + mod_name + "\" is not loaded"}
|
||||
var modinfo_raw: FileAccess = FileAccess.open(config_loadpath + "/" + mod_name + "/" + config_wanted_name + ".coremod",FileAccess.READ)
|
||||
var modinfo: Dictionary = JSON.parse_string(modinfo_raw.get_as_text())
|
||||
modinfo_raw.close()
|
||||
if modinfo == null:
|
||||
return {"error":"Failed parsing modinfo for modification \"" + mod_name + "\""}
|
||||
return modinfo
|
||||
|
||||
func load_configuration() -> void:
|
||||
if core.protection_mode: return
|
||||
config_loadpath = core.config.cml_loadpath
|
||||
config_wanted_name = core.config.cml_wanted_name
|
||||
config_wanted_version = core.config.cml_wanted_version
|
||||
if core.config.get("cml_wanted_api") == null:
|
||||
config_wanted_api = config_wanted_version
|
||||
else:
|
||||
config_wanted_api = core.config.cml_wanted_api
|
|
@ -1,45 +0,0 @@
|
|||
##############################
|
||||
# THE CORE FRAMEWORK #
|
||||
# EXAMPLE CONFIGURATION FILE #
|
||||
# #
|
||||
# THIS DOCUMENT IS PUBLICLY #
|
||||
# AVAILABLE UNDER THE PUBLIC #
|
||||
# DOMAIN AND IS NOT LICENSED #
|
||||
##############################
|
||||
extends Node
|
||||
|
||||
# Hello there, fellow developer!
|
||||
# This is a example configuration file
|
||||
# for the CORE Framework (source 0).
|
||||
#
|
||||
# Most settings in this config should be
|
||||
# self explanitory. If not, visit the documentation:
|
||||
# https://core.staropensource.de/references/Configuration_File/
|
||||
#
|
||||
# Thank you for using the CORE Framework!
|
||||
# - The StarOpenSource Project & Contributers
|
||||
|
||||
var core_initscript: String = "res://init.gd"
|
||||
|
||||
var preprocessor_enabled: bool = true
|
||||
var preprocessor_diagnostic: bool = false
|
||||
|
||||
var logger_enabled: bool = true
|
||||
var logger_diagnostic: bool = false
|
||||
|
||||
var corelog_enabled: bool = true
|
||||
|
||||
var debugdisplay_enabled: bool = false
|
||||
var debugdisplay_fps: bool = true
|
||||
var debugdisplay_delta: bool = true
|
||||
var debugdisplay_rendertime: bool = true
|
||||
var debugdisplay_memory: bool = true
|
||||
|
||||
var resourcemanager_load_invalid_file_as_null: bool = false
|
||||
|
||||
var splash_enabled: bool = false
|
||||
var splash_image: String = "res://CORE/soscore.png"
|
||||
var splash_image_size: int = 256
|
||||
var splash_color: String = "000000"
|
||||
|
||||
# EOF <- Yes, this is the end of the example configuration! Pretty short, isn't it?
|
231
core.gd
231
core.gd
|
@ -1,231 +0,0 @@
|
|||
######################################
|
||||
# THE CORE FRAMEWORK #
|
||||
# MADE BY THE STAROPENSOURCE PROJECT #
|
||||
# AND CONTRIBUTERS (THANK YOU!) #
|
||||
# #
|
||||
# COPYRIGHT 2023 THE STAROPENSOURCE #
|
||||
# PROJECT AND CONTRIBUTERS #
|
||||
# #
|
||||
# LICENSED UNDER THE GNU GENERAL #
|
||||
# PUBLIC LICENSE VERSION 3 (ONLY) #
|
||||
######################################
|
||||
extends Node
|
||||
|
||||
# CORE modules
|
||||
var logger: Node = null
|
||||
var preprocessor: Node = null
|
||||
var config: Node = null
|
||||
|
||||
# Version
|
||||
const version: Dictionary = {"type":"source","releasebuild":0,"full":"source 0"}
|
||||
# Protection mode
|
||||
var protection_mode: bool = false
|
||||
# Development mode
|
||||
var development_mode: bool = false
|
||||
# Loadpath (from coreinit.gd)
|
||||
var loadpath: String = ""
|
||||
|
||||
# Errors
|
||||
enum Errors {
|
||||
OK,
|
||||
CORE_PROTECTIONMODE,
|
||||
CORE_EXCEPTION,
|
||||
CORE_INVALID_MODULE,
|
||||
RESOURCEMANAGER_ALREADY_EXISTS,
|
||||
RESOURCEMANAGER_INVALID_FILEPATH,
|
||||
RESOURCEMANAGER_RESOURCE_MISSING,
|
||||
RESOURCEMANAGER_BATCH_EMPTY,
|
||||
SCENEMANAGER_ALREADY_LOADED,
|
||||
SCENEMANAGER_NOT_LOADED,
|
||||
SCENEMANAGER_NOT_PACKEDSCENE
|
||||
}
|
||||
|
||||
func welcome() -> void:
|
||||
if protection_mode: return
|
||||
logger.info("CORE/core.gd","CORE (" + version["full"] + ") welcomes you!<nl>It seems like everything is working :)")
|
||||
|
||||
func reload_config() -> void:
|
||||
var corelog: Node = get_node("/root/CORE/CORELog")
|
||||
var debugdisplay: Node = get_node("/root/CORE/DebugDisplay")
|
||||
var resourcemanager: Node = get_node("/root/CORE/ResourceManager")
|
||||
var splash: Node = get_node("/root/CORE/SplashScreen")
|
||||
preprocessor.enabled = get_config("preprocessor_enabled",true)
|
||||
preprocessor.diagnostic = get_config("preprocessor_diagnostic",false)
|
||||
logger.enabled = get_config("logger_enabled",true)
|
||||
logger.diagnostic = get_config("logger_diagnostic",false)
|
||||
if get_config("corelog_enabled",true):
|
||||
corelog.display()
|
||||
else:
|
||||
corelog.dissolve()
|
||||
debugdisplay.config_enabled = get_config("debugdisplay_enabled",true)
|
||||
debugdisplay.config_fps = get_config("debugdisplay_fps",true)
|
||||
debugdisplay.config_delta = get_config("debugdisplay_delta",true)
|
||||
debugdisplay.config_rendertime = get_config("debugdisplay_rendertime",true)
|
||||
debugdisplay.config_memory = get_config("debugdisplay_memory",true)
|
||||
resourcemanager.config_load_invalid_file_as_null = get_config("resourcemanager_load_invalid_file_as_null",false)
|
||||
splash.config_enabled = get_config("splash_enabled",false)
|
||||
splash.config_image = get_config("splash_image","[LOADPATH]soscore.png").replace("[LOADPATH]",loadpath)
|
||||
splash.config_image_size = get_config("config.splash_image_size",256)
|
||||
splash.config_color = get_config("config.splash_color","#d60532")
|
||||
splash.apply_config()
|
||||
|
||||
func get_config(config_key:StringName,default_value:Variant) -> Variant:
|
||||
if protection_mode: return null
|
||||
if config.get(config_key) == null:
|
||||
return default_value
|
||||
else:
|
||||
return config.get(config_key)
|
||||
|
||||
func get_module(module_name:String) -> Node:
|
||||
if protection_mode: return null
|
||||
if module_name == "CORELog":
|
||||
var err = error("CORE",Errors.CORE_INVALID_MODULE,{"module":module_name})
|
||||
logger.error("CORE/core.gd",err["error"])
|
||||
return err["code"]
|
||||
var module: Node = get_node_or_null("/root/CORE/" + module_name)
|
||||
if module == null:
|
||||
var err = error("CORE",Errors.CORE_INVALID_MODULE,{"module":module_name})
|
||||
logger.error("CORE/core.gd",err["error"])
|
||||
return err["code"]
|
||||
return module
|
||||
|
||||
func devmode():
|
||||
logger.warn("CORE/core.gd","Development mode is now active.<nl>Keep this disabled if you don't know what you're doing<nl>or you may encounter serious issues!<nl><nl>You have been warned!")
|
||||
logger.warn("CORE/core.gd","The development mode does nothing as of now. It is just \"a thing\" implemented for the future")
|
||||
development_mode = true
|
||||
|
||||
func exception(module:String,exception_error:String):
|
||||
protection_mode = true
|
||||
var submit_issue_default = "Please report this crash to the CORE Framework repository (with
|
||||
the full log file). You can submit a crash report at:
|
||||
https://git.staropensource.de/StarOpenSource/core/issues/new"
|
||||
var submit_issue_devmode = """Please do NOT report this crash to the CORE Framework repository
|
||||
as CORE is running in development mode, which is not supported."""
|
||||
var exc_message: String = """
|
||||
[color=red]################################
|
||||
EXCEPTION! EXCEPTION! EXCEPTION!
|
||||
|
||||
The CORE Framework experienced a critical error in runtime.
|
||||
%submit_issue%
|
||||
|
||||
CORE INFORMATION
|
||||
version = "%version%"
|
||||
development_mode = %development_mode%
|
||||
preprocessor_enabled = %preprocessor_enabled%
|
||||
preprocessor_diagnostic = %preprocessor_diagnostic%
|
||||
logger_enabled = %logger_enabled%
|
||||
logger_diagnostic = %logger_diagnostic%
|
||||
|
||||
OPERATING SYSTEM
|
||||
timezone = %timezone%
|
||||
time_utc = "%time_utc%"
|
||||
time_unix = %time_unix%
|
||||
date = "%date%"
|
||||
locale = "%locale%"
|
||||
lang = "%lang%"
|
||||
name = "%name%"
|
||||
distro = "%distro%"
|
||||
version = "%version_os%"
|
||||
memory = %memory%
|
||||
memory_peak = %memory_peak%
|
||||
memory_usage = %memory_usage%
|
||||
processor_count = %processor_count%
|
||||
processor_name = "%processor_name%"
|
||||
video_adapter = %video_adapter%
|
||||
rendering_api = "%rendering_api%"
|
||||
|
||||
APPLICATION
|
||||
cmdline = %cmdline%
|
||||
permissions = %permissions%
|
||||
debug_build = %debug_build%
|
||||
|
||||
ERROR INFORMATION
|
||||
module = "%module%"
|
||||
error = "%error%"
|
||||
|
||||
STACKTRACE
|
||||
%stacktrace%
|
||||
|
||||
EXCEPTION! EXCEPTION! EXCEPTION!
|
||||
################################
|
||||
"""
|
||||
if development_mode:
|
||||
exc_message = exc_message.replace("%submit_issue%",submit_issue_devmode)
|
||||
else:
|
||||
exc_message = exc_message.replace("%submit_issue%",submit_issue_default)
|
||||
exc_message = exc_message.replace("%version%",version["full"])
|
||||
exc_message = exc_message.replace("%development_mode%",str(development_mode))
|
||||
exc_message = exc_message.replace("%preprocessor_enabled%",str(preprocessor.enabled))
|
||||
exc_message = exc_message.replace("%preprocessor_diagnostic%",str(preprocessor.diagnostic))
|
||||
exc_message = exc_message.replace("%logger_enabled%",str(logger.enabled))
|
||||
exc_message = exc_message.replace("%logger_diagnostic%",str(logger.diagnostic))
|
||||
|
||||
exc_message = exc_message.replace("%timezone%",str(Time.get_time_zone_from_system()))
|
||||
exc_message = exc_message.replace("%time_utc%",Time.get_time_string_from_system(true))
|
||||
exc_message = exc_message.replace("%time_unix%",str(Time.get_unix_time_from_datetime_string(Time.get_time_string_from_system(true))))
|
||||
exc_message = exc_message.replace("%date%",Time.get_date_string_from_system(true))
|
||||
exc_message = exc_message.replace("%locale%",OS.get_locale())
|
||||
exc_message = exc_message.replace("%lang%",OS.get_locale_language())
|
||||
exc_message = exc_message.replace("%name%",OS.get_name())
|
||||
exc_message = exc_message.replace("%distro%",OS.get_distribution_name())
|
||||
exc_message = exc_message.replace("%version_os%",OS.get_version())
|
||||
exc_message = exc_message.replace("%memory%",str(OS.get_memory_info()))
|
||||
exc_message = exc_message.replace("%memory_peak%",str(OS.get_static_memory_peak_usage()))
|
||||
exc_message = exc_message.replace("%memory_usage%",str(OS.get_static_memory_usage()))
|
||||
exc_message = exc_message.replace("%processor_count%",str(OS.get_processor_count()))
|
||||
exc_message = exc_message.replace("%processor_name%",OS.get_processor_name())
|
||||
exc_message = exc_message.replace("%video_adapter%",str(OS.get_video_adapter_driver_info()))
|
||||
exc_message = exc_message.replace("%rendering_api%",RenderingServer.get_video_adapter_api_version())
|
||||
|
||||
exc_message = exc_message.replace("%cmdline%",str(OS.get_cmdline_args()))
|
||||
exc_message = exc_message.replace("%permissions%",str(OS.get_granted_permissions()))
|
||||
exc_message = exc_message.replace("%debug_build%",str(OS.is_debug_build()))
|
||||
|
||||
exc_message = exc_message.replace("%module%",module)
|
||||
exc_message = exc_message.replace("%error%",exception_error)
|
||||
exc_message = exc_message.replace("%stacktrace%",str(get_stack()))
|
||||
|
||||
print_rich(exc_message)
|
||||
await get_tree().create_timer(0.25).timeout
|
||||
get_tree().quit(255)
|
||||
|
||||
func error(module:String,error_enum:Errors,error_info:Dictionary = {}) -> Dictionary:
|
||||
match(error_enum):
|
||||
Errors.OK:
|
||||
exception("core","Module \"" + module + "\" tried recieving information about error OK (are you ok?)")
|
||||
Errors.CORE_PROTECTIONMODE:
|
||||
return {"code":9223372036854775807,"error":"CORE is in protection mode and is unavailable"}
|
||||
Errors.CORE_EXCEPTION:
|
||||
return {"code":9223372036854775806,"error":"Launching nuke in 3... 2... 1..."}
|
||||
Errors.CORE_INVALID_MODULE:
|
||||
return {"code":Errors.CORE_INVALID_MODULE,"error":"The CORE module \"" + error_info["module"] + "\" does not exist"}
|
||||
Errors.RESOURCEMANAGER_ALREADY_EXISTS:
|
||||
return {"code":Errors.RESOURCEMANAGER_ALREADY_EXISTS,"error":"Failed loading resource: The resource \"" + error_info["name"] + "\" is already loaded"}
|
||||
Errors.RESOURCEMANAGER_INVALID_FILEPATH:
|
||||
return {"code":Errors.RESOURCEMANAGER_INVALID_FILEPATH,"error":"Failed loading resource: The filepath \"" + error_info["filepath"] + "\" is invalid"}
|
||||
Errors.RESOURCEMANAGER_RESOURCE_MISSING:
|
||||
return {"code":Errors.RESOURCEMANAGER_RESOURCE_MISSING,"error":"Failed unloading resource: The resource \"" + error_info["name"] + "\" is not loaded"}
|
||||
Errors.RESOURCEMANAGER_BATCH_EMPTY:
|
||||
return {"code":Errors.RESOURCEMANAGER_BATCH_EMPTY,"error":"Failed processing batch: The batch is empty"}
|
||||
Errors.SCENEMANAGER_ALREADY_LOADED:
|
||||
if error_info["one_scene_overlay"]:
|
||||
return {"code":Errors.SCENEMANAGER_ALREADY_LOADED,"error":"Failed adding scene \"" + error_info["scene"] + "\" to overlay \"" + error_info["overlay"] + "\": The overlay is full"}
|
||||
else:
|
||||
return {"code":Errors.SCENEMANAGER_ALREADY_LOADED,"error":"Failed adding scene \"" + error_info["scene"] + "\" to overlay \"" + error_info["overlay"] + "\": A resource with the same name is already present in that overlay"}
|
||||
Errors.SCENEMANAGER_NOT_LOADED:
|
||||
if error_info["one_scene_overlay"]:
|
||||
return {"code":Errors.SCENEMANAGER_ALREADY_LOADED,"error":"Failed removing scene \"" + error_info["scene"] + "\" from overlay \"" + error_info["overlay"] + "\": The overlay is empty"}
|
||||
else:
|
||||
return {"code":Errors.SCENEMANAGER_ALREADY_LOADED,"error":"Failed removing scene \"" + error_info["scene"] + "\" from overlay \"" + error_info["overlay"] + "\": A resource with that name could not be found within the overlay"}
|
||||
Errors.SCENEMANAGER_NOT_PACKEDSCENE:
|
||||
return {"code":Errors.SCENEMANAGER_NOT_PACKEDSCENE,"error":"Failed adding scene \"" + error_info["scene"] + "\" to overlay \"" + error_info["overlay"] + "\": The specified resource is not a PackedScene"}
|
||||
_:
|
||||
exception("core","Failed generating error: Invalid error \"" + str(error) + "\"")
|
||||
return error("CORE",Errors.CORE_EXCEPTION)
|
||||
|
||||
func exit_safely(exitcode:int = 0) -> void:
|
||||
if protection_mode: return
|
||||
logger.info("CORE/core.gd","Shutting down...")
|
||||
protection_mode = true
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
get_tree().quit(exitcode)
|
209
coreinit.gd
209
coreinit.gd
|
@ -1,209 +0,0 @@
|
|||
######################################
|
||||
# THE CORE FRAMEWORK #
|
||||
# MADE BY THE STAROPENSOURCE PROJECT #
|
||||
# AND CONTRIBUTERS (THANK YOU!) #
|
||||
# #
|
||||
# COPYRIGHT 2023 THE STAROPENSOURCE #
|
||||
# PROJECT AND CONTRIBUTERS #
|
||||
# #
|
||||
# LICENSED UNDER THE GNU GENERAL #
|
||||
# PUBLIC LICENSE VERSION 3 (ONLY) #
|
||||
######################################
|
||||
extends Node
|
||||
|
||||
var loadpath: String = "res://CORE/"
|
||||
|
||||
# To workaround the "busy setting up children" issue coreinit.gd
|
||||
# "reloads" itself. I don't know why it works, but it works.
|
||||
func _ready() -> void:
|
||||
if name == "COREINIT":
|
||||
initialize()
|
||||
else:
|
||||
print("coreinit -> \"Fixing\" busy setting up children issue")
|
||||
var coreinit_raw: Script = ResourceLoader.load(loadpath + "coreinit.gd")
|
||||
var coreinit: Node = Node.new()
|
||||
coreinit.name = "COREINIT"
|
||||
coreinit.set_script(coreinit_raw)
|
||||
get_tree().root.add_child.call_deferred(coreinit)
|
||||
if loadpath == "":
|
||||
coreinit.set_deferred("loathpath","res://CORE/")
|
||||
else:
|
||||
coreinit.set_deferred("loadpath",loadpath)
|
||||
queue_free()
|
||||
|
||||
# Bootstraps CORE
|
||||
func initialize() -> void:
|
||||
print("coreinit -> Bootstrapping CORE")
|
||||
# Check requirements and quit if not met
|
||||
if !check_requirements():
|
||||
await get_tree().create_timer(0.25).timeout
|
||||
get_tree().quit(255)
|
||||
return
|
||||
# Load module scripts and scenes
|
||||
print("coreinit -> Loading modules")
|
||||
var mod_config_raw: Script = ResourceLoader.load(loadpath + "config.gd")
|
||||
var mod_corelog_raw: PackedScene = ResourceLoader.load(loadpath + "corelog.tscn")
|
||||
var mod_logger_raw: Script = ResourceLoader.load(loadpath + "logger.gd")
|
||||
var mod_preprocessor_raw: Script = ResourceLoader.load(loadpath + "preprocessor.gd")
|
||||
var mod_core_raw: Script = ResourceLoader.load(loadpath + "core.gd")
|
||||
var mod_misc_raw: Script = ResourceLoader.load(loadpath + "misc.gd")
|
||||
var mod_debugdisplay_raw: PackedScene = ResourceLoader.load(loadpath + "debugdisplay.tscn")
|
||||
var mod_splash_raw: PackedScene = ResourceLoader.load(loadpath + "splash.tscn")
|
||||
var mod_resmgr_raw: Script = ResourceLoader.load(loadpath + "resmgr.gd")
|
||||
var mod_smgr_raw: Script = ResourceLoader.load(loadpath + "smgr.gd")
|
||||
var mod_events_raw: Script = ResourceLoader.load(loadpath + "events.gd")
|
||||
#var mod_cml_raw: Script = ResourceLoader.load(loadpath + "cml.gd")
|
||||
var mod_mkdown_raw: Script = ResourceLoader.load(loadpath + "mkdown.gd")
|
||||
# Create nodes and add the raw scripts + give them names
|
||||
print("coreinit -> Constructing modules")
|
||||
var mod_config: Node = Node.new()
|
||||
mod_config.name = "Config"
|
||||
mod_config.set_script(mod_config_raw)
|
||||
var mod_preprocessor: Node = Node.new()
|
||||
mod_preprocessor.name = "Preprocessor"
|
||||
mod_preprocessor.set_script(mod_preprocessor_raw)
|
||||
var mod_logger: Node = Node.new()
|
||||
mod_logger.name = "Logger"
|
||||
mod_logger.set_script(mod_logger_raw)
|
||||
var mod_corelog: Node = mod_corelog_raw.instantiate()
|
||||
mod_corelog.name = "CORELog"
|
||||
var mod_core: Node = Node.new()
|
||||
mod_core.name = "CORE"
|
||||
mod_core.set_script(mod_core_raw)
|
||||
mod_core.loadpath = loadpath
|
||||
var mod_misc: Node = Node.new()
|
||||
mod_misc.name = "Miscellaneous"
|
||||
mod_misc.set_script(mod_misc_raw)
|
||||
var mod_debugdisplay: Node = mod_debugdisplay_raw.instantiate()
|
||||
mod_debugdisplay.name = "DebugDisplay"
|
||||
var mod_splash: Node = mod_splash_raw.instantiate()
|
||||
mod_splash.name = "SplashScreen"
|
||||
var mod_resmgr: Node = Node.new()
|
||||
mod_resmgr.name = "ResourceManager"
|
||||
mod_resmgr.set_script(mod_resmgr_raw)
|
||||
var mod_smgr: Node = Node.new()
|
||||
mod_smgr.name = "SceneManager"
|
||||
mod_smgr.set_script(mod_smgr_raw)
|
||||
var mod_events: Node = Node.new()
|
||||
mod_events.name = "Events"
|
||||
mod_events.set_script(mod_events_raw)
|
||||
#var mod_cml: Node = Node.new()
|
||||
#mod_cml.name = "ModLoader"
|
||||
#mod_cml.set_script(mod_cml_raw)
|
||||
var mod_mkdown: Node = Node.new()
|
||||
mod_mkdown.name = "Markdown"
|
||||
mod_mkdown.set_script(mod_mkdown_raw)
|
||||
# Add all modules to /root/
|
||||
print("coreinit -> Injecting modules")
|
||||
get_tree().root.add_child(mod_core)
|
||||
mod_core.add_child(mod_config)
|
||||
mod_core.add_child(mod_preprocessor)
|
||||
mod_core.add_child(mod_logger)
|
||||
mod_core.add_child(mod_misc)
|
||||
mod_core.add_child(mod_corelog)
|
||||
mod_core.add_child(mod_debugdisplay)
|
||||
mod_core.add_child(mod_splash)
|
||||
mod_core.add_child(mod_resmgr)
|
||||
mod_core.add_child(mod_smgr)
|
||||
#mod_core.add_child(mod_cml)
|
||||
mod_core.add_child(mod_events)
|
||||
mod_core.add_child(mod_mkdown)
|
||||
# Updates references to other modules
|
||||
print("coreinit -> Updating dependency references")
|
||||
mod_corelog.core = mod_core
|
||||
mod_corelog.logger = mod_logger
|
||||
mod_preprocessor.core = mod_core
|
||||
mod_preprocessor.logger = mod_logger
|
||||
mod_logger.core = mod_core
|
||||
mod_logger.preprocessor = mod_preprocessor
|
||||
mod_core.logger = mod_logger
|
||||
mod_core.preprocessor = mod_preprocessor
|
||||
mod_core.config = mod_config
|
||||
mod_misc.core = mod_core
|
||||
mod_debugdisplay.core = mod_core
|
||||
mod_debugdisplay.misc = mod_misc
|
||||
mod_splash.core = mod_core
|
||||
mod_splash.logger = mod_logger
|
||||
mod_resmgr.core = mod_core
|
||||
mod_resmgr.logger = mod_logger
|
||||
mod_smgr.logger = mod_logger
|
||||
mod_smgr.core = mod_core
|
||||
mod_smgr.resourcemanager = mod_resmgr
|
||||
mod_events.core = mod_core
|
||||
#mod_cml.core = mod_core
|
||||
#mod_cml.logger = mod_logger
|
||||
mod_events.logger = mod_logger
|
||||
mod_mkdown.core = mod_core
|
||||
mod_mkdown.logger = mod_logger
|
||||
# Apply config to base modules
|
||||
print("coreinit -> Applying configuration to base modules")
|
||||
mod_preprocessor.enabled = get_config(mod_config,"preprocessor_enabled",true)
|
||||
mod_preprocessor.diagnostic = get_config(mod_config,"preprocessor_diagnostic",false)
|
||||
mod_logger.enabled = get_config(mod_config,"logger_enabled",true)
|
||||
mod_logger.diagnostic = get_config(mod_config,"logger_diagnostic",false)
|
||||
if get_config(mod_config,"corelog_enable",true):
|
||||
mod_corelog.display()
|
||||
else:
|
||||
mod_corelog.dissolve()
|
||||
# Call initialize() on base modules
|
||||
print("coreinit -> Initializing base modules")
|
||||
mod_corelog.initialize()
|
||||
mod_logger.initialize()
|
||||
mod_preprocessor.initialize()
|
||||
# Apply config to all modules
|
||||
mod_logger.diag("CORE/coreinit.gd","Reloading configuration")
|
||||
mod_core.reload_config()
|
||||
# Call initialize() method on all modules
|
||||
mod_logger.diag("CORE/coreinit.gd","Initializing modules")
|
||||
#mod_splash.initialize() ## Has no initialize() method
|
||||
#mod_resmgr.initialize() ## Has no initialize() method
|
||||
mod_smgr.initialize()
|
||||
#mod_cml.initialize()
|
||||
mod_events.initialize()
|
||||
# Inject init script
|
||||
mod_logger.diag("CORE/coreinit.gd","Loading init script")
|
||||
if !FileAccess.file_exists(get_config(mod_config,"startup_script","res://init.gd")):
|
||||
mod_core.exception("CORE/coreinit.gd","Startup script located at \"" + get_config(mod_config,"startup_script","res://init.gd") + "\" does not exist")
|
||||
return
|
||||
var initscr_raw: Script = ResourceLoader.load(get_config(mod_config,"core_initscript","res://init.gd"))
|
||||
mod_logger.diag("CORE/coreinit.gd","Constructing init script")
|
||||
var initscr: Node = Node.new()
|
||||
initscr.name = "InitializationScript"
|
||||
initscr.set_script(initscr_raw)
|
||||
mod_logger.diag("CORE/coreinit.gd","Injecting init script")
|
||||
get_tree().root.add_child(initscr)
|
||||
mod_logger.diag("CORE/coreinit.gd","Bootstrapped CORE, exiting.")
|
||||
queue_free()
|
||||
|
||||
# Retrieves a key's value from the configuration file
|
||||
func get_config(config:Node,config_key:StringName,default_value:Variant) -> Variant:
|
||||
if config.get(config_key) == null:
|
||||
return default_value
|
||||
else:
|
||||
return config.get(config_key)
|
||||
|
||||
# Check CORE's requirements
|
||||
func check_requirements() -> bool:
|
||||
var engine_version: Dictionary = Engine.get_version_info()
|
||||
print("coreinit -> Checking CORE requirements")
|
||||
# Check if Godot major version is exactly 4
|
||||
if engine_version["major"] != 4:
|
||||
print("coreinit -> Error: CORE only supports Godot 4.1.stable releases.")
|
||||
return false
|
||||
# Check if Godot minor version is exactly 1
|
||||
if engine_version["minor"] != 1:
|
||||
print("coreinit -> Error: CORE only supports Godot 4.1.stable releases.")
|
||||
return false
|
||||
# Check if Godot release channel is "stable"
|
||||
if engine_version["status"] != "stable":
|
||||
print("coreinit -> Error: CORE only supports Godot 4.1.stable releases.")
|
||||
return false
|
||||
# Display warning if autoloads are used
|
||||
if get_tree().root.get_child_count(true) != 2:
|
||||
print("coreinit -> Warning: We do not recommend using autoloads in your project as bugs may occur.")
|
||||
# Check if configuration file exists
|
||||
if !FileAccess.file_exists(loadpath + "config.gd"):
|
||||
print("coreinit -> Error: The CORE configuration file is missing. Use CORE Manager to repair your project.")
|
||||
return false
|
||||
# Success!
|
||||
return true
|
|
@ -1,13 +0,0 @@
|
|||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://CORE/coreinit.gd" id="1_ubktt"]
|
||||
|
||||
[node name="coreinit" type="Node"]
|
||||
script = ExtResource("1_ubktt")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
offset_left = -5e+08
|
||||
offset_top = -5e+08
|
||||
offset_right = 5e+08
|
||||
offset_bottom = 5e+08
|
||||
color = Color(0, 0, 0, 1)
|
50
corelog.gd
50
corelog.gd
|
@ -1,50 +0,0 @@
|
|||
######################################
|
||||
# THE CORE FRAMEWORK #
|
||||
# MADE BY THE STAROPENSOURCE PROJECT #
|
||||
# AND CONTRIBUTERS (THANK YOU!) #
|
||||
# #
|
||||
# COPYRIGHT 2023 THE STAROPENSOURCE #
|
||||
# PROJECT AND CONTRIBUTERS #
|
||||
# #
|
||||
# LICENSED UNDER THE GNU GENERAL #
|
||||
# PUBLIC LICENSE VERSION 3 (ONLY) #
|
||||
######################################
|
||||
extends Node
|
||||
|
||||
# CORE modules
|
||||
var core: Node = null
|
||||
var logger: Node = null
|
||||
|
||||
# Initializes CORELog
|
||||
func initialize() -> void:
|
||||
if core.protection_mode: return
|
||||
# logevent (signal) -> logupdate()
|
||||
logger.connect("logevent",Callable(self,"logupdate"))
|
||||
|
||||
# Activate auto scrolling
|
||||
$Background/Log.scroll_active = true
|
||||
$Background/Log.scroll_following = true
|
||||
# Disable mouse influence
|
||||
$Background/Log.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
$Background/Log.get_child(0,true).mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
# Remove every VScrollBar style
|
||||
$Background/Log.get_child(0,true).add_theme_stylebox_override("grabber",StyleBoxEmpty.new())
|
||||
$Background/Log.get_child(0,true).add_theme_stylebox_override("grabber_highlight",StyleBoxEmpty.new())
|
||||
$Background/Log.get_child(0,true).add_theme_stylebox_override("grabber_pressed",StyleBoxEmpty.new())
|
||||
$Background/Log.get_child(0,true).add_theme_stylebox_override("scroll",StyleBoxEmpty.new())
|
||||
$Background/Log.get_child(0,true).add_theme_stylebox_override("scroll_focus",StyleBoxEmpty.new())
|
||||
# Set VScollBar size to zero
|
||||
$Background/Log.get_child(0,true).set_deferred("size",Vector2i(0,0))
|
||||
|
||||
# Updates log text
|
||||
func logupdate(_type:String,_script:String,_method:String,logmessage:String) -> void:
|
||||
$Background/Log.text = $Background/Log.text + "\n" + logmessage
|
||||
|
||||
# These two functions are very self explanitory
|
||||
func display() -> void:
|
||||
if core.protection_mode: return
|
||||
$Background.visible = true
|
||||
|
||||
func dissolve() -> void:
|
||||
if core.protection_mode: return
|
||||
$Background.visible = false
|
52
corelog.tscn
52
corelog.tscn
|
@ -1,52 +0,0 @@
|
|||
[gd_scene load_steps=5 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://CORE/corelog.gd" id="1_8l1qi"]
|
||||
[ext_resource type="FontFile" path="res://CORE/hack.ttf" id="1_m5led"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_adeh8"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_koe3t"]
|
||||
|
||||
[node name="CORELog" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_8l1qi")
|
||||
|
||||
[node name="Background" type="ColorRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 960.0
|
||||
offset_bottom = 540.0
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Log" type="RichTextLabel" parent="Background"]
|
||||
layout_mode = 0
|
||||
offset_right = 960.0
|
||||
offset_bottom = 540.0
|
||||
theme_override_colors/default_color = Color(1, 1, 1, 1)
|
||||
theme_override_fonts/normal_font = ExtResource("1_m5led")
|
||||
theme_override_fonts/bold_font = ExtResource("1_m5led")
|
||||
theme_override_fonts/italics_font = ExtResource("1_m5led")
|
||||
theme_override_fonts/bold_italics_font = ExtResource("1_m5led")
|
||||
theme_override_fonts/mono_font = ExtResource("1_m5led")
|
||||
theme_override_font_sizes/normal_font_size = 12
|
||||
theme_override_font_sizes/bold_font_size = 12
|
||||
theme_override_font_sizes/italics_font_size = 12
|
||||
theme_override_font_sizes/bold_italics_font_size = 12
|
||||
theme_override_font_sizes/mono_font_size = 12
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_adeh8")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_koe3t")
|
||||
bbcode_enabled = true
|
||||
text = "coreinit -> \"Fixing\" busy setting up children issue
|
||||
coreinit -> Bootstrapping CORE
|
||||
coreinit -> Checking CORE requirements
|
||||
coreinit -> Loading modules
|
||||
coreinit -> Constructing modules
|
||||
coreinit -> Injecting modules
|
||||
coreinit -> Updating dependency references
|
||||
coreinit -> Applying configuration to base modules
|
||||
coreinit -> Initializing base modules"
|
||||
scroll_following = true
|
|
@ -1,52 +0,0 @@
|
|||
#!/bin/bash
|
||||
if [ "$1" == "--help" ]; then
|
||||
echo "Environment variables: VERBOSE (false)"
|
||||
echo " FILEEXTENSION (*)"
|
||||
echo " IGNORE_SCRIPT (false)"
|
||||
echo " IGNORE_DOCUMENTATION (false)"
|
||||
echo " NUMBER_ONLY (false)"
|
||||
exit 0
|
||||
fi
|
||||
function dircount() {
|
||||
if [ "$VERBOSE" == "true" ]; then echo ":: Checking directory \"$*\"..."; fi
|
||||
cd "$*" || exit 54
|
||||
for file in $FILEEXTENSION; do
|
||||
export "file_full=$*/$file"
|
||||
if [ -d "$file" ]; then
|
||||
if [ "$file" == "devprj" ]; then
|
||||
if [ "$VERBOSE" == "true" ]; then echo ":: Skipping directory \"devprj\"";fi
|
||||
else
|
||||
if [ "$IGNORE_DOCUMENTATION" == "true" ] && [ "$file" == "docs" ]; then
|
||||
if [ "$VERBOSE" == "true" ]; then echo ":: Skipping directory \"docs\"";fi
|
||||
else
|
||||
dircount "$file_full"
|
||||
fi
|
||||
fi
|
||||
elif [ -f "$file" ]; then
|
||||
if [ "$IGNORE_SCRIPT" == "true" ] && [ "$file" == "count_characters.sh" ]; then
|
||||
if [ "$VERBOSE" == "true" ]; then echo ":: Skipping this script"; fi
|
||||
else
|
||||
if [ "$VERBOSE" == "true" ]; then echo ":: Counting characters in file \"$file_full\"..."; fi
|
||||
export "COUNT_FILE=$(wc -m < "$file_full")"
|
||||
export "COUNT=$((COUNT + COUNT_FILE))"
|
||||
fi
|
||||
else
|
||||
if [ "$VERBOSE" == "true" ]; then echo ":: Skipping \"$file_full\" (no file or directory)"; fi
|
||||
fi
|
||||
done
|
||||
cd ..
|
||||
}
|
||||
if [ "$FILEEXTENSION" == "" ]; then
|
||||
export "FILEEXTENSION=*"
|
||||
fi
|
||||
if [ "$*" == "" ]; then
|
||||
dircount "$(pwd)"
|
||||
else
|
||||
dircount "$(pwd)/$*"
|
||||
fi
|
||||
if [ "$VERBOSE" == "true" ]; then echo ""; fi
|
||||
if [ "$NUMBER_ONLY" == "true" ]; then
|
||||
echo "$COUNT"
|
||||
else
|
||||
echo "Characters counted: $COUNT"
|
||||
fi
|
|
@ -1,71 +0,0 @@
|
|||
######################################
|
||||
# THE CORE FRAMEWORK #
|
||||
# MADE BY THE STAROPENSOURCE PROJECT #
|
||||
# AND CONTRIBUTERS (THANK YOU!) #
|
||||
# #
|
||||
# COPYRIGHT 2023 THE STAROPENSOURCE #
|
||||
# PROJECT AND CONTRIBUTERS #
|
||||
# #
|
||||
# LICENSED UNDER THE GNU GENERAL #
|
||||
# PUBLIC LICENSE VERSION 3 (ONLY) #
|
||||
######################################
|
||||
extends Node
|
||||
|
||||
# CORE modules
|
||||
var core: Node = null
|
||||
var misc: Node = null
|
||||
|
||||
# Important nodes
|
||||
@onready
|
||||
var display: RichTextLabel = get_node("Display")
|
||||
|
||||
# Config
|
||||
var config_enabled: bool = false
|
||||
var config_fps: bool = false
|
||||
var config_delta: bool = false
|
||||
var config_rendertime: bool = false
|
||||
var config_memory: bool = false
|
||||
|
||||
# Check if enabled
|
||||
func _process(_delta) -> void:
|
||||
if config_enabled:
|
||||
update_display()
|
||||
display.visible = true
|
||||
else:
|
||||
display.visible = false
|
||||
|
||||
# Updates the display with useful information
|
||||
func update_display():
|
||||
var displaytext: String = ""
|
||||
var displaysize: int = 17
|
||||
# Get memory information
|
||||
var info_memory: Dictionary = OS.get_memory_info()
|
||||
if config_memory:
|
||||
info_memory.merge({"peak":OS.get_static_memory_peak_usage(),"percent":float(OS.get_static_memory_usage())/info_memory["physical"]*100,"used":OS.get_static_memory_usage()})
|
||||
|
||||
# If fps is enabled, add the fps counter
|
||||
if config_fps:
|
||||
displaysize = displaysize+17*1
|
||||
displaytext = displaytext + "\nFPS: " + str(snappedf(misc.get_fps(false),0.01))
|
||||
# If delta is enabled, add the delta counter
|
||||
if config_delta:
|
||||
displaysize = displaysize+17*1
|
||||
displaytext = displaytext + "\nDelta: " + str(misc.get_delta())
|
||||
# If rendertime is enabled, add the rendertime counter
|
||||
if config_rendertime:
|
||||
displaysize = displaysize+17*1
|
||||
displaytext = displaytext + "\nRendertime: " + str(misc.get_rendertime())
|
||||
# If memory is enabled, display memory information
|
||||
if config_memory:
|
||||
displaysize = displaysize+17*2
|
||||
displaytext = displaytext + "\nMemory (Available|Used|Stack): " + str(misc.byte_to_mib(info_memory["available"],true)) + " MiB|" + str(misc.byte_to_mib(info_memory["used"],true)) + " MiB|" + str(misc.byte_to_mib(info_memory["stack"],true)) + " MiB"
|
||||
displaytext = displaytext + "\nMemory (Physical|Peak|%): " + str(misc.byte_to_mib(info_memory["physical"],true)) + " MiB|" + str(misc.byte_to_mib(info_memory["peak"],true)) + " MiB|" + str(snappedf(info_memory["percent"],0.001)) + "%"
|
||||
|
||||
# Add CORE version and (if enabled) a dev mode notice
|
||||
if core.development_mode:
|
||||
displaytext = "CORE " + core.version["full"] + " [color=yellow](development mode)[/color]" + displaytext
|
||||
else:
|
||||
displaytext = "CORE " + core.version["full"] + displaytext
|
||||
# Update display
|
||||
display.text = displaytext
|
||||
display.size = Vector2i(540,displaysize)
|
|
@ -1,34 +0,0 @@
|
|||
[gd_scene load_steps=5 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://CORE/debugdisplay.gd" id="1_hcfi0"]
|
||||
[ext_resource type="FontFile" path="res://CORE/hack.ttf" id="1_nhdg1"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3c08d"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5ghow"]
|
||||
bg_color = Color(0.839216, 0.0196078, 0.196078, 0.862745)
|
||||
corner_radius_bottom_right = 16
|
||||
shadow_color = Color(0, 0, 0, 0)
|
||||
|
||||
[node name="DebugDisplay" type="Node"]
|
||||
script = ExtResource("1_hcfi0")
|
||||
|
||||
[node name="Display" type="RichTextLabel" parent="."]
|
||||
offset_right = 540.0
|
||||
offset_bottom = 102.0
|
||||
theme_override_colors/default_color = Color(1, 1, 1, 1)
|
||||
theme_override_fonts/normal_font = ExtResource("1_nhdg1")
|
||||
theme_override_font_sizes/normal_font_size = 14
|
||||
theme_override_font_sizes/bold_font_size = 14
|
||||
theme_override_font_sizes/italics_font_size = 14
|
||||
theme_override_font_sizes/bold_italics_font_size = 14
|
||||
theme_override_font_sizes/mono_font_size = 14
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_3c08d")
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_5ghow")
|
||||
bbcode_enabled = true
|
||||
text = "CORE source-N (development mode) (THIS IS A PLACEHOLDER!)
|
||||
FPS:
|
||||
Delta:
|
||||
Rendertime:
|
||||
Memory (1):
|
||||
Memory (2):"
|
BIN
dist/FiraCode/Bold.ttf
vendored
Normal file
BIN
dist/FiraCode/Bold.ttf
vendored
Normal file
Binary file not shown.
33
dist/FiraCode/Bold.ttf.import
vendored
Normal file
33
dist/FiraCode/Bold.ttf.import
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://bvg3rkn8w7apl"
|
||||
path="res://.godot/imported/Bold.ttf-ab518348487b0af32a3bf04bad1329bc.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://docs/static/dist/FiraCode/Bold.ttf"
|
||||
dest_files=["res://.godot/imported/Bold.ttf-ab518348487b0af32a3bf04bad1329bc.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
dist/FiraCode/Light.ttf
vendored
Normal file
BIN
dist/FiraCode/Light.ttf
vendored
Normal file
Binary file not shown.
33
dist/FiraCode/Light.ttf.import
vendored
Normal file
33
dist/FiraCode/Light.ttf.import
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://bvluo6uibvwwo"
|
||||
path="res://.godot/imported/Light.ttf-ad4f5cc78f585b9feb8a0964e43f9ad0.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://dist/FiraCode/Light.ttf"
|
||||
dest_files=["res://.godot/imported/Light.ttf-ad4f5cc78f585b9feb8a0964e43f9ad0.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
dist/FiraCode/Medium.ttf
vendored
Normal file
BIN
dist/FiraCode/Medium.ttf
vendored
Normal file
Binary file not shown.
33
dist/FiraCode/Medium.ttf.import
vendored
Normal file
33
dist/FiraCode/Medium.ttf.import
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://b1pxod4r5puw8"
|
||||
path="res://.godot/imported/Medium.ttf-59b027cf923d1808848708fe911fbecd.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://docs/static/dist/FiraCode/Medium.ttf"
|
||||
dest_files=["res://.godot/imported/Medium.ttf-59b027cf923d1808848708fe911fbecd.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
dist/FiraCode/Regular.ttf
vendored
Normal file
BIN
dist/FiraCode/Regular.ttf
vendored
Normal file
Binary file not shown.
33
dist/FiraCode/Regular.ttf.import
vendored
Normal file
33
dist/FiraCode/Regular.ttf.import
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://dmyes0lwt4sgw"
|
||||
path="res://.godot/imported/Regular.ttf-2558edcdc38a3fc7826c41c3a4184518.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://docs/static/dist/FiraCode/Regular.ttf"
|
||||
dest_files=["res://.godot/imported/Regular.ttf-2558edcdc38a3fc7826c41c3a4184518.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
dist/FiraCode/Retina.ttf
vendored
Normal file
BIN
dist/FiraCode/Retina.ttf
vendored
Normal file
Binary file not shown.