Your First Mod ‐ Setting up a Project - mechanikate/ClipMod GitHub Wiki

Projects have a lot of confusing parameters, but my goal here will be to demystify them as much as possible. The class constructor looks like this:

class Project(name: String, description: String, pid: Number, price: Object, requirement: Object, todo: Function -> void, modid: String)

Let's go through these one by one:

  1. name: The display name of the project, e.g. "WireBuyer"
  2. description: The display description of the project, e.g. "Automatically purchases wire when you run out"
  3. pid: This doesn't really matter, set it to whatever integer you want. Just avoid setting it to the same as another project in your mod or a negative number or a float, e.g. 32
  4. price: The amounts of things lost (as opposed to amount of things needed to be discovered, like requirements) when you buy the project, e.g. {operations:7000}
  5. requirements: When can this upgrade be seen in the available projects list? Same format as price.
  6. display: The message to send in the terminal when you buy this upgrade, e.g. "WireBuyer activated"
  7. todo: A function without a return to run when you buy an upgrade, e.g. () => { boostLvl++; }
  8. modid: The ID of your mod, generally in camelCase, e.g. exampleMod.

After you initialize your Project class using the above guidelines, you can run .setup() on it to add it to the list of projects internally in the game. Then, make sure to do all this in a function that's being pushed to clipHooks, like this:

clipHooks.push(() => {
    new Project(...).setup();
});

It can also be helpful to push the Project class to a list for debugging, like this:

const exampleModDebugProjects = [];
clipHooks.push(() => {
    exampleModDebugProjects.push(new Project(...).setup());
});