Mods

The local mod directory is in Documents\My Games\Ingnomia\mods
The location for steam mods is <Steam>\steamapps\workshop\content\709240

The mods main directory needs two files:

A "preview.png" image for the mod-menu and the steam-workshop and a "meta.json" containing

```
{

"Title": "Mod-Name",

"Description": "Mod description text",

"Changenote": "text",

"DatabaseFile": "<Path>/database.json"

}

```

The mod can be uploaded and updated to steam via the button in the 'Mods' menu.

The Description and Changenote appear in the Steam mod description and changes tab when uploading/updating the mod.

The <Path> to the "database.json" is relative to the mod folders root.
It lists the location of all other json- and tilesheet-files.

```
[
{
    "TableName": "<TableName>",
    "JSON":
    [{
        "File": "<Path>/filename1.json"
    },
    ...
    {
        "File": "<Path>/filenameN.json"
    }]
},
...
{
    "TableName": "BaseSprites",
    "JSON":
       [{
                "File": "<Path>/Basesprites1.json",
                "Tilesheet": "<Path>/tilesheet1.png"
        },
        ...
        {
                "File": "<Path>/BasespritesN.json",
                "Tilesheet": "<Path>/tilesheetN.png"
        }]
}
]

```

Except for basesprites the <TableName> defines what type of objects are defined in the listed json.

There are the following types of Tables:
Attributes, Skills, SkillGroups, Needs, Animals, Plants, TreeLayouts,
Actions, Constructions, Crafts, Jobs, Workshops, Items, ItemGrouping,
Materials, TerrainMaterials, Containers, Gamestart, Tech, Seasons, Time,
 Translation, Sprites.

For basesprites the json and tilesheet are linked,
so the entries in each json define only sprites within the linked tilesheet.

A basesprite json is simply a list of identifiers and source rectangles.
(0,0) is in the upper left corner.

```
[
{
    "ID": "IDName1",
    "SourceRectangle": "X Y Width Height"
},
...
{
    "ID": "IDNameN",
    "SourceRectangle": "X Y Width Height"
}
]

```

The basesprites are used in the "Sprites" table.

A sprite definition entry in a sprites.json has the following funtions:

```
{
    "ID": "BasespriteID"
}

```

This simply converts a base sprite with the same name into a regular sprite.

There are some unary operations that modify a given sprite:

```
{
    "ID": "SpriteID",
    "Sprite": "InputSpriteID",
    "Effect": "FlipHorizontal"
}

{
    "ID": "SpriteID",
    "Sprite": "InputSpriteID",
    "Offset": "X Y"
}

{
    "ID": "SpriteID",
    "Sprite": "InputSpriteID",
    "Tint": "R G B T"
}

{
    "ID": "SpriteID",
    "Sprite": "InputSpriteID",
    "Tint": "Material"
}

```

The first two are self explanatory. But note that offsets are global
for the whole sprite. Additional offsets overwrite previously parsed
ones.

The last two take the sprite 'InputSpriteID' and tint it with the
defined Red, Green, Blue, and Transparency, where R,G,B,T are between 0
and 255 or with the color defined by the material of the object.

Instead of '"Sprite": "InputSpriteID"' you can alternatively also use
 '"BaseSprite": "BaseSpriteID"' to use a basesprite directly.

You can further define different sprites for Rotations and Seasons:

```
{
    "ID": "SpriteID",
    "Rotations": [
        {
            "Rotation": "FL",
            "Sprite": "SpriteIDFL"
        },
        {
            "Rotation": "FR",
            "Sprite": "SpriteIDFR"
        },
        {
            "Rotation": "BR",
            "Sprite": "SpriteIDBR"
        },
        {
            "Rotation": "BL",
            "Sprite": "SpriteIDBL"
        },
    ]
}

{
    "ID": "SpriteID",
    "Seasons": [
        {
            "Sprite": "SpriteID_Spring",
            "Season": "Spring"
        },
        {
            "Sprite": "SpriteID_Summer",
            "Season": "Summer"
        },
        {
            "Sprite": "SpriteID_Autumn",
            "Season": "Autumn"
        },
        {
            "Sprite": "SpriteID_Winter",
            "Season": "Winter"
        }
    ]
}

```

You can also combine several sprites that are drawn on top of each other.

```
{
    "ID": "SpriteID",
    "Combine": [
        {
            "Sprite": "SpriteID1"
        },
    ...
        {
            "Sprite": "SpriteIDN"
        }
    ]
}

```

Sprites can be randomised via

```
{
    "ID": "SpriteID",
    "Random": [
        {
            "Sprite": "SpriteID1",
            "Weight" : W1

        },
    ...
        {
            "Sprite": "SpriteID2",
            "Weight" : W2
        }
    ]
}

```

The weights are sumed up and the odds of a sprite being chosen are W out of SUM.
If no weights are given the weights default to 1.

Lastly, sprite definitions can be nested and unary operations can be added directly. For example,

```
{
    "ID": "SpriteID",
    "Combine": [
        {
             "Random": [
             {
                  "Sprite": "SpriteID1",
                  "Weight" : W1
             },
             ...
             {
                  "Sprite": "SpriteID2",
                  "Weight" : W2
             }
             ]
        },
        ...
        {
            "Sprite": "SpriteIDN",
            "Effect": "FlipHorizontal",
            "Tint": "255 0 0 255"
        }
    ]
}

```