Comments (16)
Finally found the exact points affecting how craft command deal with components on map.
When craft command (either from character or from basecamp) is to consume components on map, the function map::use_charges
is called for components count_by_charges
, and map::use_amount
is called for components without charge.
If a furniture/terrain doesn't have the flag LIQUIDCONT
, item in it that is count_by_charges
will not be consumed.
Smoking rack and fermenting vat have the flag SEALED
and don't have the flag LIQUIDCONT
, so water or meat before removing of charges will not be consumed.
There is no such process in map::use_amount
, so meat in somking rack is consumed in craft command now.
diff --git a/src/map.cpp b/src/map.cpp
index 2a70967c05..4803ed2411 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -5965,8 +5965,10 @@ std::list<item> map::use_amount( const std::vector<tripoint> &reachable_pts, con
}
}
for( const tripoint &p : reachable_pts ) {
- std::list<item> tmp = use_amount_square( p, type, quantity, filter );
- ret.splice( ret.end(), tmp );
+ if( accessible_items( p ) ) {
+ std::list<item> tmp = use_amount_square( p, type, quantity, filter );
+ ret.splice( ret.end(), tmp );
+ }
}
return ret;
}
This did fix the issue.
Thought that LIQUIDCONT
is also the reason of items being counted in craft gui, but it did not work the way I expected. More test is needed.
from cataclysm-dda.
Both issues really do sound like a regression. Do you happen to know when approximately this bug was introduced? That could speed up the fix.
from cataclysm-dda.
I tried reproducing on a new save. And it didn't work. I started looking to see what the difference was. I found out that they are different errors.
In this case, the meat is wasted. But it's taken from a working smoking rack.
from cataclysm-dda.
Yeah, I tested it on corn kernels.
from cataclysm-dda.
A sixth sense told me that this bug must be introduced when removing charges from food stuff.
Tested in https://github.com/CleverRaven/Cataclysm-DDA/releases/tag/cdda-experimental-2023-08-02-0307 and reproduced it, while things worked as intended in https://github.com/CleverRaven/Cataclysm-DDA/releases/tag/cdda-experimental-2023-07-31-0609.
Then I tried https://github.com/CleverRaven/Cataclysm-DDA/releases/tag/cdda-experimental-2023-08-02-0110, and the meat chunks out of the rack were consumed, so the reason of this issue should be #67356.
from cataclysm-dda.
CC @mqrause then, the author of the linked PR. Maybe they know what is happening here.
from cataclysm-dda.
A sixth sense told me that this bug must be introduced when removing charges from food stuff. Tested in https://github.com/CleverRaven/Cataclysm-DDA/releases/tag/cdda-experimental-2023-08-02-0307 and reproduced it, while things worked as intended in https://github.com/CleverRaven/Cataclysm-DDA/releases/tag/cdda-experimental-2023-07-31-0609. Then I tried https://github.com/CleverRaven/Cataclysm-DDA/releases/tag/cdda-experimental-2023-08-02-0110, and the meat chunks out of the rack were consumed, so the reason of this issue should be #67356.
I'm not sure I understand the conclusion. If experimental 2023-08-02-0307 merged that PR, but 2023-08-02-0110 already had the issue, the cause should be something different.
from cataclysm-dda.
the meat chunks out of the rack were consumed
Sorry, maybe this sentence is misleading. I mean in 2023-08-02-0110 this issue is not existing, the chunks of meat in the smoking rack did not disappear, and the chunks outside were consumed correctly when crafting cooked meat.
from cataclysm-dda.
20240422-0721-36.6119221.mp4
In 2023-08-02-0110 one chunk outside is consumed (total amount is 101 as the rack duplicated one chunk).
20240422-0731-57.7824247.mp4
In 2023-08-02-0307 the chunk in the rack is consumed (the duplicate bug is fixed so total amount is 100).
from cataclysm-dda.
That's curious. The PR in question just changes the charges count of the items put into the rack. That shouldn't have any effect on component selection for crafting. I suspect the real bug is hiding somewhere in the construction of the crafting inventory and that just surfaced it somehow.
from cataclysm-dda.
Maybe you are right, I'll try to figure it out.
Just found something quite interesting.
If you migrate a save before 2023-08-02-0307 that already has a smoking rack, chunks in it will not be wrongly consumed.
But a new smoking rack built after migrating to 2023-08-02-0307 and newer version causes this issue again.
Wakarusa-trimmed.tar.gz
from cataclysm-dda.
You don't cook meat right. More specifically, you have the wrong kitchen. You need one like this:
Index 1. brazier + plank
Index 2. smoking rack (12ΠΊ charcoal + 80 chunk of meat) (Note. I assume charcoal is optional, but I tested with it.)
Index 3. brazier + plank (Note. Optional. I used for symmetry to eliminate some options.)
Index 4..6 One chunk of meat
You need the following versions of the game:
I don't know how they react to saves. In each version, I started with a clean character and options.
Steps to reproduce
- Build a fire in the braziers
- Create a save
- Start cooking the meat according to the recipe for
cooked meat
. One chunk at a time. (You need a pot or a frying pan.) - Look at the meat lying on the ground
Π°. Versions 2023-07-31-0609. Meat is spent sequentially: 4-5-6. After the meat from point 6 has been spent. The recipe becomes inactive.
b. Versions 2023-07-31-1032. Meat is spent sequentially: 4-5. But at point 6, no meat is wasted. It is taken from the smoking rack
You can load from a save and try different character positions. At the top brazier, at the bottom brazier. Or anywhere else. The meat at point 6 is not wasted.
To summarize
Formally, the bug appeared after switching from charges to individual pieces. #60885
@osuphobia You guessed the "author" @mqrause But I highly doubt that the problem is in fixing it.
Rather in the algorithm of searching for components for crafting. He looks for them from right to left left to right, starting from the upper right left corner. And when he reaches the rack, he finds them.
A possible fix would be to mark the contents of the rack as ignored components.
The only question is what else might qualify. Water in a washing machine? In an autoclave? Charcoal in a smoking rack when creating steel? That is, does it only apply to the smoking rack or is it a more general problem.
from cataclysm-dda.
Tested the water in a home washing machine. It is not wasted in making clean water.
from cataclysm-dda.
@IdleSol
Tested again, you are partly right.
Tools and fuels are irrelevant (for cooked meat shovel is enough), the game just attempts to consume components from the top left to bottom right, searching row by row. (You said right to left)
Functions for crafting seems to treat items with/without charge differently, I'm still viewing them.
from cataclysm-dda.
Oh, I'm confusing right-left again.
from cataclysm-dda.
The only question is what else might qualify. Water in a washing machine? In an autoclave? Charcoal in a smoking rack when creating steel? That is, does it only apply to the smoking rack or is it a more general problem.
Tested wood keg and wood fermenting vat (added brewable data to water so it can be poured into the fermenting vat).
Water in the keg will be consumed when crafting clean water, while water in the vat will not. Water in the keg is counted when checking the recipe in the crafting gui.
So we got three conditions:
- Smoking rack. Components in it will not be counted in the crafting gui, but will be consumed in crafting command.
- Wood keg. Components in it will both be counted in the crafting gui and consumed in crafting command.
- Fermenting vat. Components in it will nether be counted in the crafting gui nor be consumed in crafting command.
For charcoal in a smoking rack, it will not be consumed, as it is loaded in the fake_char_smoker pseudo tool.
Washing machine and autoclave are Appliance/Power Grid things, did not check that part of functions.
from cataclysm-dda.
Related Issues (20)
- Exploit: boiled bandages produce clean water too fast HOT 2
- Enemy become passenger in vehicle when rammed or passed slowly HOT 3
- Bandaging applies better quality than said HOT 1
- Moving (not all) items with charges out of inventory doesn't update weight (AIM)
- Rubik's dialogue line "I'm here to talk about a job." is broken - typo in JSON HOT 1
- Four horse cart is slower than a two horse cart HOT 1
- Zombie clothing not filthy HOT 5
- stamina regains when dodge enemy attacks HOT 1
- linux cataclysm --version and main menu report wrong version in 0.G release HOT 3
- Shattering already shattered armor
- Tests: `guy != nullptr` randomly failing HOT 2
- The game code assumes the map goes up to Z=10, but you can't actually go higher than Z=9 HOT 2
- Bow Shooting Takes Too Long HOT 10
- Arithmetical error crash HOT 4
- Add more heating tools that use alcohol HOT 2
- Can't consume hypnotic drugs. HOT 1
- Make "damaged" medieval weapons be able to be "fixed" HOT 4
- Looted Libraries instead of Burning/Burned Libraries: HOT 3
- Bandits do not bleed to death in no hope HOT 2
- Weighted blankets HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cataclysm-dda.