Modding:Mod Packaging: Difference between revisions

From Vintage Story Wiki
No edit summary
No edit summary
Line 6: Line 6:


<table id="treeviewtable" class="table table-bordered tt-table" style='table-layout: fixed'>
<table id="treeviewtable" class="table table-bordered tt-table" style='table-layout: fixed'>
   <tr style='background-color: rgba(0.5, 0.5, 0.5, 0.5);'>
   <tr style='background-color: rgba(128, 128, 128, 0.1);'>
     <th width='500px' align='left'>Zip File Structure</th>
     <th width='500px' align='left'>Zip File Structure</th>
   </tr>
   </tr>

Revision as of 09:12, 16 October 2018

Zip Files

To make your mod easy to install and use, it should be packed into a zip file. Any assets (images, .json files, etc) go in a "assets" directory in the root of the zip, any C# DLLs (and optionally, PDB files) go directly into the zip file root as well.

Please note that if you have a code mod that has no assets (AKA, your mod is a single C# DLL), it is possible to ship the bare DLL without packing it into a zip. This is not really a good idea though, as when distributed this way it is hard to include a PDB file and downloading DLLs directly in Windows can lead to issues with your mod failing to load due to security policies applied to files downloaded from the internet.

Zip File Structure
.zip
assets
domain
asset files (tree overview)
modinfo.json
modicon.png
code files (*.dll, *.pdb and *.cs)
src
code files - folders allowed (*.dll, *.pdb and *.css)

Info file

Every zip-file mod requires a modinfo.json inside the root directory of the archive. Otherwise the entire mod will be ignored. This info file specifies what kind of mod it is, its name, author, etc.

An example of a theme pack info file (modinfo.json):

{
  "type": "content",
  "name": "My Example Content Mod",
  "description" : "This is an example mod, which does nothing",
  "authors": ["CreativeMD"],
  "version": "1.0",
  "dependencies": { 
	"game": "",
	"survival": ""
  },
  "website": "http://example.com"
}

  "type": "content",

Besides "type": "content", there is also "type": "theme" and "type": "code".

  • "type": "content": Defines this mod as being a Content Mod. Content Mods cannot contain any C# code (if it does they will be ignored).
  • "type": "theme": Defines this mod as being a Theme Pack. Theme Packs cannot override gameplay affecting assets categories (such as blocktypes, itemtypes and so on) and no C# code will be loaded.
  • "type": "code": Defines this mod as being a Code Mod. Code Mods are the same as a Content Mods, except they can also load C# code to do things that are not possible with JSON.
  "dependencies": {
    "game": "1.5.3"
  },

Means it requires at least VintageStory v1.5.3 or a newer version.

Icon

The file modicon.png (if it exists) will be used and shown in the mod manager menu.

Example Mod.png


Distribution and Installation

To install a mod simply place the zip file in the Mods directory in your Vintagestory directory.

Feel free to share your creation in our forums. We would love to see what you come up with!


Icon Sign.png

Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.