Modding FAQ

This page is currently a port from the Modding FAQ post on the official Stonehearth Discourse. It was compiled by the community as a set of question and answers about the creation of mods for the game.

## Q. Are there any "primers" on modding Stonehearth?

The best place to currently get more information on Stonehearth modding is the developer blog and official discourse forum. For an introduction into mixintos, overrides and the entity/component framework these posts are especially helpful:

* Desktop Tuesday, a peek inside the modding API
* Behind the scenes with Bush #4

## Q. Where are my Stonehearth files located?

* Steam: C:\Program Files (x86)\Steam\SteamApps\common\Stonehearth
* Humble Bundle: C:\Program Files (x86)\Stonehearth

## Q. How do I extract the .smod files?

They're zip files. You can use any zipping program, such as 7z, WinRAR, etc.

## Q. Can I work with my extracted mod folder?

Yes. Note that Stonehearth will prefer smod files over folders though - if you have a folder named my\_mod and an smod named my\_mod.smod, it will always load my\_mod.smod and ignore your folder!

## Q. How can I create .smod files?

Simply zip them using any zip program and change their extension to ".smod".

## Q. What are luac files? How can I open them?

luac are minified lua files. The minification process removes unnecessary (to the computer) spaces, line breaks and comments. It will also shorten variable names down to individual letters (ex. n, t, e). This makes it harder for a person to understand, but can improve the performance of the lua processor.

## Q. Can I view debugging information?

Yes. Set set enable\_debug\_keys to true in your user\_settings.json file.

## Q. How can I reduce my loading time? / How can I create a smaller world?

Try adding this to your user\_settings.json:

```
"mods" : {
   "stonehearth" : {
       "world_generation" : "tiny"
    }
 },

```

## Q: What exactly, is a mixinto?

A mixinto lets you inject additional content into an existing .json file. (.json data files hold almost all of Stonehearth's mutable gameplay parameters) The easiest use for this is to replace values defined in existing json.

The more complicated (less documented, stable, and supported) use case is to add wholly new content to existing .json files. (This is dangerous because the format of those json files is not yet finalized, so the section you've modified may change or go missing.)

## Q: What, exactly, is an override?

An override lets you replace any file in the game with another file. Use to replace assets with other assets. If you use this to replace code files with other code files, Team Radiant is not responsible for the results, or the mantainability of the edits going forward.

## Q: Can you use mixintos to modify a .json array?

Yes. The modifications are added to the top of the array, though this may change in the future.

## Q: How do I know what files are possible json targets for mixintos, and how do I reference them? Should I use their alias, or filename, or what?

See this post.

## Q: Will you replace the term "mixinto" with "extension"?

Maybe. If we do, it will just by a syntax change

## Q: What does file(...) do?

file(...) is a shortcut that makes it "easier" to declare filepaths in json.

* First, it appends the mod directory to the path in the parenthesis. As @RepeatPan mentions, file(/foo) is equal to /my\_mod/foo
* file() can also be used to append the path to the current directory: file(mystuff.json) is equivalent to /my\_mod/path/path1/path2/mystuff.json
* Finally, if the path inside a file() statement ends with a folder, and not a file with an extension, it will automatically append a file of the similar name.json to the path. For example, file(/stuff) becomes /my\_mod/stuff/stuff.json

## Q: Can I get trees to drop wool?

Yes! The resource\_node determines what is dropped by a tree or plan when it is permanently harvested. Change the inside a tree.json (like, oak\_tree.json) change the resource from stonehearth:oak\_log to stonehearth:wool\_bundle:

```
"stonehearth:resource_node": {
     "resource": "stonehearth:wool_bundle",
     "durability": 20
 }

```