ClipMod:Adding a project

From matthyWiki
Revision as of 12:49, 19 December 2025 by Matthyno (talk | contribs) (fix requirements example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Adding the project

[edit]

Projects are made up of many different parameters and settings, all accessible via the Mod.addProject method. The addProject parameters are as follows:

Mod.addProject(name: string, description: string, price: Requirements, requirement: Requirements, display: string, todo: (isStrat: boolean) => void)

Each parameter, when broken down, can be interpreted as follows. The example provided is the vanilla "World Peace" project:

  1. name: string: The title/name of a project, e.g. "World Peace"
  2. description: string: The description below the visual name of a project, e.g. "Pareto optimal solutions to all global conflicts. (+12 Trust)"
  3. price: Requirements: The requirements to buy the project, e.g. {"yomi": 15000, "operations": 30000}. This is also automatically added to the title as subtext, i.e. how "World Peace" has "(15,000 yomi, 30,000 ops)" next to it.
  4. requirements: Requirements: The requirements to view the project in the player's "Projects" section, e.g. {"projects": ["projectButton29"]}. For "World Peace", the project depends on another project with the DOM ID projectButton29. This is the string used, not the index in the projects array.
  5. display: string: What to display in the console when the project is purchased, e.g. "World peace achieved, +12 TRUST, global stock prices trending upward"
  6. todo: The function to run once your project is completed, e.g. () => { trust += 12; stockGainThreshold += 0.01; }

The Requirements type

[edit]

The parameters of type Requirements are paramount, since they control if the player can and when the player can buy your project. Requirements is a dictionary, and there are a few supported keys that can be checked against:

  • operations: number: Minimum operations.
  • trust: number: Minimum trust.
  • clipmaker_level: number: Number of AutoClippers.
  • mws: number: Number of megawatt-seconds (HypnoDrones phase/phase 2 only).
  • yomi: number: Number of yomi from Strategic Modeling.
  • honor: number: Number of honor from battles (probe phase/phase 3 only).
  • funds: number: Amount of dollars in Available Funds (pre-HypnoDrones phase/phase 1 only).
  • projects: string[]: Array of project IDs, attainable from the DOM/Inspect Element when available to be purchased for from the corresponding entry in the global projects array's id field.
  • custom: () => boolean): True/false value determined by a function. true means this requirement passes, false means it fails the requirement.

All of these default to passing the requirement, so an empty Requirements type means that the project is available as soon as the Projects menu is unlocked.