Skip to content

Add "animaltrap-reuse" tweak #5467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2025
Merged

Add "animaltrap-reuse" tweak #5467

merged 1 commit into from
Jul 4, 2025

Conversation

quietust
Copy link
Member

@quietust quietust commented Jun 1, 2025

Makes it so animal traps generate "Release Small Creature" jobs instead of "Destroy Building" jobs, so a dwarf will transfer the caught vermin into an empty stockpiled trap and leave the built trap ready to be automatically filled with new bait (similar to how standard Cage Traps work).

The only downside is that if you don't have any empty animal traps in your stockpiles, you will get an endless stream of "Release Small Creature" job cancellations, but the exact same thing happens if you unassign a vermin from a built cage so it's probably fine (and you can still schedule the animal trap for deconstruction).

In order to make the "Release Small Creature" job work correctly, the caught vermin needs to be simultaneously added to both the building inventory and the animal trap itself, but fortunately the game appears to handle this scenario gracefully - whether the "Release Small Creature" job finishes or the building gets deconstructed, all of the references get correctly cleaned up, and saving/loading does not appear to break any of the links either.

@quietust
Copy link
Member Author

quietust commented Jun 5, 2025

Built animal traps have a "reload timer" which they use for adding bait; in theory, we could reuse this to also space out "release creature" jobs to reduce cancellation spam when no traps are available (but we would probably need to restore it to a sane value afterwards so the trap still gets re-baited in a timely manner).

Makes it so animal traps generate "Release Small Creature" jobs
instead of "Destroy Building" jobs, so a dwarf will transfer the
caught vermin into an empty stockpiled trap and leave the built
trap ready to be automatically filled with new bait.
@ab9rf ab9rf merged commit 06b3677 into DFHack:develop Jul 4, 2025
14 checks passed
@quietust quietust deleted the animaltrap branch July 6, 2025 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants