CORE/corelog.gd

51 lines
1.9 KiB
GDScript3
Raw Normal View History

######################################
# 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
2023-03-18 16:34:12 +01:00
# CORE modules
var core: Node = null
var logger: Node = null
2023-03-18 16:34:12 +01:00
# 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))
2023-03-18 16:34:12 +01:00
# 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
2023-03-18 16:34:12 +01:00
func dissolve() -> void:
if core.protection_mode: return
$Background.visible = false