Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Automatic alcohol brewing  (Read 6626 times)

Urk

  • Bay Watcher
    • View Profile
Automatic alcohol brewing
« on: October 08, 2010, 02:46:01 pm »

Hi, this is my first post to forums, i have been lurking there for some time and playing Dwarf Fortress for hours ... days ... weeks ... months and still every new embark is like something totally new, this game is really something totally epic  :o

Anyway, to the topic. Sometimes I'm busy doing all kinds of cool stuff and forget checking if there is enough barrels and plants for brewing alcohol, and that leads to brewing task to be cancelled and soon all dwarfs are sad and thirsty and drinking from some dirty muddy puddle  :-[

(As a side note i have taken some sips of whiskey while writing this so there may be some typos...  ::))

So i wanted to make things bit more automatic and as there is not yet game mechanism for saying that "always make sure there is x barrels of alcohol in stockpile or if not then issue orders for making some" - i wanted to mod something to ease alcohol production.

So i made reaction to automatically brew plump helmet if there is barrel and plants available, so now its possible to adjust continuous wine brewing by adjusting plant growing and barrel availability.

Just is case someone finds this useful there is code:
Code: [Select]
reaction_autobrew

[OBJECT:REACTION]

[REACTION:AUTOBREW]
        [BUILDING:FASTDISTILL:CUSTOM_A]
        [NAME:automatic wine brewing]

        [REAGENT:A:1:BARREL:NONE:NONE:NONE][EMPTY][PRESERVE_REAGENT]
        [REAGENT:B:5:PLANT:NONE:PLANT_MAT:MUSHROOM_HELMET_PLUMP:NONE]


        [PRODUCT:100:25:DRINK:NONE:PLANT_MAT:MUSHROOM_HELMET_PLUMP:DRINK][PRODUCT_TO_CONTAINER:A]
        [PRODUCT:100:5:SEEDS:NONE:PLANT_MAT:MUSHROOM_HELMET_PLUMP:SEED]

        [SKILL:COOK]
        [AUTOMATIC]

And there is workshop, which is shamelessly copied from drayath Seed Brewing Workshop http://www.bay12forums.com/smf/index.php?topic=62608.msg1436695#msg1436695

Code: [Select]
building_autobrew

[OBJECT:BUILDING]

[BUILDING_WORKSHOP:FASTDISTILL]
   [NAME:Fast Brewery]
   [NAME_COLOR:7:0:1]
   [WORK_LOCATION:2:2]
   [BUILD_LABOR:MASON]
   [BUILD_KEY:NONE]
   [BLOCK:1:0:0:0]
   [BLOCK:2:0:0:0]
   [BLOCK:3:0:0:0]
   [DIM:3:3]
   [TILE:0:1:32:32:246]
   [TILE:0:2:32:32:32]
   [TILE:0:3:32:32:246]
   [COLOR:0:1:0:0:0:0:0:0:6:0:0]
   [COLOR:0:2:0:0:0:0:0:0:0:0:0]
   [COLOR:0:3:0:0:0:0:0:0:6:0:0]
   [TILE:1:1:37:37:32]
   [TILE:1:2:246:32:246]
   [TILE:1:3:32:9:0]
   [COLOR:1:1:6:0:1:6:0:1:0:0:0]
   [COLOR:1:2:6:0:0:0:0:0:6:0:0]
   [COLOR:1:3:0:0:0:6:0:1:6:0:1]
   [TILE:2:1:246:9:9]
   [TILE:2:2:246:32:246]
   [TILE:2:3:32:32:32]
   [COLOR:2:1:3:0:0:6:0:1:6:0:1]
   [COLOR:2:2:6:0:0:0:0:0:6:0:0]
   [COLOR:2:3:0:0:0:0:0:0:0:0:0]
   [TILE:3:1:246:9:9]
   [TILE:3:2:246:0:246]
   [TILE:3:3:11:0:11]
   [COLOR:3:1:3:0:0:6:0:1:6:0:1]
   [COLOR:3:2:6:0:0:2:0:0:6:0:0]
   [COLOR:3:3:7:0:1:2:0:0:7:0:1]
   [BUILD_ITEM:1:NONE:NONE:NONE:NONE][BUILDMAT][WORTHLESS_STONE_ONLY][CAN_USE_ARTIFACT]
   [BUILD_ITEM:3:BARREL:NONE:NONE:NONE][EMPTY][CAN_USE_ARTIFACT]
   [BUILD_ITEM:1:QUERN:NONE:NONE:NONE][CAN_USE_ARTIFACT]

Its so terrible thing to do for dwarf to force him to be without alcohol, how can he manage to get the courage to fight those hideous beast from deep underground while being sober  :-X
Logged

veok

  • Bay Watcher
    • View Profile
Re: Automatic alcohol brewing
« Reply #1 on: October 08, 2010, 03:02:04 pm »

Sounds like you could adjust how often auto-brewing happened by forbidding / claiming the workshop building material, or assigning the workshop to a non-cook dwarf.

*Thumbs up*
Logged

Urk

  • Bay Watcher
    • View Profile
Re: Automatic alcohol brewing
« Reply #2 on: October 08, 2010, 03:48:22 pm »

I have been using (S)suspend work order command to stop auto brewing if i need food more, another method is also to put workshop in room with door and just keep door closed if wanted to.
Logged

Rowanas

  • Bay Watcher
  • I must be going senile.
    • View Profile
Re: Automatic alcohol brewing
« Reply #3 on: October 10, 2010, 05:44:02 pm »

I see the [AUTOMATIC] tag, but could you explain a bit of the nuts and bolts of how this mod works?

Also, I changed cook to brewer, since it IS making alcohol. Also, is the separate reaction file strictly necessary, or would bunging it in reaction_other work just as well. I see no reason why it wouldn't, but my 31.16 skills are a bit weak.
« Last Edit: October 10, 2010, 05:50:49 pm by Rowanas »
Logged
I agree with Urist. Steampunk is like Darth Vader winning Holland's Next Top Model. It would be awesome but not something I'd like in this game.
Unfortunately dying involves the amputation of the entire body from the dwarf.

Urk

  • Bay Watcher
    • View Profile
Re: Automatic alcohol brewing
« Reply #4 on: October 12, 2010, 04:57:09 pm »

Well, to be honest i don't have much knowledge for modding, i just put up something and try it until it works or until i give up  ::)

This tutorial was very helpful http://www.bay12forums.com/smf/index.php?topic=66577.msg1584122#msg1584122

At first i tried to make brewing generic so that it would use any plant and create corresponding drink, but for some reason i couldn't make it work, it just created barrels of "drink". So i simplified it to use only plump helmet and create wine.

Using normal brewery as building would be nice but i don't know what its name, from reaction_other can be found KITCHEN, SOAP_MAKER and TANNER for leatherworking workshop but no brewery?

I think that keeping mods in separate files just makes is easier to copy them to next version of df, or otherwise move around, not necessary though.

If you just copy reaction to reaction_other then change building FASTDISTILL to some other building, which is available (or make FASTDISTILL available), also remember to add reaction to permitted reactions for dwarfs in entity_default.txt
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Automatic alcohol brewing
« Reply #5 on: October 12, 2010, 05:14:01 pm »

In order to support automatic brewing of any eligible plant type, you'd probably need to define a MATERIAL_REACTION_PRODUCT for all brewable plants (likely two - one for drink, and one for seeds). Then, reagent B would become something like "[REAGENT:B:5:PLANT:NONE:NONE:NONE][UNROTTEN][ANY_PLANT_MATERIAL][HAS_MATERIAL_REACTION_PRODUCT:DRINK_MAT]" and the products would become "[PRODUCT:100:25:DRINK:NONE:GET_MATERIAL_FROM_REAGENT:B:DRINK_MAT][PRODUCT_TO_CONTAINER:A]" and "[PRODUCT:100:5:SEEDS:NONE:GET_MATERIAL_FROM_REAGENT:B:SEED_MAT]".

It might be possible to directly use "[HAS_MATERIAL_REACTION_PRODUCT:DRINK]" and "GET_MATERIAL_FROM_REAGENT:B:DRINK"/"GET_MATERIAL_FROM_REAGENT:B:SEED" without adding MATERIAL_REACTION_PRODUCTs to each plant, though I haven't tried.
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.