Potential for more activity control categories?

By activity control categories, I mean Haul, Build, Mine & Job. Anyone familiar with the lua know if it may be possible to add more categories with a mod? Particularly, I’d like to see Place and Transplant categories, for placing/moving/undeploying furniture (etc) and moving wild plants, respectively. Or at least one category covering all of the above to separate them from Haul.

1 Like

It’s possible, but I think the biggest obstacle you will run into will be the multiple existing lua files you would have to override to achieve it. You can’t mixinto lua (at least I doubt that has changed in the last couple of weeks, haven’t been that active), so you are looking at possible game breaking issues and the possibility of having to go as far as to rewrite the mod every time a new alpha release comes out. There’s a post reply from @RepeatPan somewhere that discusses why lua overrides aren’t a good idea and it’s basically an unintended ‘feature’ that you are able to do so in the first place. I can try to find the link for you when I’m not on mobile. I have a mod that has a javascript override I’m just waiting for it to break.

If you wanted to try to give it a go, off the top of my head you are looking at a minimum of ai tweaks (lua overrides) and ui (javascript, and probably some jquery, ember, handlebars, and html/css.

That would be this post.


Pretty outdated on some parts, as is expected of a 18 month old post, but the general gist still applies. Jelly is dead, as it’s outlived its usefulness and most of the hacks it did are now (semi-)official/usable APIs.

The basic point still stands, however: It’s officially unsupported/frowned upon, it’s going to break at random times (basically, whenever something changes). If you truly do need to change something, and there’s no way to avoid it, try monkey patching the function (replacing it with one you’ve written). Ideally, you can call the old function and just do your stuff before/after; but that’s not always possible. Keep whatever change you make to an extern system as minimal as possible - the less code you touch, the less code can break.

On the topic, however, I’m not sure if you actually need touch lua for this case at all. I believe, and I might am mistaken, that this is defined by task groups, which are all JSON. A task group has a list of actions it covers. So you would need to override parts of the task group for the player, add a few new ones, make some adjustments to the GUI (probably)… I don’t think changes to lua are necessary, but it’s possible that whatever schedules the task uses a hardcoded string that might not work for you.

It seems like overriding lua (or js, etc) could be straightforward if they wanted it to be. You copy the original file, make your modifications and the override mechanism basically replaces the original with your file in memory during the load process, treating it as though it were the overridden file. Or better yet, allow mods for these files to be diff-style patches :smiley:. Either way it seems like the potential for breakage with each release would be the same. But anyway I’m perfectly happy extracting the entire stonehearth.smod and using git to keep track of my modifications.


Because the basic categories seem to be broken right now I decided to try adding a bulk transplant feature instead. The odds of that happening are looking rather slim right now. I think I have a good grasp on the lua side of the process, but it looks like the task will require more on the js side than I originally thought (and I have practically no experience with js). But on the off chance that I managed to create something worthwhile, the hope is that it would get merged. If not, hopefully things won’t change so much that I couldn’t keep up, even if only for myself and people who can use patch.