Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Plant reaction questions  (Read 1666 times)

Minnakht

  • Bay Watcher
  • Green Eyed Monster
    • View Profile
Plant reaction questions
« on: February 14, 2012, 01:21:23 pm »

I want to mod in some new plants, but have run into a progress block. Basically, I have no idea how do the reactions work.

What makes rock nuts millable? What makes rock nut paste pressable?
What makes the game know that you get fiber out of rape reed/pig tails by processing it?

Basically, it'd be nice if there was a toot oriole somewhere, but despite reading quite a lot of the wiki, I found nothing to help me there.
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!

Prologue

  • Bay Watcher
    • View Profile
Re: Plant reaction questions
« Reply #1 on: February 14, 2012, 01:38:52 pm »

A reaction basically needs two thins, an item token and a material token. I haven't played around with powder (flour) yet so I could be wrong but here goes:

Using a simple reaction as an outline, let's try making flour. You need a plant and a bag. So you will need 2 reagents. From there you know that the POWDER_MISC needs to go in the bag so you need to put the plant reagent in the bag. That's it.

This is for threads:
[REAGENT:A:1:PLANT:NO_SUBTYPE:PLANT_MAT:PLANT_ID:MATERIAL_NAME:NONE]
[PRODUCT:100:1500:THREAD:NONE:GET_MATERIAL_FROM_REAGENT:A:NONE]

Like I said, I could be wrong.
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: Plant reaction questions
« Reply #2 on: February 14, 2012, 02:25:33 pm »

Let me demonstrate with pig tails :-


Code: [Select]
[PLANT:GRASS_TAIL_PIG]
[NAME:pig tail][NAME_PLURAL:pig tails][ADJ:pig tail]
[USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
[MATERIAL_VALUE:2]
[BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]
[PICKED_TILE:231][PICKED_COLOR:7:0:0]
[GROWDUR:300][VALUE:2]
[USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE]
[STATE_NAME_ADJ:ALL_SOLID:frozen dwarven ale]
[STATE_NAME_ADJ:LIQUID:dwarven ale]
[STATE_NAME_ADJ:GAS:boiling dwarven ale]
[MATERIAL_VALUE:2]
[DISPLAY_COLOR:7:0:0]
[EDIBLE_RAW]
[EDIBLE_COOKED]
[PREFIX:NONE]
[DRINK:LOCAL_PLANT_MAT:DRINK]
[USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]
[MATERIAL_VALUE:1]
[EDIBLE_VERMIN]
[EDIBLE_COOKED]
[SEED:pig tail seed:pig tail seeds:0:0:1:LOCAL_PLANT_MAT:SEED]
[SUMMER][AUTUMN]
[FREQUENCY:100]
[CLUSTERSIZE:5]
[USE_MATERIAL_TEMPLATE:THREAD:THREAD_PLANT_TEMPLATE]
[THREAD:LOCAL_PLANT_MAT:THREAD]
[MATERIAL_VALUE:2]
[PREFSTRING:twisting stalks]
[WET][DRY]
[BIOME:SUBTERRANEAN_WATER]
[UNDERGROUND_DEPTH:1:3]
[SHRUB_TILE:58]
[DEAD_SHRUB_TILE:58]
[SHRUB_COLOR:7:0:0]
[DEAD_SHRUB_COLOR:0:0:1]


[USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE]
starts defining a material called "DRINK" (arbitrary, and one plant can have as many sub-materials as you like) as part of the plant, the full external material name is PLANT:GRASS_TAIL_PIG:DRINK and the local name is LOCAL_PLANT_MAT:DRINK

[DRINK:LOCAL_PLANT_MAT:DRINK]
defines that this material is the "DRINK" and it consists of "LOCAL_PLANT_MAT:DRINK". this is the line which actually makes Pig tails brewable, and links the brewing action to the defined material from the "USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE" section. You don't even need to have the material defined in the plant, no reason you can't have a plant which brews into cow's milk for example (CREATURE:COW:MILK or something along those lines, the MILK material for cows is inside the COW creature definition)


[USE_MATERIAL_TEMPLATE:THREAD:THREAD_PLANT_TEMPLATE]
Is the same thing as the DRINK section, first it defines a sub-material (full name = PLANT:GRASS_TAIL_PIG:THREAD).

And [THREAD:LOCAL_PLANT_MAT:THREAD] links the material to the "THREAD" action. LOCAL_PLANT_MAT:THREAD is the "local" name of the material created in the [USE_MATERIAL_TEMPLATE:THREAD:THREAD_PLANT_TEMPLATE].

The local names are arbitrary, you could call the THREAD materials WALRUS instead. and you'd write those lines as :-

[USE_MATERIAL_TEMPLATE:WALRUS:THREAD_PLANT_TEMPLATE]

and

 [THREAD:LOCAL_PLANT_MAT:WALRUS]

You'd get the exact same effect in-game. (though not if you had custom reactions which looked for LOCAL_PLANT_MAT:THREAD)

=======================

You should have no trouble now understanding these two lines from a "millable" plant :-

   [USE_MATERIAL_TEMPLATE:MILL:PLANT_POWDER_TEMPLATE]

   [MILL:LOCAL_PLANT_MAT:MILL]

And These lines from pigtails for the seeds :-

   [USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]

   [SEED:pig tail seed:pig tail seeds:0:0:1:LOCAL_PLANT_MAT:SEED]

=======================

Quarry Bushes cover the rest :-

   [USE_MATERIAL_TEMPLATE:LEAF:LEAF_TEMPLATE]

   [LEAVES:quarry bush leaf:quarry bush leaves:6:7:0:0:0:0:1:LOCAL_PLANT_MAT:LEAF]

To have leaves you can extract. (I think that's "process to bag at farmers workshop")

   [USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]
        [...]
      [MATERIAL_REACTION_PRODUCT:PRESS_LIQUID_MAT:LOCAL_PLANT_MAT:OIL] this line within the definition of Quarry Bush seeds is used to signal they're pressable.

   [USE_MATERIAL_TEMPLATE:OIL:PLANT_OIL_TEMPLATE]    Is where the properties of the oil are defined
   [USE_MATERIAL_TEMPLATE:SOAP:PLANT_SOAP_TEMPLATE]  Defines properties of the soap made from the oil

« Last Edit: February 14, 2012, 03:04:15 pm by Reelya »
Logged

Minnakht

  • Bay Watcher
  • Green Eyed Monster
    • View Profile
Re: Plant reaction questions
« Reply #3 on: February 14, 2012, 03:08:09 pm »

Alright then... could you check this for any problems?

Spoiler (click to show/hide)
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!

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: Plant reaction questions
« Reply #4 on: February 14, 2012, 03:20:59 pm »

Doesn't look like it has any problems with it that are immediately apparent.

I would like to point something out for any future plant modding that you do, (at least with .31, I don't know if this was fixed for .34 or not yet) is that the [VALUE:XX] token is broken and has no effect on the value of a plant. Instead the value of a harvested plant is equal to the [MATERIAL_VALUE:X] of the basic mat for the plant times 2 (so your butterhand bushes would have a value of 2x2=4). Also leaf values will be equal to their material value x2, and threads will be x6. All other plant products are x1 IIRC.
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.

Reelya

  • Bay Watcher
    • View Profile
Re: Plant reaction questions
« Reply #5 on: February 14, 2012, 03:27:04 pm »

Ok, you've made the leaves pressable for BUTTER. Leaves are made by milling the raw plant.

So the process would be mill raw plant => leaves, press the leaves => "butter", then the butter should be usable for making soap.

You just need to load up the game and check the plant's appearing, and acting like you want.

Seems in order.

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: Plant reaction questions
« Reply #6 on: February 14, 2012, 03:30:04 pm »

Ok, you've made the leaves pressable for BUTTER. Leaves are made by milling the raw plant.

So the process would be mill raw plant => leaves, press the leaves => "butter", then the butter should be usable for making soap.

You just need to load up the game and check the plant's appearing, and acting like you want.

Seems in order.
Leaves actually are harvested by the "process plants (to bag)" reaction in the farmer's workshop. Milling is if you want to get a powder.
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.

Reelya

  • Bay Watcher
    • View Profile
Re: Plant reaction questions
« Reply #7 on: February 14, 2012, 03:39:20 pm »

Ok, you've made the leaves pressable for BUTTER. Leaves are made by milling the raw plant.

So the process would be mill raw plant => leaves, press the leaves => "butter", then the butter should be usable for making soap.

You just need to load up the game and check the plant's appearing, and acting like you want.

Seems in order.
Leaves actually are harvested by the "process plants (to bag)" reaction in the farmer's workshop. Milling is if you want to get a powder.

Oops, sorry, if you check my earlier post i did actually say it was "process to bag at farmers workshop" half an hour ago, lack of sleep sorry.
« Last Edit: February 14, 2012, 03:41:03 pm by Reelya »
Logged

Minnakht

  • Bay Watcher
  • Green Eyed Monster
    • View Profile
Re: Plant reaction questions
« Reply #8 on: February 14, 2012, 03:40:53 pm »

That's what I'm worried about. The plant will get processed into leaves going in a bag, then those leaves will be taken out, pressed, and rock nuts also require to be milled first into paste, so there's so much I don't know and can go wrong...

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!

Reelya

  • Bay Watcher
    • View Profile
Re: Plant reaction questions
« Reply #9 on: February 14, 2012, 03:51:42 pm »

That's what I'm worried about. The plant will get processed into leaves going in a bag, then those leaves will be taken out, pressed, and rock nuts also require to be milled first into paste, so there's so much I don't know and can go wrong...
Rock nuts have the [MATERIAL_REACTION_PRODUCT:PRESS_LIQUID_MAT:LOCAL_PLANT_MAT:BUTTER] type thing inside "seeds" not "leaves" section. I imagine the leaves still have to be pressed before turning into oil. But if it doesn't work, try moving your line about BUTTER inside the "SEED" section.

The actual reactions are covered in "reactions_other.txt", just copy how the other plants do it and you can "piggy back" on how it's already done.

The easiest fix is to move [MATERIAL_REACTION_PRODUCT:PRESS_LIQUID_MAT:LOCAL_PLANT_MAT:BUTTER] into the "seeds" of your plant.

For the record, here's the relevant reactions :-

Code: [Select]
[REACTION:MILL_SEEDS_NUTS_TO_PASTE]
[NAME:mill seeds/nuts to paste]
[BUILDING:QUERN:CUSTOM_S]
[BUILDING:MILLSTONE:CUSTOM_S]
[REAGENT:seeds:1:SEEDS:NONE:NONE:NONE][UNROTTEN]
[HAS_MATERIAL_REACTION_PRODUCT:PRESS_LIQUID_MAT] to ensure only worthwhile seeds get used
[PRODUCT:100:1:GLOB:NONE:GET_MATERIAL_FROM_REAGENT:seeds:NONE][PRODUCT_PASTE] makes the glob a "paste"
[SKILL:MILLING]

[REACTION:PRESS_OIL]
[NAME:press liquid from paste]
[BUILDING:SCREW_PRESS:CUSTOM_P]
[REAGENT:paste:1:GLOB:NONE:NONE:NONE]
[HAS_MATERIAL_REACTION_PRODUCT:PRESS_LIQUID_MAT]
[NOT_PRESSED]
[REAGENT:liquid container:1:TOOL:NONE:NONE:NONE]
[EMPTY]
[DOES_NOT_ABSORB]
[PRESERVE_REAGENT]
[HAS_TOOL_USE:LIQUID_CONTAINER]
[DOES_NOT_DETERMINE_PRODUCT_AMOUNT]
[PRODUCT:100:1:LIQUID_MISC:NONE:GET_MATERIAL_FROM_REAGENT:paste:PRESS_LIQUID_MAT][PRODUCT_TO_CONTAINER:liquid container]
[PRODUCT:100:1:GLOB:NONE:GET_MATERIAL_FROM_REAGENT:paste:NONE][PRODUCT_PRESSED]
[SKILL:PRESSING]

Note that the paste reaction expects "SEEDS" as the type. But there's nothing stopping you copying that reaction and making one that expects "LEAVES". or even hacking a copy of the oil making reaction totally to make a quicker pathway. You just have to give your new reaction a new name and make sure to add it to your civilization in entity_default.txt

Minnakht

  • Bay Watcher
  • Green Eyed Monster
    • View Profile
Re: Plant reaction questions
« Reply #10 on: February 14, 2012, 04:00:10 pm »

Like...

Spoiler (click to show/hide)

...this is most likely wrong.

What I know is that butter is actually solid at cave temperature, and it has [STOCKPILE_GLOB], so it should go solid and go be stockpiled. Just as I want it to.
« Last Edit: February 14, 2012, 04:02:08 pm by Minnakht »
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!

Reelya

  • Bay Watcher
    • View Profile
Re: Plant reaction questions
« Reply #11 on: February 14, 2012, 04:16:17 pm »

EDIT: [double post]
« Last Edit: February 15, 2012, 06:27:10 am by Reelya »
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: Plant reaction questions
« Reply #12 on: February 14, 2012, 04:18:42 pm »

get rid of the [NOT_PRESSED] tag, that matches the pastes from the pressing reaction

and i think the object type is "LEAVES" not "LEAF", it's referring to the start of your "  [LEAVES:butterfinger:butterfingers:6:6:0:0:0:0:1:LOCAL_PLANT_MAT:LEAF]"

also, you changed lower-case "paste" to "leaf", that's an internal name, but you left paste in this line :-

 [PRODUCT:100:1:LIQUID_MISC:NONE:GET_MATERIAL_FROM_REAGENT:paste:PRESS_LIQUID_MAT]

"GET_MATERIAL_FROM_REAGENT:XXXX" looks up the local (to this reaction) name XXXX, it should match the name you gave the reagent "leaf", this gets important when you have reactions with more reagents. (also you might need to tell it about the bag the leaves were in, see how all other reactions refer to containers as a reagent)

You need something along these lines for the second reagent :-

[REAGENT:bag:1:BOX:NONE:NONE:NONE] (box is the type for these containers)
      [CONTAINS:leaf] (tells it which reagent is in the container, MUST match the nickname you gave the reagent.
      [PRESERVE_REAGENT] (don't destroy this reagent - in theory ALL reagents could have this tag)
      [DOES_NOT_DETERMINE_PRODUCT_AMOUNT] (don't use the quantity of this reagent as a multiplier on product amount)
« Last Edit: February 14, 2012, 04:22:00 pm by Reelya »
Logged

Minnakht

  • Bay Watcher
  • Green Eyed Monster
    • View Profile
Re: Plant reaction questions
« Reply #13 on: February 15, 2012, 05:09:59 am »

I have successfully made dwarven olive oil in-game. That means everything should work.

Spoiler (click to show/hide)

And yes, the item token for leaves is indeed LEAVES. Checked the wiki again.

When I'm done, would you like to use those ideas? There's a lack of winter plants and deeper caverns plants.
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!