Basic structure of a mod - hovgaardgames/startupcompany GitHub Wiki
Basic structure of a mod
your_mod_folder
│_ mod.json
│_ start.js
This base structure is mandatory. Otherwise, your mod will not be detected or loaded properly.
Files
mod.json
A simple JSON file containing basic information about the mod.
{
"name": "Furniture Mod",
"author": "Jonas Hovgaard",
"description": "Adds additional furniture to Startup Company",
"imageUrl": "thumbnail.png"
}
imageUrl
(and the thumbnail) is not required but highly recommended. The image will be scaled down to max-width 70 pixels and it will be the first displayed in the Steam Workshop.
start.js
A Javascript file containing the main logic for your mod. It is basically a Javascript module initialized using require
.
The game will fire different events on your mod allowing you to manipulate with the game at the right time.
Here is an example of the start.js file for our furniture mod :
let _modPath;
exports.initialize = (modPath) =>{
_modPath = modPath;
Database.items.push(
{
id: 29,
name: "coffeetable",
imagePath: `${modPath}images/coffee-table1-{orientation}.png`,
price: 100,
bonus: 0.5,
width: 2,
height: 2,
tier: 1,
placementOffset: [
{top: -420, left: 100},
{top: -420, left: 100},
{top: -420, left: 100},
{top: -420, left: 100},
]
}
);
};
exports.onLoadGame = settings => {};
exports.onNewHour = settings => {};
exports.onNewDay = settings => {};
exports.onUnsubscribe = done => {};
In the above example you can see how we use modPath
to access custom images located in our mod folder. You can do this with any kind of media formats.
Also notice how we have prepared additional methods (onLoadGame
, onNewHour
, onNewDay
, onUnsubscribe
) allowing you to manipulate the savegame, settings objects and more. Learn more about these methods.