CleverRaven / CleverRaven/Cataclysm-DDA
Possibly replicated bug with NPCs dropping their weapons
- Dominant language
- C++
- Stars
- 13.2k
- Forks
- 4.6k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 205
Description
# Describe the bug
As described in #45865, NPC for no visible reason drops their weapon.
It might happen both with player-owned NPCs and those belonging to other factions.
Until now, despite a few tries, I was unable to reproduce it.
# Steps To Reproduce
I happened to test some unrelated changes while breakpoint related to this issue triggered.

I think the problem is as such:
NPC when not doing anything might attempt to try to find and equip a better weapon.
Code visits cached inventory, function returns some better weapon.
NPC puts off their current weapon (probably dropping it) and tries to wield a better one
NPC is not allowed to pick up loot, function stops.
Tomorrow, I will probably try to change a chance to trigger this check to once per minute and try to inspect reproducing this bug further.
# Expected behavior
Check whether NPC can actually pick up a better item before dropping the current one
# Versions and configuration
Revision 207a94de84d76354589eab098c06f36a5de0b2d3
Contributor guide
Research direction
Start by reviewing issue #45865 and revision 207a94de84d76354589eab098c06f36a5de0b2d3, then trace the NPC cached-inventory weapon-selection and loot-pickup path described here. Reproduce the weapon drop if possible and confirm that an NPC cannot lose its current weapon when it is unable to pick up the replacement.
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
- 38/100