Skip to content

style: resolve type and style requests from #562 #566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions addons/mod_loader/api/log.gd
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ class ModLoaderLogEntry:
## [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(exclude_type: bool = false) -> String:
func get_prefix(exclude_type := false) -> String:
return "%s%s: " % [
"" if exclude_type else type.to_upper() + " ",
"" if exclude_type else "%s " % type.to_upper(),
mod_name
]

Expand Down Expand Up @@ -402,7 +402,7 @@ 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):
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" % [
Expand Down Expand Up @@ -444,7 +444,7 @@ 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":
if OS.has_feature("editor"):
if ModLoaderStore.has_feature.editor:
printerr(log_entry.get_prefix(true) + message)
else:
printerr(log_entry.get_prefix() + message)
Expand All @@ -468,8 +468,11 @@ static func _log(message: String, mod_name: String, log_type: String = "info", o
_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(log_entry.get_prefix(), message, hint_color)
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:
Expand Down
5 changes: 1 addition & 4 deletions addons/mod_loader/internal/file.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down