Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Is it possible to have one of the products be a clone of the reagent?  (Read 2124 times)

YAHG

  • Bay Watcher
    • View Profile

So that we may simulate a % chance to [PRESERVE_REAGENT]?

GavJ

  • Bay Watcher
    • View Profile
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #1 on: August 20, 2014, 08:11:42 pm »

[GET_MATERIAL_FROM_REAGENT] clones the material. I don't think there's a means of cloning the item type, but it would be odd to want to do that. Usually you only accept one type of item, so you can just hardcode that part into the product as well. Can you be more specific?
Logged
Cauliflower Labs – Geologically realistic world generator devblog

Dwarf fortress in 50 words: You start with seven alcoholic, manic-depressive dwarves. You build a fortress in the wilderness where EVERYTHING tries to kill you, including your own dwarves. Usually, your chief imports are immigrants, beer, and optimism. Your chief exports are misery, limestone violins, forest fires, elf tallow soap, and carved kitten bone.

YAHG

  • Bay Watcher
    • View Profile
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #2 on: August 20, 2014, 09:42:53 pm »

One example would be reworking a weapon

1 Weapon goes in,
90% chance of: Same weapon type and material coming out
(If it can grab the type of the item AND its material then anything with a quality level could be reworked?  ???)

Other uses can be reactions using some reagents like 'tools' that might break or whatever :)

BlackFlyme

  • Bay Watcher
  • BlackFlyme cancels Work: Interrupted by bird.
    • View Profile
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #3 on: August 20, 2014, 10:00:57 pm »

Actually, we now have the reaction tag GET_ITEM_DATA_FROM_REAGENT, which can create a copy of the reagent specified if set to GET_ITEM_DATA_FROM_REAGENT:ID:NONE. Though the quality level will still vary.
Logged

YAHG

  • Bay Watcher
    • View Profile
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #4 on: August 21, 2014, 01:43:18 pm »

Actually, we now have the reaction tag GET_ITEM_DATA_FROM_REAGENT, which can create a copy of the reagent specified if set to GET_ITEM_DATA_FROM_REAGENT:ID:NONE.

Cool, thanks do I need it to be?

GET_ITEM_DATA_FROM_REAGENT:ID:NONE:GET_MATERIAL_FROM_REAGENT:ID:NONE

(To be the same exact item type and material type as the reagent 'ID')

I've noticed the tag looks very similar for the tags for material reaction products, but sometimes you do not want a reaction product material, but rather just the original (useful for 'magic' to change say a wooden sword into a wooden bed etc.)

Though the quality level will still vary.

Well that's perfect for rework and weird for tool use, but overall probably for the best :) (much rather be able to rework than %preserve exactly)

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #5 on: August 21, 2014, 04:14:54 pm »

Cool, thanks do I need it to be?

GET_ITEM_DATA_FROM_REAGENT:ID:NONE:GET_MATERIAL_FROM_REAGENT:ID:NONE
No - using GET_ITEM_DATA_FROM_REAGENT specifies both the item type and the material. You cannot clone the item type without also cloning the material.

Also, as suggested above, this will not create a true "clone" of the item - the only things preserved will be the item type/subtype and the material.
« Last Edit: August 21, 2014, 04:16:51 pm by Quietust »
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.

YAHG

  • Bay Watcher
    • View Profile
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #6 on: August 21, 2014, 05:06:24 pm »

Cool, thanks do I need it to be?

GET_ITEM_DATA_FROM_REAGENT:ID:NONE:GET_MATERIAL_FROM_REAGENT:ID:NONE
No - using GET_ITEM_DATA_FROM_REAGENT specifies both the item type and the material. You cannot clone the item type without also cloning the material.

Phew, glad I asked. It would've been great if they were separate for finer grain control and 'magic' type reactions that transform say:

A wooden weapon into a steel one, without reactions for each weapon type (or any other type of item).

GavJ

  • Bay Watcher
    • View Profile
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #7 on: August 21, 2014, 05:42:17 pm »

I'm afraid I don't understand the difference between

GET_ITEM_DATA_FROM_REAGENT:reagent:REACTION_PRODUCT_ID
and
GET_ITEM_DATA_FROM_REAGENT:reagent:NONE

or in fact why the third argument is even necessary or included at all, since this is already being written in the product tag that it applies to? I ask, because the fact it is there implies you can do something more than seems to be assumed.

Like, what happens if you put some OTHER product ID in?  For example
* Reagent = WEAPON:NONE:NONE:NONE
* ProductA = GET_ITEM_DATA_FROM_REAGENT:Reagent:ProductB
* ProductB = NONE:NONE:INORGANIC:STEEL

Or something?
Logged
Cauliflower Labs – Geologically realistic world generator devblog

Dwarf fortress in 50 words: You start with seven alcoholic, manic-depressive dwarves. You build a fortress in the wilderness where EVERYTHING tries to kill you, including your own dwarves. Usually, your chief imports are immigrants, beer, and optimism. Your chief exports are misery, limestone violins, forest fires, elf tallow soap, and carved kitten bone.

scamtank

  • Bay Watcher
    • View Profile
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #8 on: August 21, 2014, 06:05:12 pm »

I'm afraid I don't understand the difference between

GET_ITEM_DATA_FROM_REAGENT:reagent:REACTION_PRODUCT_ID
and
GET_ITEM_DATA_FROM_REAGENT:reagent:NONE

In the case of GET_MATERIAL_FROM_REAGENT, the above hooks into a matching counterpart in the material definition (like TAN_MAT in the skin material), since the material may have more than one of those guides. The below just takes the reagent's material wholesale.

I'd have to guess that GET_ITEM_DATA_FROM_REAGENT:reagent:NONE in the product line would just... put out an identical clone of the reagent. If it even works, that is. That's a pretty avant-garde assumption you've got there.
Logged

GavJ

  • Bay Watcher
    • View Profile
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #9 on: August 21, 2014, 06:19:48 pm »

It's not an assumption. It's a question for !!Science!!.  I don't have access to a device that can play DF at the moment to test it myself.

Although actually I'm confused now about what the hell a REACTION_PRODUCT_ID actually even IS.....

I was thinking in terms of reagents, which have an id text string, but products don't have that, so what the hell is the wiki even talking about by saying "REACTION_PRODUCT_ID" ? Does anybody have an actual example of anything that you know can go in that field other than "NONE" ?
Logged
Cauliflower Labs – Geologically realistic world generator devblog

Dwarf fortress in 50 words: You start with seven alcoholic, manic-depressive dwarves. You build a fortress in the wilderness where EVERYTHING tries to kill you, including your own dwarves. Usually, your chief imports are immigrants, beer, and optimism. Your chief exports are misery, limestone violins, forest fires, elf tallow soap, and carved kitten bone.

BlackFlyme

  • Bay Watcher
  • BlackFlyme cancels Work: Interrupted by bird.
    • View Profile
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #10 on: August 21, 2014, 06:24:23 pm »

It's for the new item reaction product tag. Like the material reaction product tag, but it defines both the item type and the material that is created.

An example would be quarry bushes, which have this:
Code: [Select]
[ITEM_REACTION_PRODUCT:BAG_ITEM:PLANT_GROWTH:LEAVES:LOCAL_PLANT_MAT:LEAF]
The reaction product ID in this instance is called BAG_ITEM, and is used in the plant processing reaction at the farmer's workshop.
Code: [Select]
[REACTION:PROCESS_PLANT_TO_BAG]
[NAME:process plant to bag]
[BUILDING:FARMER:CUSTOM_B]
[REAGENT:plant:1:PLANT:NONE:NONE:NONE]
[HAS_MATERIAL_REACTION_PRODUCT:BAG_ITEM]
[UNROTTEN]
[REAGENT:bag:1:BOX:NONE:NONE:NONE]
[EMPTY]
[BAG]
[PRESERVE_REAGENT]
[DOES_NOT_DETERMINE_PRODUCT_AMOUNT]
[PRODUCT:100:5:GET_ITEM_DATA_FROM_REAGENT:plant:BAG_ITEM]
[PRODUCT_TO_CONTAINER:bag]
[PRODUCT:100:1:SEEDS:NONE:GET_MATERIAL_FROM_REAGENT:plant:SEED_MAT]
[SKILL:PROCESSPLANTS]
Logged

scamtank

  • Bay Watcher
    • View Profile
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #11 on: August 21, 2014, 06:27:33 pm »

It's an arbitrary identifier. Take this excerpt from the soapmaking reaction:

Code: [Select]
[PRODUCT:100:1:BAR:NONE:GET_MATERIAL_FROM_REAGENT:tallow:SOAP_MAT]
Okay, that's SOAP_MAT. There should be a counterpart in the appropriate material:

Code: [Select]
[MATERIAL_REACTION_PRODUCT:SOAP_MAT:LOCAL_CREATURE_MAT:SOAP]
...that says what the actual material of the product will be. The "SOAP_MAT" could just as well be "LARD_YOU_STEW_IN_A_POT" as far as the game is concerned. Anything as long as the reaction product and the material tag find one another.

e: eh, beat
Logged

GavJ

  • Bay Watcher
    • View Profile
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #12 on: August 21, 2014, 06:52:32 pm »

Quote
[ITEM_REACTION_PRODUCT:BAG_ITEM:PLANT_GROWTH:LEAVES:LOCAL_PLANT_MAT:LEAF]
Alright, so what happens if you replace some of that stuff at the end with a big fat "NONE" ?
Crash/error? Or perhaps a roundabout way to copy only the item tag?
Logged
Cauliflower Labs – Geologically realistic world generator devblog

Dwarf fortress in 50 words: You start with seven alcoholic, manic-depressive dwarves. You build a fortress in the wilderness where EVERYTHING tries to kill you, including your own dwarves. Usually, your chief imports are immigrants, beer, and optimism. Your chief exports are misery, limestone violins, forest fires, elf tallow soap, and carved kitten bone.

YAHG

  • Bay Watcher
    • View Profile
Re: Is it possible to have one of the products be a clone of the reagent?
« Reply #13 on: August 21, 2014, 07:53:57 pm »

Quote
[ITEM_REACTION_PRODUCT:BAG_ITEM:PLANT_GROWTH:LEAVES:LOCAL_PLANT_MAT:LEAF]
Alright, so what happens if you replace some of that stuff at the end with a big fat "NONE" ?
Crash/error? Or perhaps a roundabout way to copy only the item tag?

Copying only the item tag would be great, I think it should be possible to define a material as its own reaction product (maybe not at the template level through, as items/weapons do not appear to have local materials? i.e. plants and creatures only).

That would give us useful data to plug into the PRODUCTs and vastly increase what is possible via the forms:

ItemtypeA:MaterialA -> ItemtypeA:MaterialB
ItemtypeA:MaterialA -> ItemtypeB:MaterialA

So transmutation and shape change reactions (grown wood comes to mind here)