Skip to content

Merge By ID

Tahvohck edited this page Mar 18, 2021 · 1 revision

Overview

Most of the items in the game's library are identified by a numeric ID rather than a human-readable name. The modloader will use these ID numbers to merge the XML nodes into the game's data files. These nodes are replaced wholesale, so you must include the ENTIRE node you're replacing or adding.

If you're adding new items it's recommend to prefix your definition IDs with your Discord user number (e.g. #4511) and a sequential mod number (e.g. 00 for the artificial-plant example, 01 for exterior-air-vent, etc) to come up with something reasonably unique, e.g. 451102000 for the Monster Meat crop recipe in the greenhouse example (and then 451102001 for the next ID in that mod, 451102002 for the one after that, etc etc).

Specifics

Within your mod, any files that start with a compatible file prefix in the library/ folder will be loaded as xml and merged into the relevant file. For example, haven_MyModData will be merged into haven.

If you want to replace an existing game definition, like the included Greenhouse mod does, simply copy that definition into to your mod with the same ID number that the game uses. The mod loader will replace the game's definition with the one from your mod.

If you want to create a new definition, things get a bit trickier because you need to make sure your ID numbers are unique across all mods that might get loaded. Luckily IDs can be any (positive) 32-bit integer which means there's lots of space.

In BOTH cases, any of the surrounding XML must be included as well (this means an <me> tag for a new or existing buildable must be surrounded by both <data> and <Element> tags).

Compatible files

  • library/haven
    • (almost) all nodes
  • library/animations
    • animations (Identified by n attribute)
  • library/textures
    • t and re nodes (Identified by i and n attributes respectively)
  • library/texts
    • t nodes
Clone this wiki locally