Skip to content

PML API ​

PML API is an API mod introduced with 0.5.2. It was introduced in order to clean up base PML and move some features that should not be part of the base mod loader into a separate, optional mod.

How to use ​

If you want to use PML API, add the pmlapi dependency to your mod's version.json:

json
"dependencies": [
  {
    "id": "pmlapi",
    "version": "^0.2.0"
  }
]

Modules ​

The PML API is divided into several "modules", such as

  • EditorExtras: custom blocks, eases access to currect track parts, events for joining / leaving both tracks and the editor, etc.
  • SoundManager: Get & play sound buffers, override sounds, etc.
  • SimCommunicator: Ease communication from main to simulation workers, etc.

These modules make usage of the PML API's features relatively straightforward.

Events ​

Every above module dispatches events that anyone can add a listener for in this format:

ts
editorExtras.addEventListener("event", (e: any) => { // callback function })