@@ -123,17 +123,17 @@ func _init():
123
123
# required properties (REQUIRED_META_TAGS)
124
124
for dir_name in mod_data :
125
125
var mod : ModData = mod_data [dir_name ]
126
- mod .load_details ( self )
126
+ mod .load_manifest ( )
127
127
128
128
mod_log ("DONE: Loaded all meta data" , LOG_NAME )
129
129
130
- # Run dependency checks after loading mod_details . If a mod depends on another
130
+ # Run dependency checks after loading mod_manifest . If a mod depends on another
131
131
# mod that hasn't been loaded, that dependent mod won't be loaded.
132
132
for dir_name in mod_data :
133
133
var mod : ModData = mod_data [dir_name ]
134
134
if not mod .is_loadable :
135
135
continue
136
- _check_dependencies (dir_name , mod .details .dependencies )
136
+ _check_dependencies (dir_name , mod .manifest .dependencies )
137
137
138
138
# Sort mod_load_order by the importance score of the mod
139
139
_get_load_order ()
@@ -147,8 +147,8 @@ func _init():
147
147
148
148
# Instance every mod and add it as a node to the Mod Loader
149
149
for mod in mod_load_order :
150
- # mod_log(str("Initializing -> ", mod.mod_details .extra.godot.id), LOG_NAME)
151
- mod_log ("Initializing -> %s " % mod .details .get_mod_id (), LOG_NAME )
150
+ # mod_log(str("Initializing -> ", mod.mod_manifest .extra.godot.id), LOG_NAME)
151
+ mod_log ("Initializing -> %s " % mod .manifest .get_mod_id (), LOG_NAME )
152
152
_init_mod (mod )
153
153
154
154
dev_log (str ("mod_data: " , JSON .print (mod_data , ' ' )), LOG_NAME )
@@ -315,7 +315,7 @@ func _load_mod_configs():
315
315
316
316
for dir_name in mod_data :
317
317
var json_path = configs_path .plus_file (dir_name + ".json" )
318
- var mod_config = _get_json_as_dict (json_path )
318
+ var mod_config = ModData . _get_json_as_dict (json_path )
319
319
320
320
dev_log (str ("Config JSON: Looking for config at path: " , json_path ), LOG_NAME )
321
321
@@ -334,7 +334,7 @@ func _load_mod_configs():
334
334
var new_path = mod_config .load_from
335
335
if new_path != "" && new_path != str (dir_name , ".json" ):
336
336
mod_log (str ("Config JSON: Following load_from path: " , new_path ), LOG_NAME )
337
- var new_config = _get_json_as_dict (configs_path + new_path )
337
+ var new_config = ModData . _get_json_as_dict (configs_path + new_path )
338
338
if new_config .size () > 0 != null :
339
339
mod_config = new_config
340
340
mod_log (str ("Config JSON: Loaded from custom json: " , new_path ), LOG_NAME )
@@ -373,7 +373,7 @@ func _init_mod_data(mod_folder_path):
373
373
374
374
375
375
# Run dependency checks on a mod, checking any dependencies it lists in its
376
- # mod_details (ie. its manifest.json file). If a mod depends on another mod that
376
+ # mod_manifest (ie. its manifest.json file). If a mod depends on another mod that
377
377
# hasn't been loaded, the dependent mod won't be loaded.
378
378
func _check_dependencies (mod_id :String , deps :Array ):
379
379
dev_log (str ("Checking dependencies - mod_id: " , mod_id , " dependencies: " , deps ), LOG_NAME )
@@ -386,7 +386,7 @@ func _check_dependencies(mod_id:String, deps:Array):
386
386
continue
387
387
388
388
var dependency = mod_data [dependency_id ]
389
- var dependency_mod_details = mod_data [dependency_id ].mod_details
389
+ var dependency_mod_manifest = mod_data [dependency_id ].mod_manifest
390
390
391
391
# Init the importance score if it's missing
392
392
@@ -395,8 +395,8 @@ func _check_dependencies(mod_id:String, deps:Array):
395
395
dev_log (str ("Dependency -> " , dependency_id , " importance -> " , dependency .importance ), LOG_NAME )
396
396
397
397
# check if dependency has dependencies
398
- if (dependency_mod_details .dependencies .size () > 0 ):
399
- _check_dependencies (dependency_id , dependency_mod_details .dependencies )
398
+ if (dependency_mod_manifest .dependencies .size () > 0 ):
399
+ _check_dependencies (dependency_id , dependency_mod_manifest .dependencies )
400
400
401
401
402
402
# Handle missing dependencies: Sets `is_loadable` to false and logs an error
@@ -445,8 +445,8 @@ func _init_mod(mod: ModData):
445
445
dev_log ("Loaded script -> %s " % mod_main_script , LOG_NAME )
446
446
447
447
var mod_main_instance = mod_main_script .new (self )
448
- # mod_main_instance.name = mod.mod_details .extra.godot.id
449
- mod_main_instance .name = mod .details .get_mod_id ()
448
+ # mod_main_instance.name = mod.mod_manifest .extra.godot.id
449
+ mod_main_instance .name = mod .manifest .get_mod_id ()
450
450
451
451
dev_log ("Adding child -> %s " % mod_main_instance , LOG_NAME )
452
452
add_child (mod_main_instance , true )
@@ -494,22 +494,6 @@ func _get_local_folder_dir(subfolder:String = ""):
494
494
return game_install_directory .plus_file (subfolder )
495
495
496
496
497
- # Parses JSON from a given file path and returns a dictionary.
498
- # Returns an empty dictionary if no file exists (check with size() < 1)
499
- func _get_json_as_dict (path :String )-> Dictionary :
500
- # mod_log(str("getting JSON as dict from path -> ", path), LOG_NAME)
501
- var file = File .new ()
502
-
503
- if ! file .file_exists (path ):
504
- file .close ()
505
- return {}
506
-
507
- file .open (path , File .READ )
508
- var content = file .get_as_text ()
509
-
510
- return JSON .parse (content ).result
511
-
512
-
513
497
func _get_file_name (path , is_lower_case = true , is_no_extension = false ):
514
498
# mod_log(str("Get file name from path -> ", path), LOG_NAME)
515
499
var file_name = path .get_file ()
@@ -673,7 +657,7 @@ func get_mod_config(mod_id:String = "", key:String = "")->Dictionary:
673
657
# Mod ID is valid
674
658
if error_num == 0 :
675
659
var config_data = mod_data [mod_id ].config
676
- defaults = mod_data [mod_id ].mod_details .extra .godot .config_defaults
660
+ defaults = mod_data [mod_id ].mod_manifest .extra .godot .config_defaults
677
661
678
662
# No custom JSON file
679
663
if config_data .size () == 0 :
0 commit comments