@@ -52,10 +52,19 @@ const REQUIRED_MOD_FILES = ["mod_main.gd", "manifest.json"]
52
52
const REQUIRED_META_TAGS = [
53
53
"id" ,
54
54
"name" ,
55
- "version" ,
56
- "compatible_game_version" ,
57
- "authors" ,
55
+ "version_number" ,
56
+ "website_url" ,
58
57
"description" ,
58
+ "dependencies" ,
59
+ "extra" ,
60
+ ]
61
+
62
+ # Required keys in manifest's `json.extra.godot`
63
+ const REQUIRED_MANIFEST_KEYS_EXTRA = [
64
+ "id" ,
65
+ "incompatibilities" ,
66
+ "authors" ,
67
+ "compatible_game_version" ,
59
68
]
60
69
61
70
# Set to true to require using "--enable-mods" to enable them
@@ -338,19 +347,20 @@ func _check_mod_files(mod_id):
338
347
339
348
# Load meta data into mod_data, from a mod's manifest.json file
340
349
func _load_meta_data (mod_id ):
341
- mod_log (str ("Loading meta_data for -> " , mod_id ), LOG_NAME )
350
+ mod_log (str ("Loading meta_data (manifest.json) for -> " , mod_id ), LOG_NAME )
342
351
var mod = mod_data [mod_id ]
343
352
344
353
# Load meta data file
345
354
var meta_path = mod .required_files_path ["manifest.json" ]
346
355
var meta_data = _get_json_as_dict (meta_path )
347
356
348
- dev_log (str (mod_id , " loaded meta data -> " , meta_data ), LOG_NAME )
357
+ dev_log (str (mod_id , " loaded manifest data -> " , meta_data ), LOG_NAME )
349
358
350
- # Check if the meta data has all required fields
359
+ # Check if the manifest data has all required fields
351
360
var missing_fields = _check_meta_file (meta_data )
352
361
if (missing_fields .size () > 0 ):
353
- mod_log (str ("ERROR - " , mod_id , " " , missing_fields , " are required in manifest.json." ), LOG_NAME )
362
+ for missing_field in missing_fields :
363
+ mod_log (str ("ERROR - " , mod_id , " - Missing a required field in manifest.json: '" , missing_field , "'" ), LOG_NAME )
354
364
# Flag mod - so it's not loaded later
355
365
mod .is_loadable = false
356
366
# Continue with the next mod
@@ -360,14 +370,27 @@ func _load_meta_data(mod_id):
360
370
mod .meta_data = meta_data
361
371
362
372
363
- # Make sure the meta file has all required fields
373
+ # Ensure manifest.json has all required keys
364
374
func _check_meta_file (meta_data ):
365
- var missing_fields = REQUIRED_META_TAGS
375
+ var missing_keys_root = REQUIRED_MANIFEST_KEYS_ROOT .duplicate ()
376
+ var missing_keys_extra = REQUIRED_MANIFEST_KEYS_EXTRA .duplicate ()
366
377
367
378
for key in meta_data :
368
- if (REQUIRED_META_TAGS .has (key )):
379
+ if (REQUIRED_MANIFEST_KEYS_ROOT .has (key )):
369
380
# remove the entry from missing fields if it is there
370
- missing_fields .erase (key )
381
+ missing_keys_root .erase (key )
382
+
383
+ if meta_data .has ("extra" ) && meta_data .extra .has ("godot" ):
384
+ for godot_key in meta_data :
385
+ if (REQUIRED_MANIFEST_KEYS_EXTRA .has (godot_key )):
386
+ missing_keys_extra .erase (godot_key )
387
+
388
+ # Combine both arrays, and reformat the "extra" keys
389
+ var missing_fields = missing_keys_root
390
+ if missing_keys_extra .size () > 0 :
391
+ for godot_key in missing_keys_extra :
392
+ var formatted_key = str ("extra.godot." , godot_key )
393
+ missing_fields .push_back (formatted_key )
371
394
372
395
return missing_fields
373
396
0 commit comments