Dwarf Fortress

Dwarf Fortress

Not enough ratings
Burrow To Stockpile
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
561.845 KB
28 Jun @ 11:10am
1 Change Note ( view )

Subscribe to download
Burrow To Stockpile

Description
-- ATTENTION ---
This mod needs DFHack to be installed. You can simply get it here (https://steamhost.cn/app/2346660/DFHack__Dwarf_Fortress_Modding_Engine/)

--- ATTENTION 2 ---
This is the experimental mod in work-in-progress state! Use it at your own risk and backup your save files before proceeding.

Overview
This mod will allow you to do one simple but powerful thing: select any burrow to be a source of resources for any stockpile.
No more 'Item inaccessible messages' or forbidding every item outside your fortress!

Because it is a WIP mod, here's what currently works:
  • The overlay for stockpiles that will open the Burrow Selector Screen.
  • Burrow Selector screen with all your burrows. You can assign one, two, or all your burrows if you like.
  • Storing logs.
  • Storing stones and using wheelbarrows for it.
  • Storing corpses.
  • Storing refuse.
  • Storing furniture/siege ammo.
  • Saving the status of currently selected stockpiles and burrows.
  • Assigned to the burrow units will bring your items. Only units assigned to the burrow will do so.
  • A test UI to manage some inner settings of the mod, to help optimize it for your gear. Be careful with it, cause there's no any validations yet!

Before release checklist
Before going safely and calmly to version 1.0.0, I want to implement the following things:
  • Storing weapon/trap components.
  • Storing sheets.
  • Storing leather.
  • Storing gems.
  • Storing food.
  • Storing finished goods.
  • Storing armor.
  • Storing clothes.
  • Implement the possibility to bring resources from other stockpiles if the resource shouldn't be/not connected there. For example, if you created a food stockpile over some stones.
  • More optimization. Currently, even with my gear, it can sometimes be laggy.
  • Dropping the items cache when the settings of the stockpile are changed.
  • Allow units from overlapping burrows to get the jobs (maybe?)

Known issues
Of course, how could it be without them in beta :D
  • FPS drops when you have a lot of items to store. Not critically, but definitely noticeable. It happens mostly when you select a lot of stockpile in the same location.
  • When clicking on civilian alert, dwarves could not stop in the middle of the bringing job. Sometimes they are, sometimes not. Couldn't tell exactly why.
  • Resources from other stockpiles will be ignored. As described above, if you created a stockpile on some fresh stones, these stones won't be stored by this mod. Yet :)
  • If you put some strange stuff in settings, the result would be unpredictable
  • When you change the settings of the stockpile, the mod will understand it only when the cache expires.

Some nerdy technical details
This part I'll probably remove after release, but if you're interested, here we go. Plus, it will help you to understand better what settings could be adjusted for you.

There are three main recursive handlers in the mod:
  • Main handler, which processes items in the burrow.
  • Job Watcher, which handles the status of the job-item relations.
  • Cache cleaner, that cleaning cache :)

When you select the burrow as a source, the following things happen:
  • Scanning all items in the burrow.
  • Creating a job, if this item could be stored, and there's enough space.
  • Putting this item in the items_to_store list.
  • I don't want to burn your PC, so in 50 frames (Chunks cooldown in settings), we handle only 50 items (Items threshold).
  • When the items are over, the next chunk is scheduled. Repeat until items are over.
  • Meanwhile, mod caches all items to not have to check them every time.

In the parallel thread (if you could say it so), Job Watched is keeping an eye on items and making sure they will be brought to the stockpile.
This job handles only 10 items (Item in Job Watched threshold) every 25 game ticks (Job Watcher cooldown).

Separating this thread consumes less of your FPS but still does the job.
The main handler, which will handle a new item, will be running once in 400 ticks (it's the Main handler cooldown).
And, at the end, all processed items that are stored in cache will be recalculated after 8400 ticks, a game week (it's Processed items cache TTL in Settings).

From high above, that's it :) If you ask 'why so difficult' I would say: because it's FUN, and because it turns on it's not an easy task after all.


I hope you will enjoy the mod even in this state! Let me know if you want some features earlier than others.

Q&A

Q: Can I enable this in the existing save?
A: Sure thing, it will be automatically activated when you install/subscribe.

Q: Why publishing mod that still WIP?
A: Because it's already helped me in my game, so maybe it will help you. And I just reeeeeally want to share it :)
2 Comments
27 Jul @ 8:29am 
I'm curious to ask what you use to generate the thumbnails for these mods, boldly assuming they're generated?
Dragoon209 8 Jul @ 5:52pm 
This seems like a really cool and powerful idea, thanks for sharing!