Quick Start - polytrackmods/PolyModLoader GitHub Wiki
The basic file structure of a mod looks like this: (although this is two mods)
mod2 is the root directory of a mod (the name can be whatever), a link to this file is what should be given to users. The folders underneath the mod's root are versions of the mod.
latest.json
is a file that indicates what is the latest version of your mod that supports a certain PolyTrack version, like this:
{
"0.5.0-beta5": "0.3.0",
"0.5.0": "0.3.1"
}
Inside an individual version's root directory, a manifest.json
should be preset, looking like this:
{
"polymod": {
"name": "Example Mod",
"id": "examplemod",
"author": "Example Man",
"targets": ["0.5.0-beta5"],
"main": "main.mod.js"
},
"dependencies": []
}
"polymod" has to stay as "polymod" and cannot be changed.
- name: The fancy display name of your mod.
- id: A unique identifier that is used to identify your mod amongst others and therefore needs to be as unambiguous as possible.
- author: The author of your mod (you).
-
target: A list of the target versions of PolyTrack for this version of your mod. One of those should match the version in
latest.json
that this version is pointed to if any. -
main: The main entry point of your mod, should point to a JavaScript file exporting a variable named
polyMod
that is an instance of a class extending PolyMod, but more on that later. - dependencies: This is where you add your dependencies in the following format:
"dependencies": [
{
"id": "examplemod",
"version": "1.0.0"
},
{
"id": "anothermodid",
"version": "0.6.4"
}
]
You can also have an image (preferably square) named icon.png
for the mod's icon in the mod list provided by PMLCore.
Even more optionally, you can have an HTML file called description.html
that gets shown to users when clicking the question mark icon.
Your main mod file (as pointed by the main
entry of your manifest.json
) would look like this:
import { PolyMod } from "https://pml.orangy.cfd/PolyTrackMods/PolyModLoader/<**put your target polytrack version here**>/PolyModLoader.js";
class YourModClass extends PolyMod {
}
export let polyMod = new YourModClass();
This is the most basic form of a mod, literally doing nothing but showing up in the mod list. A few things to note:
-
<target>
(in the PolyModLoader import) should be replaced with your mod's target PolyTrack version. - The export has to be named polyMod.
- Add some Init Functions to your mod
- Register some Mixins