Skip to content

Commit 09cf37e

Browse files
authored
feat: ✨ Added to_json() function (#175)
Can be used to retrieve the Manifest values as JSON, in the manifest.json format. Will be used in the Mod Tool.
1 parent dcdbbef commit 09cf37e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

addons/mod_loader/classes/mod_manifest.gd

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,30 @@ func get_as_dict() -> Dictionary:
120120
}
121121

122122

123+
# Returns the Manifest values as JSON, in the manifest.json format
124+
func to_json() -> String:
125+
return JSON.print({
126+
"name": name,
127+
"namespace": namespace,
128+
"version_number": version_number,
129+
"description": description,
130+
"website_url": website_url,
131+
"dependencies": dependencies,
132+
"extra": {
133+
"godot":{
134+
"authors": authors,
135+
"compatible_game_version": compatible_game_version,
136+
"compatible_mod_loader_version": compatible_mod_loader_version,
137+
"incompatibilities": incompatibilities,
138+
"tags": tags,
139+
"config_defaults": config_defaults,
140+
"description_rich": description_rich,
141+
"image": image,
142+
}
143+
}
144+
})
145+
146+
123147
# Handles deprecation of the single string value in the compatible_mod_loader_version.
124148
func _handle_compatible_mod_loader_version(godot_details: Dictionary) -> Array:
125149
var link_manifest_docs := "https://github.com/GodotModding/godot-mod-loader/wiki/Mod-Files#manifestjson"

0 commit comments

Comments
 (0)