If anyone has any questions about how to use mixintos or overrides, I’d be happy to collect (and maybe answer!) them in this thread. We’re so deep into the code that it’s a little hard for us to get perspective on what Tom’s post from a few weeks ago doesn’t explicitly cover.
If you’ve got success stories, please post them here too!
Frequently Asked Questions:
Q: What exactly, is a mixinto?
A: 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?
A: 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?
A: 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?
A: See this post
Q: Will you replace the term “mixinto” with “extension”?
A: Maybe. If we do, it will just by a syntax change
Q: What does file(…) do?
A: 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: How do I get a smaller world for testing?
A: Try adding this to your user_settings.json:
"mods" : {
"stonehearth" : {
"world_generation" : {"method" : "tiny"}
}
},
Q: Can I get trees to drop wool?
A: 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
}
Q: Can you use mixintos for html code?
A: No