Creating Mods

To create a mod, you will need:

  • Some Javascript Knowledge (ES 5)
  • A Mod Idea

Basic plugin structure:

(function(pluginName){

[code here]

})(window.pluginName);

There are basically two ways to make mods (and you can mix the two at will):

  1. Using the Content Manager
  2. Injecting Code

The Content Manager

With the Content Manager you can change the behavior of the game without injecting code in methods that may change with game updates.

Basic structure:

(function(pluginName){
  function MyContentClass() {
  }

  [code here]

  ContentManager.registerContentClass(MyContentClass);
})(window.pluginName);

Check out the list of available methods by clicking here.

The game itself also uses the Content Manager for a lot of things. Check out the js/content/ folder inside the game source (included with the game) to get some examples of how to use it.

Code Injection

When you need to change something not yet covered by the Content Manager, you can replace the core code with your own version.

Example:

var oldRelationshipManager_increaseFriendship = RelationshipManager.increaseFriendship;
RelationshipManager.increaseFriendship = function(villagerName, points) {
  if (points === undefined) points = 1;

  points *= GameTweakerContent.relationshipMultiplier;

  oldRelationshipManager_increaseFriendship.call(RelationshipManager, villagerName, points);
};

This code (from the GameTweaker mod) replaces the existing RelationshipManager.increaseFriendship method by a custom one. The custom method multiplies the points parameter and then calls the original method.

By doing it this way, the mod ensures that any other mod that also modifies the same method won’t stop working because of it.

Guidelines

  1. Do not modify the player’s save files in a way that it will no longer work if your mod is disabled.
  2. Do not change the player’s achievements or internal steam files / stats.
  3. Do not make anything that would harm the player’s computer.