Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3

Author Topic: Automated wood cutting plugin  (Read 17600 times)

falconne

  • Bay Watcher
    • View Profile
Automated wood cutting plugin
« on: August 17, 2013, 03:21:42 am »

Download
Link contains download archive with all my plugins.
Only works on the latest DFHack r3 (see the dfhack thread). Follow the instructions in the included readme for installation. The relevant file for just this plugin is getplants.plug.*

I've added some functionality to the existing getplants plugin to automate wood cutting in a similar way to how workflow automates production. You can set minimum and maximum thresholds for how many logs you want in stock and (when enabled) the plugin will run a cycle (once every dwarf day) that designates or undesignates trees to keep your stores within these boundaries. You can specify burrows to restrict chopping to, or let the plugin designate all revealed trees on the map. The latter is not as drastic as it sounds because the dwarves will pick the closest trees to chop first; the once a day designation cycle will designate new trees that grow close by so they aren't going to wander needlessly.

You can bring up the control screen from an option that appears when you go into the standard chopping designation menu or you can add a keybinding for "getplants autochop".



The left hand side lists your burrows. By default none are selected, so the plugin will chop from the whole map (revealed tiles only). You can toggle on any number of burrows and the plugin will only designate inside those burrows. Your dwarves don't need to be assigned to any burrows, they are just a way of marking areas for the plugin to designate in. The plugin must be enabled with (a) before it runs its daily cycle. The options (d) and (u) allows you to manually designate or undesignate all trees right away (if burrows are selected these actions will only apply within them). This might be useful when a siege starts, etc.

The lowercase and uppercase hotkeys for the Min and Max thresholds adjust them in units of 1 or 10 respectively.

The two final figures are how many logs you currently have in stock and how many trees are marked for chopping. When the maximum threshold is reached, all trees are unmarked; when the stock level drops below the minimum, all trees are marked.

Note that like workflow, the plugin doesn't count logs assigned to jobs as being currently in stock. This includes logs assigned to be hauled to stockpiles. This means that if you have a lot of woodcutters and haulers you're likely to overshoot the maximum threshold as the plugin's records will lag behind the true log count. So set your maximum lower than you really want it. I'll try to improve this accuracy in a future version.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

Ravendarksky

  • Bay Watcher
    • View Profile
    • DFMon.exe - Get rid of DF SPAM
Re: Automated wood cutting plugin
« Reply #1 on: August 17, 2013, 03:57:27 am »

This is brilliant and won't feel like cheating... Thanks!

Makes my dwarfs feel more realistic... rather than mass felling 100s tress into a giant stockpile so I don't have to think about them for a while this is now something my dwarfs can worry about.

The less influence direct influence over my dwarfs on a day to day basis the closer they become to sentient =D

I'll give it a good play around with later and give you some more useful feedback.

Great work =D

Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Automated wood cutting plugin
« Reply #2 on: August 17, 2013, 04:43:13 am »

Nice, I'll include it in my next download :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: Automated wood cutting plugin
« Reply #3 on: August 17, 2013, 08:36:37 am »

PTW, this will also be in my LNP soon. I've been waiting for a plugin that can do this for ages, fantastic that it finally exists.
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

fricy

  • Bay Watcher
  • [DFHACK:ZEALOT]
    • View Profile
Re: Automated wood cutting plugin
« Reply #4 on: August 17, 2013, 03:44:01 pm »

thx Falconne, really cool!

found a minor bug: trying to select a burrow without defining any burrow first crashes the game

falconne

  • Bay Watcher
    • View Profile
Re: Automated wood cutting plugin
« Reply #5 on: August 17, 2013, 06:14:47 pm »

found a minor bug: trying to select a burrow without defining any burrow first crashes the game

Thanks, just uploaded a new version that fixes that. It was a fix to the list control which also affects the buildingplan plugin, so I made a new build of that too.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: Automated wood cutting plugin
« Reply #6 on: August 21, 2013, 07:50:14 pm »

I'm having issues adding a keybinding for this, any idea why?  DFhack won't recognise "getplants autochop" as a valid command, though it prints that without quotes.  It's bizzare, and annoying. 

Oh, and I was going to use Shift-A as the binding.  Any clashes or other suggestions people can think of?
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

falconne

  • Bay Watcher
    • View Profile
Re: Automated wood cutting plugin
« Reply #7 on: August 21, 2013, 08:09:52 pm »

That's a bit weird, I had it as a keybinding in my test environment.

What does the exact line you added to dfhack.init look like (complete with quotes)?
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: Automated wood cutting plugin
« Reply #8 on: August 21, 2013, 08:56:48 pm »

Several variations, but I thought
Code: [Select]
keybinding add Shift-A "getplants autochop"would work. 

Trying that without quotes bound 'getplants' just fine, so I got the list of IDs spat out a couple of times. 
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

falconne

  • Bay Watcher
    • View Profile
Re: Automated wood cutting plugin
« Reply #9 on: August 22, 2013, 03:29:39 am »

Weird. I use:

Code: [Select]
keybinding add Ctrl-T@dwarfmode/Default "getplants autochop"
See if that works. If not, PM me your full dfhack.init file. What's the exact output you get from dfhack?
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: Automated wood cutting plugin
« Reply #10 on: August 22, 2013, 11:22:00 pm »

That works just fine - I'm inclined to think I must have been doing something stupid, but all's well that ends well. 
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

Dragoon209

  • Bay Watcher
    • View Profile
Re: Automated wood cutting plugin
« Reply #11 on: September 05, 2013, 01:16:28 pm »

That works just fine - I'm inclined to think I must have been doing something stupid, but all's well that ends well.

Just so you know, Windows has issues allowing dfhack to use any keybinding that uses left shift, left Control, and left Alt, with many of the keys in the lower left of the keyboard.  Its not really documented anywhere.  When I asked about some trouble keybindings I had in the DFHack forum post, that was the answer I got. 

I don't know the exact keys, but A, z, x, c, and q have all given me trouble before.  I'm wondering if there is some sort of global interrupt grabbing the keys before dfhack can.

Anyway, good luck!
Logged
Check out my mini-mods:
Upgradable Leather Tiers
Block Crafting Workshop

Have you played Webfort yet?  It's a way to play Dwarf Fortress in a web browser with your friends!  Come check it out at:
Community Web Fortress

Covenant Ringthane

  • Bay Watcher
    • View Profile
Re: Automated wood cutting plugin
« Reply #12 on: October 17, 2013, 09:06:15 am »

Thanks for this!
Logged

Morphyum

  • Bay Watcher
    • View Profile
Re: Automated wood cutting plugin
« Reply #13 on: October 18, 2013, 02:02:27 pm »

Hey guys, since i'm writing a program right now, that will read out the legends xml and create a family tree of all the dwarfs, i've encountered a problem with some legendsxml, that are not correctly encoded in UTF-8. While i was digging around to find the error i found this entry:

<historical_figure>
      <id>-100</id>
      <name>autochop/config abbeybrew</name>
      <appeared>0</appeared>
      <birth_year>0</birth_year>
      <birth_seconds72>0</birth_seconds72>
      <death_year>0</death_year>
      <death_seconds72>0</death_seconds72>
      <breed_id>0</breed_id>
   </historical_figure>

Is that an entry created by you guys?
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: Automated wood cutting plugin
« Reply #14 on: October 18, 2013, 02:05:06 pm »

Hey guys, since i'm writing a program right now, that will read out the legends xml and create a family tree of all the dwarfs, i've encountered a problem with some legendsxml, that are not correctly encoded in UTF-8. While i was digging around to find the error i found this entry:

<...>
Is that an entry created by you guys?
Dfhack uses historical figures for persistent storage. see:https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#persistent-configuration-storage
Pages: [1] 2 3