mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
Allow Mod Loader to automatically add hooks on export (#405)
* Update Mod Loader and Tool addons * Mod tool checks if script exists before reloading * Change script export mode to Text for hook export * Change return type of load_image_from_path to Texture2D
This commit is contained in:
@@ -1 +1 @@
|
||||
uid://b0csnkkiudklo
|
||||
uid://bmpsawwiyy20a
|
||||
|
@@ -1 +1 @@
|
||||
uid://l36n5fcc565s
|
||||
uid://b6a02y62bm16j
|
||||
|
@@ -1 +1 @@
|
||||
uid://byhbvq7il70cy
|
||||
uid://cepqw3ldumchb
|
||||
|
@@ -1 +1 @@
|
||||
uid://2sifoxblubxv
|
||||
uid://b503egkdydcbv
|
||||
|
@@ -1 +1 @@
|
||||
uid://nyep44jvp7yc
|
||||
uid://2wreigxn0epq
|
||||
|
@@ -43,8 +43,13 @@ static var verbosity: VERBOSITY_LEVEL = VERBOSITY_LEVEL.DEBUG
|
||||
## Array of mods that should be ignored when logging messages (contains mod IDs as strings)
|
||||
static var ignored_mods: Array[String] = []
|
||||
|
||||
## Highlighting color for hint type log messages
|
||||
static var hint_color := Color("#70bafa")
|
||||
# NOTE: default values which get replaced later by `_configure_logger`
|
||||
static var warning_color := Color("#ffde66")
|
||||
static var success_color := Color("#5d8c3f")
|
||||
static var info_color := Color("#70bafa")
|
||||
static var hint_color := Color("#b293fa")
|
||||
static var debug_color := Color("#d4d4d4")
|
||||
static var debug_bold := true
|
||||
|
||||
## This Sub-Class represents a log entry in ModLoader.
|
||||
class ModLoaderLogEntry:
|
||||
@@ -99,9 +104,15 @@ class ModLoaderLogEntry:
|
||||
|
||||
## Get the prefix string for the log entry, including the log type and mod name.[br]
|
||||
## [br]
|
||||
## [b]Parameters:[/b][br]
|
||||
## [param exclude_type] ([bool]): (Optional) If true, the log type (e.g., DEBUG, WARN) will be excluded from the prefix. Default is false.[br]
|
||||
## [br]
|
||||
## [b]Returns:[/b] [String]
|
||||
func get_prefix() -> String:
|
||||
return "%s %s: " % [type.to_upper(), mod_name]
|
||||
func get_prefix(exclude_type := false) -> String:
|
||||
return "%s%s: " % [
|
||||
"" if exclude_type else "%s " % type.to_upper(),
|
||||
mod_name
|
||||
]
|
||||
|
||||
|
||||
## Generate an MD5 hash of the log entry (prefix + message).[br]
|
||||
@@ -391,6 +402,17 @@ static func get_all_entries_as_string(log_entries: Array) -> Array:
|
||||
# Internal log functions
|
||||
# =============================================================================
|
||||
|
||||
static func _print_rich(prefix: String, message: String, color: Color, bold := true) -> void:
|
||||
if OS.has_feature("editor"):
|
||||
var prefix_text := "[b]%s[/b]" % prefix if bold else prefix
|
||||
print_rich("[color=%s]%s[/color]%s" % [
|
||||
color.to_html(false),
|
||||
prefix_text,
|
||||
message
|
||||
])
|
||||
else:
|
||||
print(prefix + message)
|
||||
|
||||
static func _log(message: String, mod_name: String, log_type: String = "info", only_once := false) -> void:
|
||||
if _is_mod_name_ignored(mod_name):
|
||||
return
|
||||
@@ -422,25 +444,35 @@ static func _log(message: String, mod_name: String, log_type: String = "info", o
|
||||
_write_to_log_file(JSON.stringify(get_stack(), " "))
|
||||
assert(false, message)
|
||||
"error":
|
||||
printerr(log_entry.get_prefix() + message)
|
||||
if ModLoaderStore.has_feature.editor:
|
||||
printerr(log_entry.get_prefix(true) + message)
|
||||
else:
|
||||
printerr(log_entry.get_prefix() + message)
|
||||
push_error(message)
|
||||
_write_to_log_file(log_entry.get_entry())
|
||||
"warning":
|
||||
if verbosity >= VERBOSITY_LEVEL.WARNING:
|
||||
print(log_entry.get_prefix() + message)
|
||||
_print_rich(log_entry.get_prefix(), message, warning_color)
|
||||
push_warning(message)
|
||||
_write_to_log_file(log_entry.get_entry())
|
||||
"info", "success":
|
||||
"success":
|
||||
if verbosity >= VERBOSITY_LEVEL.INFO:
|
||||
print(log_entry.get_prefix() + message)
|
||||
_print_rich(log_entry.get_prefix(), message, success_color)
|
||||
_write_to_log_file(log_entry.get_entry())
|
||||
"info":
|
||||
if verbosity >= VERBOSITY_LEVEL.INFO:
|
||||
_print_rich(log_entry.get_prefix(), message, info_color)
|
||||
_write_to_log_file(log_entry.get_entry())
|
||||
"debug":
|
||||
if verbosity >= VERBOSITY_LEVEL.DEBUG:
|
||||
print(log_entry.get_prefix() + message)
|
||||
_print_rich(log_entry.get_prefix(), message, debug_color, debug_bold)
|
||||
_write_to_log_file(log_entry.get_entry())
|
||||
"hint":
|
||||
if OS.has_feature("editor") and verbosity >= VERBOSITY_LEVEL.DEBUG:
|
||||
print_rich("[color=%s]%s[/color]" % [hint_color.to_html(false), log_entry.get_prefix() + message])
|
||||
if (
|
||||
ModLoaderStore.has_feature.editor and
|
||||
verbosity >= VERBOSITY_LEVEL.DEBUG
|
||||
):
|
||||
_print_rich(log_entry.get_prefix(), message, hint_color)
|
||||
|
||||
|
||||
static func _is_mod_name_ignored(mod_name: String) -> bool:
|
||||
|
@@ -1 +1 @@
|
||||
uid://dfoleo2pforxu
|
||||
uid://ca6jko6awb8i3
|
||||
|
@@ -1 +1 @@
|
||||
uid://d2hugw88f3q4e
|
||||
uid://b3khrstensh0
|
||||
|
@@ -1 +1 @@
|
||||
uid://c0u28df0ffhan
|
||||
uid://caiv672leoq2u
|
||||
|
@@ -1 +1 @@
|
||||
uid://b73enisoxe0uq
|
||||
uid://5fg2uh7tfmrh
|
||||
|
@@ -1 +1 @@
|
||||
uid://c3rvk5ry6rqyq
|
||||
uid://ctocxfrx7h62y
|
||||
|
@@ -49,6 +49,7 @@ static func check_dependencies(mod: ModData, is_required := true, dependency_cha
|
||||
_handle_missing_dependency(mod_id, dependency_id)
|
||||
# Flag the mod so it's not loaded later
|
||||
mod.is_loadable = false
|
||||
mod.is_active = false
|
||||
else:
|
||||
var dependency: ModData = ModLoaderStore.mod_data[dependency_id]
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
uid://bnmjbsvid8sxk
|
||||
uid://be0ha68kaqhym
|
||||
|
@@ -195,10 +195,7 @@ static func file_exists_in_zip(zip_path: String, path: String) -> bool:
|
||||
if not reader:
|
||||
return false
|
||||
|
||||
if _ModLoaderGodot.is_version_below(_ModLoaderGodot.ENGINE_VERSION_HEX_4_2_0):
|
||||
return reader.get_files().has(path.trim_prefix("res://"))
|
||||
else:
|
||||
return reader.file_exists(path.trim_prefix("res://"))
|
||||
return reader.get_files().has(path.trim_prefix("res://"))
|
||||
|
||||
|
||||
static func get_mod_dir_name_in_zip(zip_path: String) -> String:
|
||||
|
@@ -1 +1 @@
|
||||
uid://d34sgvhw73mtb
|
||||
uid://43dqdp55oll
|
||||
|
@@ -1 +1 @@
|
||||
uid://dc86ulvsd1da7
|
||||
uid://dke5ndugd3pw8
|
||||
|
@@ -1 +1 @@
|
||||
uid://yrog1crr7kxp
|
||||
uid://cbqwg3m61yvwl
|
||||
|
@@ -1 +1 @@
|
||||
uid://dnwq8741pln26
|
||||
uid://dcm2pyox3kbym
|
||||
|
@@ -1 +1 @@
|
||||
uid://gxlbhvqctoix
|
||||
uid://cjg3y750m35jr
|
||||
|
@@ -1 +1 @@
|
||||
uid://bk8dltcgr6n5d
|
||||
uid://b5k7eocfniqut
|
||||
|
@@ -1 +1 @@
|
||||
uid://dahg6tbvgiy3q
|
||||
uid://b71qi44121xu6
|
||||
|
@@ -1 +1 @@
|
||||
uid://daijyovwv2vnr
|
||||
uid://2sm6ww4bwa35
|
||||
|
@@ -1 +1 @@
|
||||
uid://dinxouhn4hk1d
|
||||
uid://48f4wo7gu7pg
|
||||
|
@@ -1 +1 @@
|
||||
uid://br0xd56w758rg
|
||||
uid://jmbfyn7bw0c4
|
||||
|
@@ -1 +1 @@
|
||||
uid://bd8npc3ai2vv3
|
||||
uid://dddx78cqvuhg1
|
||||
|
1
addons/mod_loader/mod_loader_setup.gd.uid
Normal file
1
addons/mod_loader/mod_loader_setup.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b0goxb1n0eqvr
|
@@ -227,4 +227,9 @@ func _update_ml_options_from_cli_args() -> void:
|
||||
func _configure_logger() -> void:
|
||||
ModLoaderLog.verbosity = ml_options.log_level
|
||||
ModLoaderLog.ignored_mods = ml_options.ignored_mod_names_in_log
|
||||
ModLoaderLog.warning_color = ml_options.warning_color
|
||||
ModLoaderLog.success_color = ml_options.success_color
|
||||
ModLoaderLog.info_color = ml_options.info_color
|
||||
ModLoaderLog.hint_color = ml_options.hint_color
|
||||
ModLoaderLog.debug_color = ml_options.debug_color
|
||||
ModLoaderLog.debug_bold = ml_options.debug_bold
|
||||
|
@@ -1 +1 @@
|
||||
uid://jv5kxtsw7sfj
|
||||
uid://c2ajp5nymw8j8
|
||||
|
@@ -1,12 +1,8 @@
|
||||
[gd_resource type="Resource" script_class="ModLoaderCurrentOptions" load_steps=4 format=3 uid="uid://bls83tkysflvg"]
|
||||
|
||||
[ext_resource type="Resource" path="res://addons/mod_loader/options/profiles/default.tres" id="1_yg7p8"]
|
||||
[ext_resource type="Script" path="res://addons/mod_loader/resources/options_current.gd" id="2"]
|
||||
[ext_resource type="Resource" uid="uid://bau85xe7qd6xm" path="res://addons/mod_loader/options/profiles/default.tres" id="1_yg7p8"]
|
||||
[ext_resource type="Script" uid="uid://cmxtu4snlj1bb" path="res://addons/mod_loader/resources/options_current.gd" id="2"]
|
||||
[ext_resource type="Resource" path="res://addons/mod_loader/options/profiles/editor.tres" id="3"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2")
|
||||
current_options = ExtResource("1_yg7p8")
|
||||
feature_override_options = {
|
||||
"editor": ExtResource("3")
|
||||
}
|
||||
|
@@ -1,14 +1,6 @@
|
||||
[gd_resource type="Resource" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/mod_loader/resources/options_profile.gd" type="Script" id=1]
|
||||
[gd_resource type="Resource" script_class="ModLoaderOptionsProfile" load_steps=2 format=3 uid="uid://bau85xe7qd6xm"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://f46uvi5y8oqi" path="res://addons/mod_loader/resources/options_profile.gd" id="1"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource( 1 )
|
||||
enable_mods = true
|
||||
log_level = 3
|
||||
disabled_mods = [ ]
|
||||
steam_workshop_enabled = false
|
||||
override_path_to_mods = ""
|
||||
override_path_to_configs = ""
|
||||
override_path_to_workshop = ""
|
||||
script = ExtResource("1")
|
||||
|
@@ -1 +1 @@
|
||||
uid://bjfjju1edaxwv
|
||||
uid://bvxprkn5ij076
|
||||
|
@@ -1 +1 @@
|
||||
uid://bfnhjikkx0g5s
|
||||
uid://dsgr2b68w3ndv
|
||||
|
@@ -1 +1 @@
|
||||
uid://bleh3oamdbmnr
|
||||
uid://s5gnda0rx2s8
|
||||
|
@@ -1 +1 @@
|
||||
uid://ddrlbkscua6n0
|
||||
uid://diggt80eyfpwi
|
||||
|
@@ -1 +1 @@
|
||||
uid://cmxtu4snlj1bb
|
||||
uid://isimicww6eyn
|
||||
|
@@ -55,7 +55,18 @@ enum VERSION_VALIDATION {
|
||||
## [code]ModLoader:Dependency[/code] - ignore the exact name [br]
|
||||
## [code]ModLoader:*[/code] - ignore all beginning with this name [br]
|
||||
@export var ignored_mod_names_in_log: Array[String] = []
|
||||
@export var hint_color := Color("#70bafa")
|
||||
## Highlighting color for warning type log messages
|
||||
@export var warning_color := Color("#ffde66")
|
||||
## Highlighting color for success type log messages
|
||||
@export var success_color := Color("#5d8c3f")
|
||||
## Highlighting color for info type log messages
|
||||
@export var info_color := Color("#70bafa")
|
||||
## Highlighting color for hint type log messages
|
||||
@export var hint_color := Color("#b293fa")
|
||||
## Highlighting color for debug type log messages
|
||||
@export var debug_color := Color("#d4d4d4")
|
||||
## Highlight debug log prefixes with bold formatting
|
||||
@export var debug_bold := true
|
||||
|
||||
@export_group("Game Data")
|
||||
## Steam app id, can be found in the steam page url
|
||||
|
@@ -1 +1 @@
|
||||
uid://dsbicisgihjet
|
||||
uid://f46uvi5y8oqi
|
||||
|
@@ -1 +1 @@
|
||||
uid://k10oyyxy00y1
|
||||
uid://c1ryohmi4al0d
|
||||
|
@@ -1 +1 @@
|
||||
uid://djchjoj06bcko
|
||||
uid://vsfxyayum0ww
|
||||
|
@@ -1 +1 @@
|
||||
uid://2tin8kqukljx
|
||||
uid://2f67cuf7q2fr
|
||||
|
Reference in New Issue
Block a user