Mod folders, load order, file mods

Where mods live

Every mod is a folder or a .zip file in the mods folder next to the game's executable:

carnivores.exe            (or carnivores on Linux)
data/                     the game's own files (made by the first-run setup from your APK)
mods/
  modlist.txt             the load order (the game writes it)
  hello/                  a mod as a folder
    mod.json
    main.lua
  RaptorPack.zip          a mod as a zip (the same files inside)

A zip is unpacked by the game into mods/.unpacked/ (again whenever the zip is newer). Its id is the zip's file name, RaptorPack.zip. Inside the zip, files may sit at the top or in folders; both work.

mod.json

Optional, but every published mod should have one:

{
  "name": "Raptor Pack",
  "version": "1.2.0",
  "author": "Nedry",
  "description": "Smarter raptors that hunt in packs, and two new raptor species.",
  "main": "main.lua",
  "api": 1,
  "requires": ["uilib"],
  "optional": ["scoreboard"]
}
Field Meaning
name shown in the Mods screen and the mod menu (default: the id)
version any text; shown next to the name
author shown in the Mods screen
description shown in the Mods screen
main the Lua file that starts the mod (default main.lua); no main file = not a script mod
api the lowest modding API version the mod needs (game.apiVersion()); an older game shows the mod as failed with the reason instead of running it
requires ids of mods it cannot work without: it loads after them, and does not run when one is missing, off or failed
optional ids of mods it uses when they are there: it loads after them

JSON comments (//) and trailing commas are allowed in every JSON file the mod loader and the Lua API read.

Load order

The Mods screen (main menu → MODS) lists every mod with a checkbox (on / off) and arrows (order). Apply saves the order to mods/modlist.txt and reloads the scripts. The file is plain text: one mod id per line, top first, - in front of a switched-off mod:

# Load order: later lines win. A leading '-' switches a mod off.
HuntersPack.zip
hello
-old_test_mod

Later wins. When two mods have a file with the same name, the one lower in the list is used; the Mods screen shows these conflicts. Script mods load in list order too, and content packs apply in list order (a later pack overrides the same entry of an earlier one). New mods are added at the end, switched on.

File mods: replacing and adding game files

The game opens its files by file name only: the folders inside data/ do not matter for lookups. So a mod file named like a game file replaces it, wherever it sits in the mod:

mods/BlueRex/tirex.cat        replaces the T-Rex (model, animations and sounds)
mods/QuietGun/shot1.wav       replaces a gunshot sound (example name)

A file with a new name is simply added; content packs and scripts use added files (new models, sounds, maps).

What can be replaced, and the formats: The game's files lists every file group, and Data file formats documents each format byte by byte.

When changes apply: files are looked up again when you press Apply or Look again in the Mods screen. Files the game already loaded (the menu art, the current map, species already in memory) change after a restart or the next time the game loads them (the next hunt, for maps and creatures).

Files a mod's scripts read with mod.read, or sounds it plays with sound.play, are found the same way, so a script mod can ship its own .wav files and JSON data.

Mod data and settings

Script mods save their data with mod.save into the game's save folder, moddata/<id>.json; settings declared with mod.setting go to moddata/<id>.settings.json. The save folder is %APPDATA%\carnivores on Windows and ~/.local/share/carnivores on Linux. Deleting a mod's files there resets it.

Publishing a mod