Init commit

This commit is contained in:
2025-02-06 09:56:39 +01:00
commit 8f61ab6c6b
48 changed files with 5511 additions and 0 deletions

View File

@ -0,0 +1,4 @@
extends Resource
const DEFAULT_JUMP_VELOCITY: float = 4.5
const DEFAULT_CHARACTER_SPEED: float = 5.0

View File

@ -0,0 +1,50 @@
extends Node
class_name Logger
var thread: Thread = Thread.new()
var mutex: Mutex = Mutex.new()
var log_queue: Array[String] = []
var running: bool = true
func _ready():
thread.start(log_writer)
func info(msg: Variant):
mutex.lock()
log_queue.append("[color=white][b]INFO:[/b] [/color]" + msg)
mutex.unlock()
func debug(msg: Variant):
mutex.lock()
log_queue.append("[color=cyan][b]DEBUG:[/b] [/color]" + msg)
mutex.unlock()
func warning(msg: Variant):
mutex.lock()
log_queue.append("[color=yellow][b]WARN:[/b] [/color]" + msg)
push_warning(msg)
mutex.unlock()
func error(msg: Variant):
mutex.lock()
log_queue.append("[color=red][b]ERROR:[/b] [/color]" + msg)
push_error(msg)
mutex.unlock()
func log_writer():
while running:
mutex.lock()
while log_queue.size() > 0:
var log_message = log_queue.pop_front()
print_rich(log_message)
mutex.unlock()
# Prevent high CPU usage
await get_tree().create_timer(0.1).timeout
func _exit_tree():
running = false
thread.wait_to_finish()