Mod Info.json Overview

From Starsector Wiki
Jump to navigation Jump to search
Icon cross.png
At least two versions out of date. Last verified for version 0.95. Please refer to Version History and update this page.


Description

mod_info.json is a required file that informs the game engine how to set up and use a mod. The game will be looking for a file named "mod_info.json" in the base folder of each mod i.e. \Starsector\mods\MyMod\mod_Info.json .

Every mod must have a mod_info.json file. If it is missing or not in the expected location, the mod will not show up in the mod list in the launcher. It is formatted in Starsector's somewhat loose JSON schema.

Example

{
"id":"example", # required code id
"name":"Example Mod A", # required friendly name
"author":"example mod author name", # author's name
"totalConversion":"false", # whether this is a total conversion or not
"utility":"false", # whether this is a utility mod (utility mods may be safely removed from a save)
"version": {"major":1, "minor":0, "patch":0}, # required mod version, this shows 1.0.0
"description":"Example mod_info.json file", # required friendly mod description
"gameVersion":"0.95a-RC15", # required starsector version this was designed for
"replace":["data/missions/mission_list.csv"], # files to not load (for total conversions)
"jars":["jars/example.jar"], # mod jars
"modPlugin":"data.scripts.ModPlugin", # mod java classes
"dependencies":[
    # Which mods this mod requires to run. Version can also be specified as a single string. "patch" and "minor" are optional, 
    # both here and in other places a version is specified. A major mismatch with a dependency means this mod can't be enabled. 
    # A minor/patch mismatch results in a warning. If the version of the dependency is omitted, any version will do. 
    # A missing dependency means this mod can't be enabled.
    {"id":"lw_lazylib", "name":"LazyLib", "version":{"major":2, "minor":4e}}
],
"requiredMemoryMB":1024, # Optional. If this mod substantially increases the memory required by the game, it should be set to some amount; used by the automatic memory allocation function of the launcher.
}

Required elements

id

Unique ID of your mod. Ensure it is unique from other mods. By convention it is the same or similar to the mod folder. Text field

name

This is the user facing friendly name of your mod, as it will appear in the mod loader. Text field

version

The version of your mod (not the intended version of Starfarer). Displayed in the mod loader next to the friendly mod name. Text Field OR JSON object that must contain the key "major" with corresponding values, and optionally the keys "minor" and/or "patch" with their own values.

description

The description of your mod as it appears in the mod loader. You can force a line break by using the backslash special breakout character followed by the letter n, "\n ". Text field

gameVersion

The base version of Starfarer that the mod is intended for. While required this currently (0.9) isn't used to perform any checks or other actions. Text field

Optional elements

author

The name of the author. Displayed in the mod loader following the description. Text field

utility

Denotes if the mod is a utility mod. Utility mods can be loaded alongside total conversions. Defaults to "false", from "true" or "false"

jars

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. If a class is found both in a jar file and as a .java file in the same package then the one from the jar will be used. JSON array

modPlugin

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. Used for scripts that extend BaseModPlugin (typically for initialization of mod specific campaign map generation and AI plugins). JSON array

dependencies

Which mods this mod requires to run. Version can also be specified as a single string. "patch" and "minor" are optional, both here and in other places a version is specified. A major mismatch with a dependency means this mod can't be enabled. A minor/patch mismatch results in a warning. If the version of the dependency is omitted, any version will do. A missing dependency means this mod can't be enabled.

Total Conversion

These are optional elements that should only normally be used in a total conversion mod

totalConversion

If set to "true" then no other mods will be loaded alongside it, excepting utility mods. The game will also skip loading ship variants that refer to hull ids that no longer exist (i.e. if the total conversion replaces ship_data.csv with a new ship set). Defaults to "false", from "true" or "false"

replace

Core files that should not be merged & loaded, in a relative path from the starsector-core base folder. 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. JSON array

Reference

Mod descriptor (mod_info.json) post from Alex Nov 2012 [1]


Return to: Modding