CleverRaven / CleverRaven/Cataclysm-DDA
Sometimes an in-progress craft must be activated twice to continue it
- Dominant language
- C++
- Stars
- 13.2k
- Forks
- 4.6k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 205
Description
# Describe the bug
The way in which in-progress craft objects track their internal state can lead to a confusing situation where trying to continue the craft once fails, but trying to continue it again succeeds.
# Steps To Reproduce
Steps to reproduce the behaviour:
1. Start a nearby fire.
2. Start a craft that requires some fire charges (in my tests I roasted acorns).
3. Manually interrupt the craft before it completes.
4. Put out the fire, and acquire some other tool (e.g. mess kit) that is an alternative.
5. Activate the craft to continue. See an error message`You no longer have a nearby fire and can't continue crafting`.
6. Activate the craft again. This time it works.
# Expected behaviour
It should succeed on step 5, the first activation.
# Details
The underlying cause is related to the flag `tools_to_continue` in the craft object. This caches the answer to "do I have the (cached selection of) tools to continue?".
When this flag is true, attempting to continue the craft will not ask for tool selections. It just assumes you've already selected and errors if they're absent.
This makes sense for the behaviour when you're just crafting normally and the fire vanishes; in this case you're force to stop, you see that same error message, and that flag is cleared. But if you stop voluntarily then it isn't, so it won't ask for new selections the first time you try to continue. But in that failed first attempt, the flag is cleared, so the second attempt works.
This is a delicate area of the code, and I'm not sure how to fix it without breaking something else.
The simplest solution would just be to change the error message to indicate that you can try again and might be able to select a different tool.
@ifreund your thoughts welcome.
Contributor guide
Research direction
Start by tracing the craft object's tools_to_continue flag through voluntary interruption and the activation path, then reproduce the listed fire-and-acorn scenario. Confirm that the first continuation activation can request an alternative tool and succeeds, without breaking the existing behavior when a fire vanishes during normal crafting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100