Home Report an Issue

Polymod

Atomic modding framework for Haxe

Download with haxelib install polymod

Mod Metadata

In order to be recognized by Polymod, a mod folder must contain a metadata file. By default, this file is located at _polymod_meta.json, but this can be reconfigured in your own projects. See Configuring Polymod for more information.

A mod’s metadata contains all the information needed for your project to not only recognize a mod and validate its compatibility, but also display it to your users. It includes a title, description, author, and even optionally an icon you can display.

Scanning for Mods

In your application, you can retrieve the metadata for all installed mods using the following function:

/**
 * Scan the modRoot directory for available mods and returns all their respective metadata entries.
 * @param modRoot The root directory to scan for mods in.
 * @param apiVersionStr (optional) Enforce a specific API version on mods.
 * @param errorCallback (optional) A function to receive any PolymodErrors that occur.
 * @return A list of ModMetadata objects, or an empty list.
 */
Polymod.scan(modRoot, apiVersionStr, errorCallback);

_polymod_meta.json

The metadata JSON contains data which is loaded when scanning mods, and is meant to provide readable information about the mod to users.

{
	"title":"Dragon",
	"description":"Replaces Bees with Dragons",
	"homepage": "https://example.com/dragons",
	"contributors": [
		{
			"name": "Lars A. Doucet",
			"role": "Developer"
		}
	],
	"api_version":"0.1.0",
	"mod_version":"1.0.0-alpha",
	"license":"CC BY 4.0,MIT"
}

Other files

It is highly recommended that you also include the following files: