Bay 12 Games Forum

Please login or register.

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

Author Topic: Construction Helper [Update: "designation-like" support for constructions]  (Read 9394 times)

falconne

  • Bay Watcher
    • View Profile

Download: http://dffd.wimbli.com/file.php?id=7248

For installation instructions see the reademe included. You need the latest DFHack version to use this (the one that comes with the LazyNewbPack is out of date).

New: Also added functionality that allows constructions to be placed with “rectangular selection”, i.e. select the first corner then the last one, the way designations work, instead of using umhk keys. It allows unlimited sized selections and is able to automatically skip tiles that cannot be used for construction.
Spoiler (click to show/hide)
See full post further down: http://www.bay12forums.com/smf/index.php?topic=119369.msg3895056#msg3895056

I've written a plugin for DFHack that should hopefully make building constructions (walls, floors, fortifications, etc) a little bit easier by saving you from having to trawl through long lists of materials each time you place one.

Firstly, it moves the last used material for a given construction type to the top of the list, if there are any left. So if you build a wall with chalk blocks, the next time you place a wall the chalk blocks will be at the top of the list, regardless of distance (it only does this in "grouped" mode, as individual item lists could be huge). This should mean you can place most constructions without having to search for your preferred material type.

The plugin remembers the last used material of each construction type independently, as you may want different kinds for walls, floors, tracks, etc.

That will work without any user intervention, but I've added some extra functionality to automate the building some more.

When selecting materials you will see an extra option at the bottom as seen here:
Spoiler (click to show/hide)

Pressing 'a' while highlighting any material will enable that material for "auto select" for this construction type. You can enable multiple materials as autoselect. Now the next time you place this type of construction, the plugin will automatically choose materials for you from the kinds you enabled. If there is enough to satisfy the whole placement, you won't be prompted with the material screen - the construction will be placed and you will be back in the construction menu as if you did it manually. If there isn't enough, you will end up in the material selection screen as normal, but as many materials from your list as exists will have already been selected for you.

When choosing the construction type, you will see a couple of options:
Spoiler (click to show/hide)

As you can see, "autoselect materials" is enabled by default. Use 'a' here to toggle this off if you need to temporarily disable the material autoselection, or if you need to go to the material selection screen so you can toggle some materials on or off, e.g. when you have new materials that can be used.

The other option (auto type selection, off by default) can be toggled on with 't'. I added this because I found that when I build floors or walls, sometimes I will build several at once and it's annoying to always return to the main construction menu and have to reselect "Wall" or "Floor" again. If you toggle this option on, instead of returning you to the main construction menu after selecting materials, it returns you to where you were, so if you were building floors you'll be taken back to floor construction... and you can Esc twice to cancel. If you use this along with several autoselect enabled materials, you should be able to place complex constructions more conveniently.
« Last Edit: January 07, 2013, 02:39:15 pm by falconne »
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

Deon

  • Bay Watcher
  • Mods for the mod god!
    • View Profile
Re: Construction Helper Plugin: auto material selection
« Reply #1 on: November 19, 2012, 08:18:09 am »

This is really useful, thank you. I will use it ASAP :).
Logged
▬(ஜ۩۞۩ஜ)▬
MODS:
Wasteland Chronicles
DF Wanderer

ag

  • Bay Watcher
    • View Profile
Re: Construction Helper Plugin: auto material selection
« Reply #2 on: November 19, 2012, 09:36:40 am »

You absolutely need to also check the item type - boulders of same material are not equivalent to blocks.

*grumpy* Also put this on a separate branch; get rid of magic constants, unused command, and getCurViewscreen - you have the screen right in your hook as this, and in fact call that same feed method via INTERPOSE_NEXT. Also having static color_ostream_proxy objects is not the best idea. */grumpy*

I'd merge this quickly into the trunk, if not for the workflow stuff getting in the way.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: Construction Helper Plugin: auto material selection
« Reply #3 on: November 19, 2012, 10:37:41 am »

Looks useful. Thanks.

Zebra2

  • Bay Watcher
    • View Profile
Re: Construction Helper Plugin: auto material selection
« Reply #4 on: November 19, 2012, 03:59:08 pm »

You are a hero. Also, I agree with ag.
Logged

JudgeJay

  • Escaped Lunatic
    • View Profile
Re: Construction Helper Plugin: auto material selection
« Reply #5 on: November 20, 2012, 08:33:32 am »

I'm experiencing a problem, I downloaded & extracted AutoMaterial_v0.2-Windows-0.34.11.r2 into hack/plugins and can see automaterial.plug in the folder along with all the other .dll files.
However when I start DF I get a window pop up telling me that The procedure entry point ?apply@VMethodInterposeLinkBase@DFHack@@QAE_N_N@Z could not be located in the dynamic link library SDL.dll.
Then I click OK, DF runs with DFHack printing the message Can't load pluggin C:\Users...\hack\plugins\automaterial.plug.dll
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Construction Helper Plugin: auto material selection
« Reply #6 on: November 20, 2012, 08:50:18 am »

The procedure entry point ?apply@VMethodInterposeLinkBase@DFHack@@QAE_N_N@Z could not be located in the dynamic link library SDL.dll.
The reason the plugin is named "AutoMaterial_v0.2-Windows-0.34.11.r2" is because you must use it with DFHack v0.34.11-r2 - you are running 0.34.11-r1, so it will not work.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

JudgeJay

  • Escaped Lunatic
    • View Profile
Re: Construction Helper Plugin: auto material selection
« Reply #7 on: November 20, 2012, 09:15:52 am »

Thank you Quietust all sorted now
Logged

falconne

  • Bay Watcher
    • View Profile
Re: Construction Helper Plugin: auto material selection
« Reply #8 on: November 20, 2012, 02:07:26 pm »

You absolutely need to also check the item type - boulders of same material are not equivalent to blocks.

*grumpy* Also put this on a separate branch; get rid of magic constants, unused command, and getCurViewscreen - you have the screen right in your hook as this, and in fact call that same feed method via INTERPOSE_NEXT. Also having static color_ostream_proxy objects is not the best idea. */grumpy*

I'd merge this quickly into the trunk, if not for the workflow stuff getting in the way.

Thanks, I thought that blocks and boulders had different material types; v0.2 now checks items too.

I didn't think this would get merged into trunk... I've moved it into a branch and will send you a note to review the code once I've cleaned it up.

Also I'd like to see if I can apply the same functionality to just the "Coffer/Chest" selection screen... that's the other one I find annoying since the game mixes bags in with those and makes bedroom creation tedious.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

Mechanixm

  • Bay Watcher
    • View Profile
Re: Construction Helper Plugin: auto material selection
« Reply #9 on: November 20, 2012, 09:36:26 pm »

This is awesome falconne!  Thank you for this!

As an above ground Forter, you have made my day!
Logged

falconne

  • Bay Watcher
    • View Profile
Re: Construction Helper Plugin: auto material selection
« Reply #10 on: November 21, 2012, 02:32:02 am »

I've uploaded v0.3 that disables the plugin during non construction placement that caused crashes. Let me know of any issues.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

papent

  • Bay Watcher
  • [FORTRESS_DESTROYER]
    • View Profile
Re: Construction Helper Plugin: auto material selection
« Reply #11 on: November 25, 2012, 11:27:06 pm »

found a small bug with this plugin running (v.03), i can not build containers instant crash. have to pull the plugin to build containers then reinsert afterwards
Logged
Can't this deadly hallway instead be a kind of "zoo of flame", where everything is on fire?

falconne

  • Bay Watcher
    • View Profile
Re: Construction Helper Plugin: auto material selection
« Reply #12 on: November 26, 2012, 04:11:20 am »

found a small bug with this plugin running (v.03), i can not build containers instant crash. have to pull the plugin to build containers then reinsert afterwards

Oh really, in v0.3? Hmm I thought I fixed that specifically. I can't seem to replicate it. Is there somewhere you can upload your save so I can try it out?
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

falconne

  • Bay Watcher
    • View Profile
Re: Construction Helper Plugin: auto material selection
« Reply #13 on: December 22, 2012, 08:41:04 am »

I’ve just updated this plugin with functionality that allows some constructions (Walls, Floors and Fortifications) to be placed with “rectangular selection”, i.e. select the first corner then the last one, the way designations work, instead of using umhk keys. It allows unlimited sized selections and is able to automatically skip invalid tiles inside the selection (e.g tiles which already have a construction or other obstruction on them).

The download link is in the first post.

When you go to place one of these constructions, you’ll see a new option:
Spoiler (click to show/hide)

Pressing ‘b’ will activate rectangular selection mode, replacing the umhk keys. This setting will only persist for the session. When activated, you will see the following instructions:
Spoiler (click to show/hide)

So to place the floor, you move the cursor to the first corner, press Enter, move it to the opposite corner and Enter again, just like with designations:
Spoiler (click to show/hide)

The brown X’s indicate the selection area. Note that it doesn't matter that you can't build a construction, in this case a floor, in every tile this rectangle covers; the plugin will ignore the tiles it can't use. You can turn this display off with the ‘x’ hotkey if you like. If you do you will instead see a flashing box on the first corner, like you get when setting designations. When you select the second corner, you will get the material selection screen and the green X’s tell you what tiles will actually get built upon:
Spoiler (click to show/hide)

Basically the plugin has automatically ignored the tiles that it cannot build a floor on. This means you don’t have to place your constructions precisely around existing structures, you can just do a box select and let the plugin fill in the gaps.

Selecting materials is the same as before. You can select them one at a time or Shift-Enter to select whole groups. Also, if you use the auto select functionality that the plugin already provides, that will work here too.

While selecting the rectangle, you can also press ‘h’ to place a “hollow” square, where only the edges are used. This is something to make it easier to create walled structures. So if you have a selection like this:
Spoiler (click to show/hide)

Toggling ‘h’ turns it into this:
Spoiler (click to show/hide)

Which results in this wall placement :
Spoiler (click to show/hide)

Hope this makes constructions easier for a few people. Please let me know of any issues you find.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

Umbra

  • Bay Watcher
    • View Profile
Re: Construction Helper [Update: "designation-like" support for constructions]
« Reply #14 on: December 22, 2012, 11:30:25 am »

So useful, wow thank you so much. The tedious and time consuming task of building large constructions is no more! Much appreciated.  8)
Logged
Pages: [1] 2 3 4