Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Geo Manipulator, a pre embark geological layer manipulator  (Read 4139 times)

PatrikLundell

  • Bay Watcher
    • View Profile

This tools is no longer supported, as the functionality has been rolled into the larger Biome Manipulator http://www.bay12forums.com/smf/index.php?topic=164658.0
This tool allows you to replace the geo biome of a world tile at a time with one of your making. It has to be used during the pre embark phase and does only change geological layers and their veins/clusters, but does not allow manipulation of the region's thickness or cavern placement. If an intended embark covers ground belonging to different world tile biomes, you have to edit each of those world tiles' geo biomes in turn to control the embark layers throughout the embark.

Why edit at all?
- You can ensure the presence of desired materials, either with desired traits (such as ores, gypsum, and the like) or colors.
- You can ensure the absence of "contaminants" in blocks of rock to ensure your fortress part of the embark is nicely uniform in color.

Note that there is no support regarding material properties, uses, or which ones may be present inside of each layer apart from the population of the corresponding lists. You'll have to look to the wiki for that. The tool attempts to follow the rules defined by the raws for which veins/clusters are found where.

You save the code into a file called geomanipulator.lua and store it in <DF directory>\hack\scripts and it is the invoked by calling "geomanipulator" from the DFHack console.

Spoiler (click to show/hide)

Edit: Thanks lethosor, I fixed the wrapping. I accidentally used quote instead of code...

Change log:
Version 0.3 2017-09-24: Corrected correction. I had to ensure nothing in done on empty lists, rather than trying to remove a non existent element.
Version 0.2 2017-09-24: Replaced misused  :delete() operations that kill DF on 64 bit Windows with iteration over erase(). This problem caused the "morph" operation to be lethal.
« Last Edit: December 19, 2017, 06:30:00 am by PatrikLundell »
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: Geo Manipulator, a pre embark geological layer manipulator
« Reply #1 on: May 12, 2017, 12:25:39 pm »

It looks like there are some occurrences of [i] and [li] that are being treated as tags by the forum. You probably want to wrap it in a [code] block too (or use a host like GitHub, Gist, etc.).

This looks cool! I'll definitely try it out.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Geo Manipulator, a pre embark geological layer manipulator
« Reply #2 on: May 12, 2017, 02:05:11 pm »

Thanks lethosors. I've fixed the wrapping.

Some experiment results:
I tried to replace the topmost soil level with basal (basically having the embark covered by a volcanic flow). It worked in some interesting ways:
- The surface was covered in grass, but not a single shrub. The only trees were willows (probably lured there by the pools, and not negated by the rock). Some willow saplings matured during my test session, but no new ones appeared.
- Channeling down two levels (i.e. into soil) I created a courtyard with a soil layer below. That courtyard sprouted shrubs and saplings, so I did get two apple tree saplings. That punctured my hypothesis that you can't get tree species that aren't present on the embark.

I've also tried placing a soil layer deep down in the earth (to e.g. give easy access to clay or sand to magma facilities), but that doesn't work. I suspect DF simply ignores/erodes any soil deeper than the maximum soil depth. Currently the script doesn't stop you from trying, though.
Logged

Altaree

  • Bay Watcher
    • View Profile
Re: Geo Manipulator, a pre embark geological layer manipulator
« Reply #3 on: June 19, 2017, 11:41:30 am »

I am using the latest masterwork with 43.05 x64.

When I tried to replace an igneous intrusive layer with a sedimentary layer I got an immediate crash to desktop.
This is a great tool for looking into what actual ores will be present.  Thanks!
Logged
Dan Pearson:
This is a game which calculates the volume of blood in every creature it generates so it knows how much alcohol it would have to consume to get drunk, an update which, remarkably, ended up covering people's fortresses in cat vomit.

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Geo Manipulator, a pre embark geological layer manipulator
« Reply #4 on: June 19, 2017, 12:51:44 pm »

Glad to hear someone is actually using it...

Does Masterwork mess with rocks? Adding or removing *shouldn't* matter, as long as the raw definitions are consistent. If not, my guess would be that DF didn't like to allocate memory for a rock layer object, and it might work on a new attempt. I have no idea why DF sometimes doesn't like to allocate memory, though.

Edit: To clarify: I haven't had any memory allocation crashes during development and test, or I would have warned about it.
« Last Edit: June 20, 2017, 03:59:30 am by PatrikLundell »
Logged

Jazz Cat

  • Bay Watcher
  • Adept stringed instrumentalist
    • View Profile
Re: Geo Manipulator, a pre embark geological layer manipulator
« Reply #5 on: September 22, 2017, 05:45:04 pm »

It crashes for me too when I try to [m]orph a layer into another type.
Logged
Give your dwarves a pet
My holiday mod (only offensive to elves)
The check-laundry script

Quote
Just give the Crossbow weapon the [AMMO:CROSSBOW] tag in the raws. You can make a crossbow that shoots crossbows.

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Geo Manipulator, a pre embark geological layer manipulator
« Reply #6 on: September 23, 2017, 03:28:53 am »

Is it possible to provide a save and a description of where you perform the operation (i.e. where the "embark" is), which layer you try to morph, and what you try to morph it into?
If I can reproduce the problem it ought to be possible to fix it (or at least add a warning and a refusal to stop it from crashing).
Logged

Jazz Cat

  • Bay Watcher
  • Adept stringed instrumentalist
    • View Profile
Re: Geo Manipulator, a pre embark geological layer manipulator
« Reply #7 on: September 23, 2017, 02:53:20 pm »

Sure, here's the save. It crashes (judging from a few random samples) when I try to change any layer into any layer at any location. I'm using the Lazy Newb Pack on Windows 7 with DF 0.43.05. I've added a couple extra plants to the raws but haven't made any modding changes to worldgen, minerals, or stone types.
Logged
Give your dwarves a pet
My holiday mod (only offensive to elves)
The check-laundry script

Quote
Just give the Crossbow weapon the [AMMO:CROSSBOW] tag in the raws. You can make a crossbow that shoots crossbows.

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Geo Manipulator, a pre embark geological layer manipulator
« Reply #8 on: September 23, 2017, 03:55:50 pm »

Thanks for that. I didn't have any problem with the 32 bit version (i.e. could not repeat the problem), but the 64 bit version of DF decides to just disappear (without even a puff of smoke) when I tried to morph a layer, just as you said.
Looks like it can be a bit tricky to track it down...
Logged

Jazz Cat

  • Bay Watcher
  • Adept stringed instrumentalist
    • View Profile
Re: Geo Manipulator, a pre embark geological layer manipulator
« Reply #9 on: September 23, 2017, 04:46:12 pm »

Aye, I'm on the 64-bit version.
Logged
Give your dwarves a pet
My holiday mod (only offensive to elves)
The check-laundry script

Quote
Just give the Crossbow weapon the [AMMO:CROSSBOW] tag in the raws. You can make a crossbow that shoots crossbows.

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Geo Manipulator, a pre embark geological layer manipulator
« Reply #10 on: September 24, 2017, 03:00:51 am »

I've found the issue. I've inappropriately tried to wipe lists using the :delete() operation, and for some reason (which I suspect is a bug) that causes DF 64 bit on Windows to go belly up (if I understand it correctly, it should do nothing, as in the 32 bit version).
Regardless, I've replaced the buggy code with appropriate clearing of the data, and a short test shows it to work on 64 bit Windows (as well as 32 bit). It can be noted that my biomemanipulator script has the same bug (not surprising, as that script part is basically a copy of this one), so that's the next script to fix.

Edit:
Updated to 0.3 as my correction had a bug.
« Last Edit: September 24, 2017, 03:21:19 am by PatrikLundell »
Logged