Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DFBauxite - Convert all your mechanisms to bauxite  (Read 738 times)

Alex.

  • Escaped Lunatic
    • View Profile
DFBauxite - Convert all your mechanisms to bauxite
« on: February 03, 2010, 10:41:23 am »

Download it here

So I thought I'd give DFHack a go and I must say that after a couple of hours of digging through source code it made a lot of sense, which is fairly unusual for me. After looking at the itemdump tool I figured I could probably make it change things into bauxite and so I present to you the fruits of my labour, DFBauxite. No longer must we be slaves to the magma, viva la revolution!

== Instructions ==

1. Backup your Fortress
2. Open Dwarf Fortress
3. Run dfbauxite.exe
4. Press any key to continue
5. Build intricate goblin-murdering magma defences
« Last Edit: February 03, 2010, 05:47:37 pm by Alex. »
Logged

darius

  • Bay Watcher
  • ^^
    • View Profile
Re: DFBauxite - Convert all your mechanisms to bauxite
« Reply #1 on: February 03, 2010, 05:59:43 pm »

Welcome to the darkside :D
Logged

Shima

  • Bay Watcher
  • Time to go fishing, lads.
    • View Profile
Re: DFBauxite - Convert all your mechanisms to bauxite
« Reply #2 on: February 04, 2010, 11:42:17 am »

What version does this work for?  And does it work on ALL mechanisms (IE, ones already built), or only ones laying around?  Does it affect ones that are still to be made?
Logged
(giant worm leather coat)
Weight: 718238Γ
Owner: Udil Evonudil, Planter

Oh Armok, the spice.

Alex.

  • Escaped Lunatic
    • View Profile
Re: DFBauxite - Convert all your mechanisms to bauxite
« Reply #3 on: February 04, 2010, 06:20:29 pm »

Fairly sure it'll only work in 0.28.181.40d. It only works on pre-existing mechanisms, all it does it scan all items and when it finds a mechanism it changes the material to bauxite. It does seem to work on mechanisms already being used in constructions though.
Logged

peterix

  • Bay Watcher
    • View Profile
    • Dethware
Re: DFBauxite - Convert all your mechanisms to bauxite
« Reply #4 on: February 04, 2010, 10:05:27 pm »

Correction: from reading the code, it looks like it currently only works with 0.28.181.40d16.
Also, there are a few problems with hard-coded values. Don't use this with mods that change DF's stone material raws. Avoid worlds generated with older DF versions, even if the raws were the same. You will most probably get something else instead of bauxite.

I'll poke around ;)
I should have something very soon. At least something that doesn't have the hardcoded values problem.
Eliminated the crasher bugs.

Revised code, should be much safer:
Spoiler (click to show/hide)

Spoiler (click to show/hide)
« Last Edit: February 05, 2010, 10:02:27 am by peterix »
Logged

Alex.

  • Escaped Lunatic
    • View Profile
Re: DFBauxite - Convert all your mechanisms to bauxite
« Reply #5 on: February 05, 2010, 01:04:27 am »

Thanks! I forgot all about the hard coded values. And thanks for the error checking stuff as well.

I was wondering why there was no WriteItems function, so I decided to try and edit the memory directly just to see if it worked. Which is, as you said, counter-intuitive. I would have tried to write something for the API but I would almost definitely have created more bugs...

I've uploaded peterix's changes to DFFD for anyone who wants to actually use this.
Logged

peterix

  • Bay Watcher
    • View Profile
    • Dethware
Re: DFBauxite - Convert all your mechanisms to bauxite
« Reply #6 on: February 05, 2010, 10:02:05 am »

The part that's really counter-intuitive is using InitReadBuildings to get the object id/name mapping. And the fact the method can't return an error if it triggers one.

Oh well.