DFHack / dfhack

Memory hacking library for Dwarf Fortress and a set of tools that use it
Other
1.87k stars 472 forks source link

Discriminate based on item size in Workflow #1136

Open TV4Fun opened 7 years ago

TV4Fun commented 7 years ago

I'm using Workflow to manage my inventory levels of most of the things I produce. For the human soldiers in my army, I would like to produce some human-sized armor, and I would like Workflow to keep track of how much of it I have. The problem is, if I use Workflow to do this, it will only track the total number of shirts/breastplates etc. and not the number of large or human-sized items. It would be nice if I could set limits based on particular item sizes.

ab9rf commented 7 years ago

I don't think we currently know how to tell what size a particular instance of armor or clothing is at this time. It's likely one of the undocumented virtual methods in item, but which one is anyone's guess.

ab9rf commented 5 years ago

I recently figured out how sizes work, in writing the "tailor" plugin that is still in development. The "size" of an sizeable item is determined by the adultsize property of the raw for the race of the items maker race, as returned by getMakerRace(). Thus, if item is the item in question, world->raws.creatures.all[item->getMakerRace()]->adultsize will return the size, in cubic centimeters divided by ten. No, I'm not kidding: sizes in DF are expressed in cubic centimeters. See the DF wiki for more information. A "standard" adult dwarf is size 60,000. For some reason, however, the size stored in the raws is one tenth the size specified in the raws, so a standard dwarf will have an in-game size of 6000.

TV4Fun commented 3 years ago

Did we figure this out for Workflow? I'm not sure if the Manager interface supports this, so it would be nice to have.

ab9rf commented 3 years ago

As far as I know, nobody has added size filtering to workflow. In theory, we should know how (see my above comment), but I don't think anyone has attempted to actually do it.