@@ -6,6 +6,11 @@ class_name ModData
6
6
7
7
const LOG_NAME := "ModLoader:ModData"
8
8
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
+
9
14
# These 2 files are always required by mods.
10
15
# [i]mod_main.gd[/i] = The main init file for the mod
11
16
# [i]manifest.json[/i] = Meta data for the mod, including its dependencies
@@ -14,12 +19,18 @@ enum required_mod_files {
14
19
MANIFEST ,
15
20
}
16
21
22
+ enum optional_mod_files {
23
+ OVERWRITES
24
+ }
25
+
17
26
# Directory of the mod. Has to be identical to [method ModManifest.get_mod_id]
18
27
var dir_name := ""
19
28
# Path to the Mod's Directory
20
29
var dir_path := ""
21
30
# False if any data is invalid
22
31
var is_loadable := true
32
+ # True if overwrites.gd exists
33
+ var is_overwrite := false
23
34
# Is increased for every mod depending on this mod. Highest importance is loaded first
24
35
var importance := 0
25
36
# Contents of the manifest
@@ -28,7 +39,7 @@ var manifest: ModManifest
28
39
var config := {}
29
40
30
41
# only set if DEBUG_ENABLE_STORING_FILEPATHS is enabled
31
- var file_paths : = []
42
+ var file_paths : PoolStringArray = []
32
43
33
44
34
45
func _init (_dir_path : String ) -> void :
@@ -45,7 +56,11 @@ func load_manifest() -> void:
45
56
# Load meta data file
46
57
var manifest_path := get_required_mod_file_path (required_mod_files .MANIFEST )
47
58
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 )
49
64
50
65
var mod_manifest := ModManifest .new (manifest_dict )
51
66
@@ -95,6 +110,11 @@ func get_required_mod_file_path(required_file: int) -> String:
95
110
return dir_path .plus_file ("manifest.json" )
96
111
return ""
97
112
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 ""
98
118
99
119
# func _to_string() -> String:
100
120
# todo if we want it pretty printed
0 commit comments