-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Burn just 1 item from a stack when refueling #34641
Conversation
9906dbd
to
f3072b8
Compare
I've changed the approach to address the problems of handling items "by hand" that @BevapDin pointed out. I've restored the moving item code and also set the player to add at least 250 ml of fuel per attempt, to reduce the message spam and time wasted in moving small sources of fuel. The downside of adding fuel in batches is that you cannot easily infer how many small items are being burned during crafting based on the messages. The upside is that using a stack of charcoal to cook a 15 minute recipe takes ~30 minutes when fueling in batches but it takes ~60 minutes if you add charcoal 1 item at a time. I tested burning 2.5 L of charcoal and splintered wood and found that the charcoal burns for 5-10 minutes and the wood burns for 65-70 minutes. I'm still working on the fix for burning items with charges. |
I've got the burning fixed now. I tested by lighting 2 braziers with the same volume of splintered wood (10 items) and charcoal (100 charges). The fires both consumed their fuel within a few seconds of one another and they burned for the same duration as one another. The charcoal fire did not produce any wood ash, but that seems like a relatively minor problem compared to the inaccurate burning rates. |
Obviously, energy isn't gained by converting charcoal to wood, but charcoal should have substantially less volume per energy, because you aren't lugging around all the impurities that are smoked off. The calculation is off if the a volume of wood is effectively giving off the same energy as an equivalent volume of charcoal. The equivalency should be based on however much charcoal 10 splintered wood produces. |
@Zourin2 you can fix that in JSON. They burn the same because charcoal is made of wood: Cataclysm-DDA/data/json/items/ammo.json Lines 780 to 787 in 4fe9a12
|
Interesting. I'll have to look at it more when I have time. Something feels off, but it's not a major issue compared to burning 2000 charcoal for six seconds. :) |
Yeah, it's for sure off now. I think charcoal should be much lighter than wood, since you've removed all of the water weight. The volumetric energy density is probably about the same as wood though. Though I suppose the intrepid survivor could easily grind the charcoal up to make it denser. |
I agree. The volume difference is probably not nearly as substantial as the weight difference. I'll run some tests with various wood types and charcoal yields. I would say the 'gold standard' for burning is a full wood log, as it's not just the most direct raw fuel source, but also pretty much what you'd be converting into charcoal rather than thousands of wood chips. If you're talking wood chips, then I think Tinder is the most relevant fuel conversion. |
Summary
SUMMARY: Bugfixes "Fix stacked fuel consumption during activities"
Purpose of change
Fixes #32890 - all fuel in a stack is consumed during activities and only contributes 1 item's worth to the fire.
Describe the solution
Pull 0.25 L of fuel from the stack at a time. Fix charged item burning calculations.
Describe alternatives you've considered
I've switched to an alternative approach based on initial feedback. I do not have other ideas at this time.
Testing
I set up a brazier, wished for charcoal, set it in a zone I marked as a firewood source, then lit a fire and cooked some food. I made sure that if you have lots of fuel that the stack has the correct amount remaining. I made sure that picking up the only item in a stack works (and the last item when burning through a too-small stack). I made sure having non-flammable items (nails) and liquids in the firewood source didn't alter the behavior.
To test the charged item burning, I compared fuel consumption in a brazier for splintered wood and the same volume of charcoal. I also compared the total burning duration.
Additional context
The item movement code is based on this function before this PR: #31668 instead of updating it to handle item stacks again.