Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Mod Descriptor (mod_info.json)  (Read 15556 times)

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 13696
    • View Profile
Mod Descriptor (mod_info.json)
« on: November 18, 2012, 03:04:02 PM »

mod_info.json, found in the root directory of a mod, contains metadata describing the mod, as well as some directives for how the contents of the mod should be treated.

The following fields in this file are recognized by the game:
"id":"samples_mymod1",
Required.

Unique identifier for this mod. Should be something very unlikely to be used by another mod.

"name":"My Mod Name",
Required.

Name of the mod, displayed in the mod selection dialog.

"author":"Alex",
Optional.

Mod's author.

"totalConversion":"true",
Optional, defaults to "false".

Whether the mod is a total conversion. Setting this flag to true indicates that if the game loads this mod, it should not load any other mods (except for utility mods) at the same time. The game will also skip loading ship variants that refer to hull ids that no longer exist (i.e. if the TC replaces ship_data.csv with a new ship set).

"utility":"true",
Optional, defaults to "false".

Whether the mod is a utility. Utility mods can be used alongside total conversions. Note: it's the responsibility of the utility mod's creator to ensure that it's actually able to do so.

"version":"0.01",
Required.

Version of the mod.

"description":"My mod description",
Required.

Description of the mod, displayed in the mod selection dialog.

"gameVersion":"0.53.1a",
Required, but not currently used for anything.

"replace":["data/missions/mission_list.csv"],
Optional.

Certain files - such as the mission list, weapon/ship data, sounds, etc - are merged as they're loaded. For example, the core game has a set of missions, and two other mods add a few missions each. The game will merge these files together prior to loading the merged files. This allows multiple mods to coexist, but sometimes - especially for total conversions - this is not desirable.

Adding a file to the "replace" list will ensure that the mod's copy of the file will be used as-is, instead of being merged with the core file. In the above example, the mod is saying that the missions specified in its mission_list.csv should be the only ones loaded, instead of being added to the core set of missions.

Graphics, sound, and .java files are automatically replaced and don't need to be specified here.

Mods that aren't total conversions probably shouldn't use this parameter, as they're unlikely to be compatible with other mods as a result.

"jars":["one.jar","jars/two.jar"],
Optional.

The specified jar files will be loaded by the game on startup, and will be accessible from scripts, or anywhere where a class is referred to by name. For example, the "statsScript" field of a ship system definition, or an entry in generators.csv can both refer to a class found in one of the jar files.

Note: if a class is found both in a jar file and as a .java file (in the same package), the one from the jar will be used.


Sample mod_info.json
Code
{
  "id":"samples_mymod1",
  "name":"My Mod Name",
  "author":"Alex",
  "totalConversion":"false",
  "utility":"false",
  "version":"0.01",
  "description":"My mod description",
  "gameVersion":"0.53.1a",
  "replace":["data/missions/mission_list.csv"],
  "jars":["one.jar","jars/two.jar"],
}

"modPlugin":"data.scripts.MyModPlugin",
Optional.

The specified class must implement the com.fs.starfarer.api.ModPlugin interface. A new instance of it will be created and appropriate methods will be called when various lifecycle events occur, such as when the game application has finished loading. See com/fs/starfarer/api/ModPlugin.java in starfarer.api.zip for details.
« Last Edit: May 24, 2014, 10:13:06 AM by Alex »
Logged