Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Question on Smelter Reactions  (Read 976 times)

Vattic

  • Bay Watcher
  • bibo ergo sum
    • View Profile
Question on Smelter Reactions
« on: May 02, 2009, 04:48:35 pm »

I've been tinkering with custom reactions for a while now but after reading through the wiki I cant find answers to one problem, I want to make a generic make metal <insert item here> reaction, let's say beds. So I have:

Code: [Select]
[NAME:make metal bed]
[SMELTER]
[REAGENT:3:BAR:NO_SUBTYPE:METAL:NO_MATGLOSS]
[PRODUCT:100:1:BED:NO_SUBTYPE:METAL:<REAGENT_MATGLOSS_SUBTYPE>]

I want the PRODUCTs MATGLOSS_SUBTYPE to to be grabbed from the REAGENTs MATGLOSS_SUBTYPE, if I cant do this I'll have to either make it generate say iron beds from any 3 bars or have a reaction for each metal, which seems ridiculous.

Does anyone with more experience know how to work this?

Cheers.
Logged
6 out of 7 dwarves aren't Happy.
How To Generate Small Islands

Taritus

  • Bay Watcher
    • View Profile
Re: Question on Smelter Reactions
« Reply #1 on: May 02, 2009, 05:04:53 pm »

Unfortunately you can't do that, it's just a limitation of the engine.  I don't think it's going to be changed in the next one though...
Logged



Vattic

  • Bay Watcher
  • bibo ergo sum
    • View Profile
Re: Question on Smelter Reactions
« Reply #2 on: May 02, 2009, 05:48:03 pm »

Cheers for the quick reply but that's too bad, it should be changed and will need to be when all the workshops end up in the raws otherwise making anything from the nearest rock will be impossible.

Ideally the raws involved with making a rock door would look like this:
Code: [Select]
[REACTION:STONE_TO_DOOR]
[NAME:construct rock door]
[MASONS_WORKSHOP]
[SKILL:MASON]
[REAGENT:1:STONE:NO_SUBTYPE:STONE:PLAYER_CHOICE]
[PRODUCT:100:1:DOOR:NO_SUBTYPE:FROM_REAGENT:FROM_REAGENT]

So you can specify where it happens, what skill is involved that you need one stone of the users choice and then the product would get the material type and specifics from the reagent.

You'd want to specify possible materials here somehow or if even furniture itself makes it into the raws (please) then the appropriate stone types could be specified there.
Logged
6 out of 7 dwarves aren't Happy.
How To Generate Small Islands

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Question on Smelter Reactions
« Reply #3 on: May 02, 2009, 06:17:52 pm »

Yeah, I've been wanting better reactions for a long time too.

The generic material thing looks like it's kind of coming in the next version.  Reactions will be able, at least, to produce leather, tallow, soap and cheese in a generic fashion -- data about the creature the original material came from will be retained.  You can make some guesses about how it works from the new material templates (look for the MATERIAL_REACTION_PRODUCT tags).
Logged

Vattic

  • Bay Watcher
  • bibo ergo sum
    • View Profile
Re: Question on Smelter Reactions
« Reply #4 on: May 02, 2009, 06:36:20 pm »

Nice to hear that, haven't looked through all of the new raw templates yet as I've only recently started messing with reactions and only read what was relevant to what I was modding.

After my last post I did a search of the suggestions forum and found your post, was going to make my own but you already covered what I've said except adding some PLAYER_CHOICE like tag to specify where it asks the player what to use. Oh and as I said we'd need to either place buildable objects in the raws with lists of appropriate and inappropriate materials or specify them in the reactions themselves.

Similar to:
Code: [Select]
[ITEM_FURNITURE:ITEM_FURNITURE_BED]
[NAME:bed:beds]
[BED]
[VALUE:?]
[ANY_WOOD]

[ITEM_FURNITURE:ITEM_FURNITURE_HAMMOCK]
[NAME:hammock:hammocks]
[BED]
[VALUE:?]
[ANY_CLOTH]
[ANY_SILK]
[ANY_LEATHER]

[ITEM_FURNITURE:ITEM_FURNITURE_DOOR]
[NAME:door:doors]
[DOOR]
[VALUE:?]
[ANY_WOOD]
[ANY_STONE]
[NO_OBSIDIAN]
That last tag I'm unsure of, but I'd like to be able to include all types of a material except certain specific ones to avoid having to list all the stone types for crafts for example.
Logged
6 out of 7 dwarves aren't Happy.
How To Generate Small Islands

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Question on Smelter Reactions
« Reply #5 on: May 02, 2009, 07:48:53 pm »

The BED, DOOR and NO_OBSIDIAN tags are problematic.

BED should be replaced by something like BUILDING_CLASS:BED so that the building requirements code can interface with items in a generalized way (this will be important if/when buildings themselves enter the raws).  Same for DOOR. 

NO_OBSIDIAN, similarly, isn't future proof.  Naming a specific stone is bad because it introduces unnecessary dependencies across raw entries.  Rather you would use something like NO_LAVA, so that it checks the stone material for the LAVA tag (which only obsidian has right now).  Even this isn't a long-term solution, though, since the LAVA tag is a placeholder, just like SILK, WOOD, LEATHER and so on.  They're likely to get replaced by something like MATERIAL_CLASS:WOOD, etc. at some point, again so that raw entries can specify each other in generalized ways.

So in this case, obsidian would have MATERIAL_CLASS:LAVA (and probably STONE, SHARP, etc.) while the door would have INCLUDE_MATERIAL:STONE and EXCLUDE_MATERIAL:LAVA.
« Last Edit: May 02, 2009, 07:55:07 pm by Footkerchief »
Logged

Vattic

  • Bay Watcher
  • bibo ergo sum
    • View Profile
Re: Question on Smelter Reactions
« Reply #6 on: May 02, 2009, 08:02:08 pm »

Indeed, you are correct. I would say however that being able to exclude specific stones shouldn't be a problem. [EXCLUDE_MATERIAL:STONE:OBSIDIAN] should be fine as fine as reactions that include STONE:OBSIDIAN anyway. Unless I'm missing something.

When I wrote [BED] and [DOOR] I was imagining that they were set pieces with set uses but you are right that it would be nice having them in the raws, I hadn't seen that possibility.
Logged
6 out of 7 dwarves aren't Happy.
How To Generate Small Islands

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Question on Smelter Reactions
« Reply #7 on: May 03, 2009, 12:14:46 am »

Indeed, you are correct. I would say however that being able to exclude specific stones shouldn't be a problem. [EXCLUDE_MATERIAL:STONE:OBSIDIAN] should be fine as fine as reactions that include STONE:OBSIDIAN anyway. Unless I'm missing something.

Well yeah, it wouldn't be the end of the world.  Referring to classes of materials is a good idea when possible, but there'll be times you can't, especially in smelting reactions.  Although... smelting metal ores at least could possibly be genericized.
Logged

Zaranthan

  • Bay Watcher
  • Plump Helmet Smelter
    • View Profile
Re: Question on Smelter Reactions
« Reply #8 on: May 03, 2009, 10:18:02 pm »

Well yeah, it wouldn't be the end of the world.  Referring to classes of materials is a good idea when possible, but there'll be times you can't, especially in smelting reactions.  Although... smelting metal ores at least could possibly be genericized.
Genericized? I'm not sure that that's a word, but it's already automatic. Giving a stone the METAL_ORE tag adds the appropriate smelter reaction.
Logged
Quote from: Howard, Nerf This, by Scott D. Ferguson
Villains sleep with hookers, heroes sleep with destiny.

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Question on Smelter Reactions
« Reply #9 on: May 03, 2009, 11:07:52 pm »

Yeah, sorry, what I meant was keeping it generic while bringing it under the umbrella of actual in-the-raws reactions, so that the reaction can be tweaked or done at a different building or whatever.
Logged