Skip to content

Commit b372e77

Browse files
authored
Merge pull request #123 from GodotModding/__develop
v5.0.1
2 parents 8add151 + 48b2e3c commit b372e77

File tree

8 files changed

+779
-219
lines changed

8 files changed

+779
-219
lines changed

addons/mod_loader/mod_data.gd

+22-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ class_name ModData
66

77
const LOG_NAME := "ModLoader:ModData"
88

9+
# Controls how manifest.json data is logged for each mod
10+
# true = Full JSON contents (floods the log)
11+
# false = Single line (default)
12+
const USE_EXTENDED_DEBUGLOG := false
13+
914
# These 2 files are always required by mods.
1015
# [i]mod_main.gd[/i] = The main init file for the mod
1116
# [i]manifest.json[/i] = Meta data for the mod, including its dependencies
@@ -14,12 +19,18 @@ enum required_mod_files {
1419
MANIFEST,
1520
}
1621

22+
enum optional_mod_files {
23+
OVERWRITES
24+
}
25+
1726
# Directory of the mod. Has to be identical to [method ModManifest.get_mod_id]
1827
var dir_name := ""
1928
# Path to the Mod's Directory
2029
var dir_path := ""
2130
# False if any data is invalid
2231
var is_loadable := true
32+
# True if overwrites.gd exists
33+
var is_overwrite := false
2334
# Is increased for every mod depending on this mod. Highest importance is loaded first
2435
var importance := 0
2536
# Contents of the manifest
@@ -28,7 +39,7 @@ var manifest: ModManifest
2839
var config := {}
2940

3041
# only set if DEBUG_ENABLE_STORING_FILEPATHS is enabled
31-
var file_paths := []
42+
var file_paths: PoolStringArray = []
3243

3344

3445
func _init(_dir_path: String) -> void:
@@ -45,7 +56,11 @@ func load_manifest() -> void:
4556
# Load meta data file
4657
var manifest_path := get_required_mod_file_path(required_mod_files.MANIFEST)
4758
var manifest_dict := ModLoaderUtils.get_json_as_dict(manifest_path)
48-
ModLoaderUtils.log_debug_json_print("%s loaded manifest data -> " % dir_name, manifest_dict, LOG_NAME)
59+
60+
if USE_EXTENDED_DEBUGLOG:
61+
ModLoaderUtils.log_debug_json_print("%s loaded manifest data -> " % dir_name, manifest_dict, LOG_NAME)
62+
else:
63+
ModLoaderUtils.log_debug(str("%s loaded manifest data -> " % dir_name, manifest_dict), LOG_NAME)
4964

5065
var mod_manifest := ModManifest.new(manifest_dict)
5166

@@ -95,6 +110,11 @@ func get_required_mod_file_path(required_file: int) -> String:
95110
return dir_path.plus_file("manifest.json")
96111
return ""
97112

113+
func get_optional_mod_file_path(optional_file: int) -> String:
114+
match optional_file:
115+
optional_mod_files.OVERWRITES:
116+
return dir_path.plus_file("overwrites.gd")
117+
return ""
98118

99119
#func _to_string() -> String:
100120
# todo if we want it pretty printed

0 commit comments

Comments
 (0)