dfhack icon indicating copy to clipboard operation
dfhack copied to clipboard

Autodump command doesn't dump items in workshops or tasked

Open Bumber64 opened this issue 3 years ago • 3 comments

The "autodump" command won't dump items held inside workshops, but instead just forbids them. Need to determine that those items aren't part of the building, then manage to dump them to the cursor position.

The command also doesn't dump items flagged as tasked, but instead forbids the item without even cancelling the task. Need to determine how marking an item forbidden in-game properly cancels the task, then do that before dumping to cursor.

Bumber64 avatar Mar 22 '21 01:03 Bumber64

There are some hardcoded restrictions on which items can be dumped: https://github.com/DFHack/dfhack/blob/e7cf5e207922629b6f2968da0a4b4d8dfa30b397/plugins/autodump.cpp#L392-L399

However, this dates back at least to when DFHack was out-of-process (https://github.com/DFHack/dfhack/commit/a8543f5ef034774e026cf434c11055783a68c9d9), so it's at least 10 years old, and may have been due primarily to limitations at the time. It could also be designed to focus on a more "common" use-case of dumping items on the ground, but adding support for items in buildings shouldn't affect that.

lethosor avatar Mar 22 '21 02:03 lethosor

Based on how DF seems to behave, I would expect DF to not do anything but set the 'f'orbidden flag when you forbid an item. Once a task in process then tries to interact with the item it fails, but the task isn't actually cancelled until a (potentially) long time after the item was forbidden. Also, trying to interact with an item that's moved to a different location results in an "item lost or destroyed" message (the quote might not be fully correct) and the task getting cancelled when a dorf tries to interact with the item (apart from some buggy cases where the broken task is just sent back to the free jobs list rather than cancelled when the item no longer exists).

PatrikLundell avatar Mar 27 '21 10:03 PatrikLundell

I implemented disconnecting clutter from workshops so the items can be moved here: https://github.com/DFHack/scripts/blob/master/build-now.lua#L298

It can be reused/refactored for autodump.

myk002 avatar Sep 22 '21 19:09 myk002