Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: How to define a new item type?  (Read 2520 times)

Terratoch

  • Bay Watcher
    • View Profile
How to define a new item type?
« on: April 03, 2012, 01:22:20 pm »

Masterwork DF has a brewery which lets you upgrade drinks from whatever to whatever, but it requires a painful level of micromanagement that I'm not willing to go through.

So I was thinking of defining a new reaction that just lets you upgrade drinks in a fashion similar to the way you brew drinks, but the problem that I think I am going to encounter is that DRINK items are not used for anything but cooking, so I don't think that I can use the GET_MATERIAL_FROM_REAGENT token in the product of the reaction and have it work.

So I was thinking of defining a new item type called ROYAL_DRINK or something like that. Where/how do you define new item types, or is that all hard coded and impossible?
Logged
The only thing better than dining on a fine goblin is using said goblins tallow for soap to fix up my soldiers.

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: How to define a new item type?
« Reply #1 on: April 03, 2012, 01:26:00 pm »

Hard coded. You could potentially add a reaction class to all normal drinks though, and then have a reaction that calls for a drink with that reaction class, and then gives out an upgraded drink with a type defined in the entry itself. You can see a sort of example in the domesticating carrots in the modding question thread. (Though you may need to use the search function and a little elbow grease to find it).
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.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: How to define a new item type?
« Reply #2 on: April 03, 2012, 01:34:42 pm »

What part of the micromanaging is too hard for you ? It needs random plants, a drink and sugar. (guess it is the sugar)

You can just copy my raws and remove the reagent to make it more suitable for you. I dont use a custom item type (they dont exist) but a custom plant for this. One for each vanilla plant to be exact.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Terratoch

  • Bay Watcher
    • View Profile
Re: How to define a new item type?
« Reply #3 on: April 03, 2012, 02:15:07 pm »

What part of the micromanaging is too hard for you ? It needs random plants, a drink and sugar. (guess it is the sugar)

You can just copy my raws and remove the reagent to make it more suitable for you. I dont use a custom item type (they dont exist) but a custom plant for this. One for each vanilla plant to be exact.

The micromanagement part that requires 25 of X type of drink, and that has a reaction defined for every X.
I'm just looking to define a reaction that takes 25 of any drink and upgrades it.
Logged
The only thing better than dining on a fine goblin is using said goblins tallow for soap to fix up my soldiers.

Ramirez

  • Bay Watcher
    • View Profile
Re: How to define a new item type?
« Reply #4 on: April 03, 2012, 02:24:02 pm »

What about using the "material reaction product" token to add a second stage of brewing (such as distilling). This process works similarly to the leather tanning process which converts a creatures skin into that creatures leather, which could easily be adapted to turn a plants basic "drink" into an advanced "distillation"

A little example is presented below

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]
[MATERIAL_REACTION_PRODUCT:DISTILL:LOCAL_PLANT_MAT:DISTILL]
[USE_MATERIAL_TEMPLATE:DISTILL:PLANT_ALCOHOL_TEMPLATE]
[STATE_NAME_ADJ:ALL_SOLID:frozen dwarven whiskey]
[STATE_NAME_ADJ:LIQUID:dwarven whiskey]
[STATE_NAME_ADJ:GAS:boiling dwarven whiskey]
[MATERIAL_VALUE:10]
[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]

[REACTION:DISTILL]
[NAME:distill alcohol]
[STILL:CUSTOM_D]
[REAGENT:A:1:DRINK:NONE:NONE:NONE]
[HAS_MATERIAL_REACTION_PRODUCT:DISTILL]
[REAGENT:B:1:NONE:NONE:NONE:NONE][EMPTY][PRESERVE_REAGENT][FOOD_STORAGE_CONTAINER][DOES_NOT_DETERMINE_PRODUCT_AMOUNT]
[PRODUCT:100:1:DRINK:NONE:GET_MATERIAL_FROM_REAGENT:A:DISTILL][PRODUCT_TO_CONTAINER:B]
[SKILL:BREWER]

I haven't tested the above code, but it should in theory allow dwarved ale from pig tails to be distilled in a further process to produce a more valuable booze, but I haven't tested it yet.
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: How to define a new item type?
« Reply #5 on: April 03, 2012, 02:31:53 pm »

Quote
The micromanagement part that requires 25 of X type of drink, and that has a reaction defined for every X.I'm just looking to define a reaction that takes 25 of any drink and upgrades it.

But.. but... WHY ?

Anyway, this is super easy to do, just replace the plant-ID in the reagent with NONE and the plant-ID in the product with GET_MATERIAL_FROM_REAGENT:name:  This way you can take any drink and refine it to its better version.

PS: The reaction with drink and distill looks mighty fancy to me.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Terratoch

  • Bay Watcher
    • View Profile
Re: How to define a new item type?
« Reply #6 on: April 03, 2012, 02:56:46 pm »

Quote
The micromanagement part that requires 25 of X type of drink, and that has a reaction defined for every X.I'm just looking to define a reaction that takes 25 of any drink and upgrades it.

But.. but... WHY ?

Anyway, this is super easy to do, just replace the plant-ID in the reagent with NONE and the plant-ID in the product with GET_MATERIAL_FROM_REAGENT:name:  This way you can take any drink and refine it to its better version.

PS: The reaction with drink and distill looks mighty fancy to me.

Yes, yes and it's great to have the option to specify bla bla bla, but for those of us who don't really care which drink gets the upgrade, it would be nice to have that option too.
Logged
The only thing better than dining on a fine goblin is using said goblins tallow for soap to fix up my soldiers.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: How to define a new item type?
« Reply #7 on: April 03, 2012, 03:03:19 pm »

Ok, I noted it down in my to-do list. I am just curious why you did not just suggested this in the mod thread. I take feedback seriously and act acording to it. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Terratoch

  • Bay Watcher
    • View Profile
Re: How to define a new item type?
« Reply #8 on: April 03, 2012, 03:13:19 pm »

...
...
i did.
it's on the wiki, under suggestions.
Logged
The only thing better than dining on a fine goblin is using said goblins tallow for soap to fix up my soldiers.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: How to define a new item type?
« Reply #9 on: April 03, 2012, 03:21:49 pm »

 :-\

In that case have my apologies. I have the distinct feeling that I might have the same comment twice in my list now...
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: How to define a new item type?
« Reply #10 on: April 03, 2012, 09:23:32 pm »

Changelog for V1.7.1
 - Added generic brewery reaction to refine any drink, instead of a specific one.

Will be uploaded shortly.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Terratoch

  • Bay Watcher
    • View Profile
Re: How to define a new item type?
« Reply #11 on: April 04, 2012, 08:33:24 am »

Changelog for V1.7.1
 - Added generic brewery reaction to refine any drink, instead of a specific one.

Will be uploaded shortly.

Hooray! Myself and lazy slobs like me everywhere give you our thanks. Continue the great work.
Logged
The only thing better than dining on a fine goblin is using said goblins tallow for soap to fix up my soldiers.