CleverRaven / CleverRaven/Cataclysm-DDA
Some death messages are printed twice
- Dominant language
- C++
- Stars
- 13.1k
- Forks
- 4.6k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 186
Description
### Describe the bug
When you kill a panicked person, or a petrified person, their death message is printed twice
This _may_ be related to guilt assignment, or at the very least the `death_function` field (see Additional context)
### Attach save file
N/A
### Steps to reproduce
1. Create a new world, character, etc
2. Debug a `mon_civilian_panic` aka "panicked person" or a `mon_civilian_stationary` aka "petrified person" and kill it, either directly or by debug -> Map... -> Kill all monsters
3. The death message is printed twice, with the guilt message printed in between
4. Try 1 - 3 having Killer Drive or Uncaring. The guilt message is ommited, so the death message is printed as "The petrified person dies! x 2"
5. Try 1 - 3 with a `mon_mutant_alpha_boss` aka "mutant child", see how the `death_function` message is printed first, and the default monster death message is printed after
### Expected behavior
The death message should only be printed once
### Screenshots
After killing a single panicked person

After killing a single petrified person with the Debug method

After adding the Uncaring trait by Debug, and killing a single petrified person

After trying the same with `mon_mutant_alpha_boss`

### Versions and configuration
- OS: Windows
- OS Version: 10.0.19044.2965 (21H2)
- Game Version: 9437078 [64-bit]
- Graphics Version: Tiles
- Game Language: English [en]
- Mods loaded: [
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
Portal Storms Ignore NPCs [personal_portal_storms],
Slowdown Fungal Growth [no_fungal_growth]
]
### Additional context
This was noticed in #71619 by two people but it wasn't reported as a bug.
I'm guessing it's caused by the presence of the `death_function` field, which is _adding_ a death message, instead of replacing it. Having a `death_function` with no message prints _a_ default monster death message (The %s dies!), and then displays _the_ default monster death message -> the `P` window merges both and displays them as `The %s dies! x 2`. This is the case for the panicked and petrified persons.
However, having a `death_function: message`, such as with the mutant child, causes the custom message to be printed first, then the default monster death message is displayed.
Contributor guide
Research direction
Start by tracing death handling for the mon_civilian_panic and mon_civilian_stationary cases, focusing on how death_function and the default monster death message are processed. Reproduce the issue by killing these monsters through the Debug Map kill-all action, then compare with mon_mutant_alpha_boss. Done means each death displays exactly one message, while a custom death_function message remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100