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.
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 . 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.