How to add submenu's / tabs?

I just started getting into modding, I think the basics of json and adding simple content is fairly easy. However, I can’t for the life of me find the files responsible for UI menu’s.
It’s weird because with a simple ‘mixinto’ item the engine does all the work, it adds the UI elements and all that. How does that work for the subfolders that hold these items. What if you want to add a whole new ‘folder’?

Not too sure what you mean, but if you are looking for code I suppose most of it is found under stonehearth/ui (that is, inside the stonehearth.smod).

That’s not weird - that’s convenient :stuck_out_tongue:

A lot of “background magic” goes on, yes; but it’s all for the better good for us modders I’d say.
This way, the code that does the actual work is already completed and “all we have to do” is to add to, subsctract from, or modify what is ‘seen within the game’.

I may be misunderstanding you now, but in order to add all items from within a folder, simply point to each of the items within this folder.

You are most likely not looking to perform “for game Stonehearth, add 'all this'” as one giant block; instead, you most likely want to do something like:

add a file
for this file, add this
for that file, substract this

That is, you want to add your changes, piece by piece, to their respective location.

I actually went through the entire ‘build-mode’ folder, within UI, I assume I was close.
What I mean is this:

Weird refers to the way you add menu’s or subfolders, in comparison to the -indeed- convenient way of adding items.

What if you don’t want just one or a couple of items, but a set, and therefore a seperate ‘tab’ to list them.

It depends, some things are auto create by the game based on your other files. Some require you to mess with the ui files.
The first screen you show, to add there you will probably need to change the ui file (though I’m not sure, didn’t looked at it)

The second is through json at the data/build/building_brush.json. I actually modded that already for the goblins
screenshot 2017_11_16__09_42_37

The third is auto added by the game based on your items in the town. You just need to set the item correctly and it will appear there. If it is in a new category, you will also need to add the translation string for that, which you can look at the base game language file for the correct format.


Do you have a link to a thread on that one? I’ve actually added new blocks through building_brush, easy as a mixinto. But I couldn’t figure out how to create a seperate tab like your fiber and goblin?

The swamp biome has it right now, if you want to look at its files to see how it was done.

For the new tabs to appear, you need to add the resources to the “voxel” part of the json. And the its colors in the other sections.

Ah it was in the same file! See that makes it so confusing, why would a menu like this be labeled ‘voxel’. It also raises some new questions, like where are icons and descriptions located then. I’ve spent the entire day going through files again, including your swamp mod, couldn’t find the correct files.

It frustrates me, concidering that I write code for websites, games, etc and that I generally learn stuff like this fast. Though so far I’m not really enjoying modding in Stonehearth, against my expectations. The hierarchy doesn’t make sense to me, like how a name, description and other values are all in seperate files.

Is there any way to locate where certain stuff exists within the scripts, similar to the object browser or the chrome UI inspector. Maybe it’s an idea to document a guide somewhere? Would save days.

1 Like


I remember the last time I created a game myself, around 2012, this concept was already getting strong. In my case, I was using just to separate text from the code, like names and descriptions here in stonehearth. It is very useful in the end, and opens up things like translations.