Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Simple reaction mod: Iron bars from any metal ore  (Read 2598 times)

daveftw

  • Bay Watcher
    • View Profile
Simple reaction mod: Iron bars from any metal ore
« on: March 09, 2011, 01:27:11 am »

Hi all, I made a simple reaction mod to create iron bars from any type of metal ore, and I wanted to share it with the community.  The mod creates a new task at the smelter, Make iron bars.  The task requires metal ore and fuel, so hopefully it doesn't feel too much like cheating.  I created this in response to the metal scarcity changes in the recent versions of DF.

Existing smelting reactions, including iron ores, are unaffected.  You should be careful if you have platinum or aluminum (or any other metal ore you want to use normally) on your map; the new reaction will use them to create iron.  The reaction will not deplete your cotton candy stockpile.

The mod works by adding a new reaction class, METAL_ORE, and a new reaction, IRON_FROM_ANY_ORE.  The new reaction class is applied to metal ores in inorganic_stone_mineral.txt, and the reaction is defined in reaction_ironfromanyore.txtentity_default.txt is modified to add the new reaction to the dwarf civilization.

Installation
Download the mod from http://dffd.wimbli.com/file.php?id=3936 and extract it into your df/raw/objects folder, or copy and paste from below.  This mod will require you to regenerate your world, as it adds a new reaction.

Workarounds
  • Change the stones used in the reaction
    If you don't want to use certain ores in this reaction, remove [REACTION_CLASS:METAL_ORE] from its definition in inorganic_stone_mineral.txt.  Likewise, if you want to use a stone which wasn't included, add the reaction class to that stone's definition.
  • Use the reaction without regenerating the world
    I haven't tested this, but you should be able to replace an existing reaction and use this mod on an existing savegame.  In your save folder's raws, replace inorganic_stone_mineral.txt with this version, then copy the contents of the new reaction over an existing reaction.  Make sure you pick an alloy that you don't care about, because no one in the world will be able to make it any more!  Any culture which can make the replaced alloy can now make iron from any metal ore, which may do interesting things to the game; remove the reaction from the other civilizations' permitted reactions if you don't want this to happen.  Existing bars/items made from that alloy should remain unaffected, and you should still be able to make items from bars which already exist.
    Spoiler (click to show/hide)
  • Coexisting with other mods
    This mod should be fairly simple to integrate into other mods.  reaction_ironfromanyore.txt is fine unless the file name clashes.  entity_default.txt only needs one additional reaction permission which can easily be added by hand.  inorganic_stone_mineral.txt needs the new reaction class added to 16 different stones; tedious but doable.  Search for METAL_ORE and add [REACTION_CLASS:METAL_ORE] on the next line.

Files
I can't post all of entity_default.txt due to size, but inorganic_stone_mineral.txt and reaction_ironfromanyore.txt are posted in their entirety.  You can get the mod, including a complete version of entity_default.txt, from http://dffd.wimbli.com/file.php?id=3936.  No lines in entity_default.txt or inorganic_stone_mineral.txt are modified; new lines are red.
  • entity_default.txt
    Spoiler (click to show/hide)
  • inorganic_stone_mineral.txt
    Spoiler (click to show/hide)
  • reaction_ironfromanyore.txt
    Spoiler (click to show/hide)
« Last Edit: April 10, 2011, 05:24:27 am by daveftw »
Logged

daveftw

  • Bay Watcher
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #1 on: March 09, 2011, 01:34:54 am »

reserved
Logged

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #2 on: March 09, 2011, 01:40:49 am »

.21 lets you decide on the scarcity before you gen the world.

Dutchling

  • Bay Watcher
  • Ridin' with Biden
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #3 on: March 09, 2011, 09:04:05 am »

.21 lets you decide on the scarcity before you gen the world.
[/thread]
Logged

Greep

  • Bay Watcher
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #4 on: March 10, 2011, 02:26:43 am »

[thread]
 
Actually the scarcity doesn't have anything to do with whether your fort has iron, all that matters is whether you have sedimentary, which the game doesn't tell you.  More iron yes when the metal can be found there, but 5 forts in a row with no iron.

Btw, in your raws listed at the bottom of the OP, did you mean the ][stuff] in each of the ores or do you mean [stuff].  Looks like a typo, but I'm assuming you tested the mod.
« Last Edit: March 10, 2011, 02:33:27 am by Greep »
Logged

daveftw

  • Bay Watcher
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #5 on: April 10, 2011, 01:45:51 am »

[thread]
 
Actually the scarcity doesn't have anything to do with whether your fort has iron, all that matters is whether you have sedimentary, which the game doesn't tell you.  More iron yes when the metal can be found there, but 5 forts in a row with no iron.

Btw, in your raws listed at the bottom of the OP, did you mean the ][stuff] in each of the ores or do you mean [stuff].  Looks like a typo, but I'm assuming you tested the mod.

Argh, I pretty much just wandered off from the thread.  Regarding ][stuff], you're right on both counts!  Its a typo (fixed now), but the mod actually works!  I was doing a find/replace to surround the relevant lines with the red color tag, and screwed that up. :)

The mod should still work with 31.25, but I haven't tested it yet.
Logged

Grimlocke

  • Bay Watcher
  • *kobold noises*
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #6 on: April 10, 2011, 03:51:55 am »

Might I add that there is a [METAL_ORE] reaction tag, making that reaction class part redundant?
Logged
I make Grimlocke's History & Realism Mods. Its got poleaxes, sturdy joints and bloomeries. Now compatible with DF Revised!

daveftw

  • Bay Watcher
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #7 on: April 10, 2011, 05:28:38 am »

Is there
Might I add that there is a [METAL_ORE] reaction tag, making that reaction class part redundant?

Is there a way to match all metal ores using that tag?  [REAGENT:A:1:METAL_ORE:NONE], [REAGENT:A:1:METAL_ORE:NO_SUBTYPE], and [REAGENT:A:1:BOULDER:NO_SUBTYPE:NONE:NONE][METAL_ORE] match any boulder, not just metal ores.  [REAGENT:A:1:METAL_ORE] doesn't even get picked up at all, the reaction just uses fuel.  If there's a way to make it work with the built in tag, that would be great, I'd love to be able to leave inorganic_stone_mineral.txt alone.
« Last Edit: April 10, 2011, 06:07:58 am by daveftw »
Logged

EmperorJon

  • Bay Watcher
  • Still waiting...
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #8 on: April 10, 2011, 09:53:11 am »

Quote
Actually the scarcity doesn't have anything to do with whether your fort has iron, all that matters is whether you have sedimentary, which the game doesn't tell you.  More iron yes when the metal can be found there, but 5 forts in a row with no iron.

1. Yes it does. Scarcity lowers the number of minerals. So on a low scarcity, you're likely to get something useless like cinnabar instead of a useful ore.
2. Sedimentary isn't the only place to find iron.
3. Sedimentary layers are reasonably easy to find if you look right.
4. 5 in a row with no Iron... but did you actually change the settings?

Aaanyway...

5. Making Iron from any ore really is a bit cheaty...
Logged
I think it's the way towns develop now. In the beginning, people move into a town. Then they start producing tables, which results in more and more tables. Soon tables represent a significant portion of the population, they start lobbying for new laws and regulations, putting people to greater and greater disadvantage...
Link for full quote. 'tis mighty funny.

Minnakht

  • Bay Watcher
  • Green Eyed Monster
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #9 on: April 10, 2011, 10:38:50 am »

Quote
2. Sedimentary isn't the only place to find iron.

How often have you found those hematite veins?
Logged
Giant badgers are cruel saddistic balls of fur and hate. Did anyone know they could paint a wall with a single dwarven baby?.... You know what, I made the Giant badgers sound like sane DF players.
A Kea has stolen a coke!

EmperorJon

  • Bay Watcher
  • Still waiting...
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #10 on: April 10, 2011, 10:42:59 am »

All the time?
Logged
I think it's the way towns develop now. In the beginning, people move into a town. Then they start producing tables, which results in more and more tables. Soon tables represent a significant portion of the population, they start lobbying for new laws and regulations, putting people to greater and greater disadvantage...
Link for full quote. 'tis mighty funny.

Grimlocke

  • Bay Watcher
  • *kobold noises*
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #11 on: April 10, 2011, 02:03:37 pm »

[REAGENT:A:1:BOULDER:NONE:NONE:NONE][METAL_ORE] Should be correct, the metal_ore tag functions like an additional 'condition' the item to use should meet. If that still takes any boulder then it would appear that the metal_ore tag is broken, in that case excuse the poorly researched advice hehehe...

Also the reagent syntax is [REAGENT:<name>:<amouth>:<item type>:<item subtype>:<material>:<material subtype>] The last four can have NONE, in which case they wont be used. Leaving them out entirely usualy causes trouble.

And sedimentary layers appear where there is little volcanism, ignrious layers where there is much and metamorphic in between. Scarcity should regulate how many mineral stones it spawns, this includes microcline and such muck.
Logged
I make Grimlocke's History & Realism Mods. Its got poleaxes, sturdy joints and bloomeries. Now compatible with DF Revised!

daveftw

  • Bay Watcher
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #12 on: April 10, 2011, 03:04:31 pm »

Quote
Actually the scarcity doesn't have anything to do with whether your fort has iron, all that matters is whether you have sedimentary, which the game doesn't tell you.  More iron yes when the metal can be found there, but 5 forts in a row with no iron.

1. Yes it does. Scarcity lowers the number of minerals. So on a low scarcity, you're likely to get something useless like cinnabar instead of a useful ore.
2. Sedimentary isn't the only place to find iron.
3. Sedimentary layers are reasonably easy to find if you look right.
4. 5 in a row with no Iron... but did you actually change the settings?

Aaanyway...

5. Making Iron from any ore really is a bit cheaty...

Making it just a bit cheap was the point! :) You can get iron on an otherwise perfect embark, but you still have to spend the dwarf labor on mining and hauling the ore.

[REAGENT:A:1:BOULDER:NONE:NONE:NONE][METAL_ORE] Should be correct, the metal_ore tag functions like an additional 'condition' the item to use should meet. If that still takes any boulder then it would appear that the metal_ore tag is broken, in that case excuse the poorly researched advice hehehe...

Also the reagent syntax is [REAGENT:<name>:<amouth>:<item type>:<item subtype>:<material>:<material subtype>] The last four can have NONE, in which case they wont be used. Leaving them out entirely usualy causes trouble.

And sedimentary layers appear where there is little volcanism, ignrious layers where there is much and metamorphic in between. Scarcity should regulate how many mineral stones it spawns, this includes microcline and such muck.

Add [REAGENT:A:1:BOULDER:NONE:NONE:NONE][METAL_ORE] to the list of reagents that will use any boulder, unfortunately.  Should I put this on the bug tracker?  I don't want to clutter it up if I'm the one doing something wrong here.
Logged

Grimlocke

  • Bay Watcher
  • *kobold noises*
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #13 on: April 11, 2011, 07:24:03 am »

Well, thing is I found that tag in the string dump. It doesnt show up in the default raws at all, so it could be that Toady put it in the raw compiler but never found any use for it. It could be a bug, but it could also be that it wasnt even intended to work in the first place.

There is other tags like that that do work though, I dont think it would do much harm to put in on the bug tracker.
Logged
I make Grimlocke's History & Realism Mods. Its got poleaxes, sturdy joints and bloomeries. Now compatible with DF Revised!

_DivideByZero_

  • Bay Watcher
  • Not to be confused with infinity
    • View Profile
Re: Simple reaction mod: Iron bars from any metal ore
« Reply #14 on: April 11, 2011, 04:52:19 pm »

Mineral scarcity has little to do with the amount of minerals present. In fact, you'll likely have less iron with a lower mineral scarcity in a particular embark (if both have iron, and both are exactly the same minus the minerals present) because mineral scarcity only determines what minerals will be present. In other words, your precious iron can be crowded down to a single vein or two if your scarcity is too low.
Logged
Have I now become your enemy by telling you the truth? (Gal 4:16)