Open wookietreiber opened 1 year ago
This seems to me like it should be added functionality for autolabor
and not a separate plugin/script. autolabor
already has a heuristic for choosing which dwarves to assign to which labors, and this could just be part of the heuristic. Otherwise you run the risk of different tools competing to set labors for dwarves, and that can get frustrating for players.
@ab9rf is in the middle of refactoring/unifying autolabor
/labormanager
/autohauler
, so I defer to her for advice on how this can be approached. In the meantime, you might want to read the existing autolabor (and friends) code in https://github.com/DFHack/dfhack/tree/develop/plugins/autolabor
you can also check out https://github.com/DFHack/scripts/blob/master/fillneeds.lua for some very simple code that iterates through a unit's needs
i am not planning on any updates to autolabor and its cousins with respect to pre-0.50 versions, at least not until after dfhack for 0.50 is working. 0.50 has a significantly revamped labor management system and while i believe both autolabor and labormanager will have a place in 0.50, they will need to be significantly adapted.
it has been my intention to add a feature such as you describe to labormanager for some time now, but i've deferred work to do so for over a year due to the announcement from Toady that he was reworking how labors work in the pending release. it seemed folly to put a ton of effort into improving a tool that would not longer be relevant. it currently appears, based on what we know of the 0.50 release, that tools like autolabor and labormanager still have a purpose (while the new labor system is different, it does not wholly solve the problems that autolabor and labormanager seek to solve) and thus it is likely that i will resume work on refactoring these tools after the initial effort to get dfhack working with 0.50 is complete.
i will caution you that while i cannot stop you from forking either autolabor or labormanager to add this functionality, it is unlikely that the dfhack team will agree to allow yet another fork of autolabor to be added to the official set of supported plugins. the code duplication and maintenance headache of having three forks of the same codebase present has been bothersome for some time, and it's definitely our intent to coalesce all three of these tools into a single unified tool. adding another fork would be a step backward in this regard and thus almost certainly will not happen.
tl;dr: this is a good idea but it'll have to wait for now
Example Use Case
I want to disable/enable crafting labors based on the Craft Object need, i.e. enable crafting for unfocused after being unable to practice a craft, including the worse variants, and disable crafting for all who are not distracted, including the better variants. I don't care about the quality, just to meet the needs so they stay focussed.
The way I've been doing this (manually) with Dwarf Therapist is:
Automation
As you can imagine, doing this needs-based autolabor ensures a higher level of met needs and a higher level of focus. But, doing this manually, still sucks a bit because I frequently have to switch over to the therapist, refresh and click the cells.
I would like to have/write a tool that automates this workflow, i.e.:
n
ticks[a,b,c,...]
, else disable labors[a,b,c,...]
For
dfhack.init
, the syntax could be something like:Contrib / PR
I'd like to contribute, but I have some questions on how to get started because I'm new to the dfhack code: