Cataclysm-dda: Unable to craft using water from wooden keg

Created on 27 Nov 2016  路  10Comments  路  Source: CleverRaven/Cataclysm-DDA

Idk if this always worked like that, but here we go:

I have made my first Wooden Keg. Filled it with plenty of water (70). My hopes was that it would use water from the keg automaticaly when I order a recipe that requires water, like clean water, for example.

What is currently happening is that when I make the recipe, it asks for the water (me or nearby). If I choose the water from nearby, the time passes, it says it can't train my cooking more, uses no water from the keg, neither produces the clean water I asked for.

Currently I'm pouring water somewhere else first, then I make my recipes.

Sorry if this is duplicated from some other related bug.

(S2 - Confirmed) <Bug> Crafting / Construction / Recipes

All 10 comments

I've seen this bug with water pumps. The water cannot be directly accessed by the water pump and even if the water is in my inventory, the recipe will indicate no water. Destroy the water pump and magically the water appears in your inventory.

I just opened a similar issue by accident. I'll just paste it here instead.

  • Place two Wooden Keg constructions next to each other.
  • Have one of the two full with regular water, the other one empty.
  • Run a 20x batch job for Clean Water standing next to the Kegs.

You expect one Keg to increase by 20, the other to decrease by 20. However, the dirty water is never subtracted - meaning you get 20 Clean Water for free. I imagine this has something to do with these Kegs having their own interface and not acting exactly like regular containers.

This also doesn't always work. I think it gave me the same message you got when I tried the reaction from Barrels to a Wooden Keg. But if I use 2 Kegs, I can reliably cheat the system.

I've seen this bug with water pumps. The water cannot be directly accessed by the water pump and even if the water is in my inventory, the recipe will indicate no water. Destroy the water pump and magically the water appears in your inventory.

This is probably actually a separate issue related to the way "infinite" charges are stored and calculated in the system. There's another issue related to this, but I'm not going to link it because the OP appears to be a different issue and I don't want this to get ignored accidentally.

the short version of that other bug is that Infinite charges are indicated by maxing the variable (2,147,483,647 charges), and water sources get added together when in the recipe which causes it to overflow into a negative value confusing the system into thinking there are less than 0 charges available.

Why was a limited amount of charges even changed to MAX_INT, anyway? Limited but never draining 50 (or 200, or 2000 if you really want to never encounter the issue) worked just fine and didn't do overflows.

Bug still active. Also it consumes charges if you make the clean water with something that consumes batteries, despite not giving any clean water

Testing steps:
build wooden keg [furniture], load it with some [dirty] water (standing tank untested)
give yourself a a container, load it with some [dirty] water and hold it in inventory
spawn a coffee maker, and load it with batteries
craft 1 clean water from water (nearby) [this is from the keg]
notice you don't get anything afterward, though charges are used from the coffee maker
also notice it didn't consume any of the water from the keg
craft 1 clean water from water [this is from the water on your person]
notice you get the prompt for what to do with your new clean water

Build: 0.C-22236-g867fcd3354
Build date: 2017-05-09

Maybe minimalistic save could help.
save.zip
Go to craft - food - clean water. Hit - multiple times. Time passes, skill rising.

My try.
Not use_charges_from_furn(), nor use_charges_from_stack(), both in map.cpp cannot handle wooden keg.
_Note special case in_:

map.cpp
  use_charges_from_furn( const furn_t &f, const itype_id &type, long &quantity,
                         map *m, const tripoint &p, std::list<item> &ret )
    if( type == "water" && f.examine == &iexamine::toilet )

so

map.cpp
  map::use_charges(const tripoint &origin, const int range,
                   const itype_id type, long &quantity)

cannot use water from wooden keg, so

craft_command.cpp
  craft_command::consume_components()
    crafter->consume_items( it, batch_size )

return empty list, so
used.splice( used.end(), tmp )
gain used as empty list, so in

crafting.cpp
  player::complete_craft()
    if( used.empty() ) {
        return;
    }

return after no items consumed and before results created

Futhermore, use_charges_from_furn handles only water, so if you fill keg with gasoline and try to make Molotovs, the game will successfully craft them, but won't spend any gasoline from the keg.

So we need a full rewrite of use_charges_from_furn so it can handle any liquid from any source, not only water from toilet.

Toilet iexamine function should be probably changed too to act like a keg, like a generic container for liquids.

Similar to issue #22603

This bug is still outstanding. Crafting using liquids in a keg does not work, regardless of recipe; water to clean water, or salt water to salt. Neither work. You still need to withdraw the water first, THEN use it.

Was this page helpful?
0 / 5 - 0 ratings