Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Construct multiple z-levels [DFHack lua script] 1.01 beta  (Read 2040 times)

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Construct multiple z-levels [DFHack lua script] 1.01 beta
« on: September 23, 2017, 04:34:53 pm »

In last month, there was a 5x5 tower challenge idea. I mostly liked it, but got annoyed at how one-by-one building stairs and such is and never succeeded.


Save the code into /hack/scripts/constructmultiz.lua text file. If you want the indicator on lower right, also get gui/indiator-screen. Then, add constructmultiz bind into onMapLoad_extra.init file to add keybinds to call it automatically.

What can you do with this?

You can take these materials, order 7 sets of furnishings, and then adjust how many you will build above

||

By either clicking to increment/decrement or by using Ctrl-A to set wholesale:

||

Then you can build 7 z-levels of tower in one go:

||

Remember to designate corners last so they'll get built first, and to leave a space for door:

||

And the tower is designated 7z in one go:

||

If you have things ordered and done in right order, it can also get built in one go:

||

Then you can simply do the same on first z-level with ordering the placement of furniture, add a door...

||

and remove the first hatch.

This, too, gets extended:

||

Overall result, lot quicker than doing it by default:

||



There are few caveats, imperfections, and probably undiscovered problems I didn't find though testing. As such, for now I consider this in BETA: Cover your ass with backups and pre-saves, just in case.

Some caveats/quirks:

1) While individual items can be made semi-easily made possible to pick in latest version, for ease of coding in 43.03 it currently uses same item type and material for building, in a way like workshops job work rather than construction ones do.
2) The exception to above would be cases of bucket, barrel, chain, mechanism, screw, pipe, anvil (but not weapon), where material is not checked (it could be, but it isn't).
3) As such, dwarves will pick the items closest to them at the moment they take the job.
4) As such, dwarves will pick items to build one-by-one and it's possible to have all 5 designated 10x upright spears to fail when you have only 20 spears in stock.

5) For pumps, the direction is rotated 180 on every z-level for ease of designating pump stacks.

||

Still have to have power connections, granted, so it's pretty eh.

6) Helptext isn't quite so verbose as this post:
Spoiler: constructmultiz help/? (click to show/hide)

7) It accomplishes on the fly calling with keybinds, and popup boxes with gui.dialogs

8) As you might surmise from the above, by default the keybinds don't work with falconne's automaterial's auto-mat select. In fact, in material choosing and construction menus, the indicator-screen hides itself in 2 seconds to allow those options to show.

I'd like if it could work together with that, but I'm not even sure where I can find if the auto-mat select is going to skip the material choices screen.

9) You might try to call constructmultiz 1 0 on a stockpile, civzone, etc. abstract. But this does not work at present and throws an error.

Calling "on" in this context means calling on the last building or construction section done, such as by default.

10) There's little safety checking before building.
If you designate something into a wall, nothing happens.
If you designate a building unapproachably into air, nobody will come and build it.
If you designate a stair on constructed floor, you build a stair on constructed floor.
If you designate a 1x7 farm plot with workshop in the middle, you get disconnected farm plot.

11) Have only tested in DFHack 43.03-r1, 43.05-r2 and 42.06-r1, and not fully

Potential ideas for the future:

A) For the last two of above versions, could use individual items.

B) Utilizing "Planning Mode" plugin to place/curate for quality.

C) Allow control over how specific the matching of things is.

============

Changelog
Spoiler: 1.01 28.07.2018 (click to show/hide)
« Last Edit: July 28, 2018, 05:36:28 am by Fleeting Frames »
Logged

Bearskie

  • Bay Watcher
  • Nyam nyam
    • View Profile
Re: Construct multiple z-levels [DFHack lua script] 1.0 beta
« Reply #1 on: September 23, 2017, 11:46:37 pm »

This will definitely be useful.

Golbolco

  • Bay Watcher
    • View Profile
Re: Construct multiple z-levels [DFHack lua script] 1.0 beta
« Reply #2 on: September 24, 2017, 12:05:52 am »

You are a hero.
Logged