Skip to content

Fix muddy skull being unobtainable after dying with it - #1183

Merged
GregHib merged 1 commit into
GregHib:mainfrom
HarleyGilpin:bug/fix-skull-during-restless-ghost
Aug 18, 2026
Merged

Fix muddy skull being unobtainable after dying with it#1183
GregHib merged 1 commit into
GregHib:mainfrom
HarleyGilpin:bug/fix-skull-during-restless-ghost

Conversation

@HarleyGilpin

Copy link
Copy Markdown
Contributor

Bug

Dying while carrying the muddy skull during The Restless Ghost permanently blocks the quest.

The rocks at the mining spot track whether the skull has been taken with the rocks_restless_ghost player var, and it was only reset from a playerDeath handler:

playerDeath {
    if (!ownsItem("muddy_skull")) {
        set("rocks_restless_ghost", "skull")
    }
}

Death.killed(player) runs synchronously in PlayerDeath before dropItems, so the skull is still in the inventory when the handler runs, ownsItem returns true and the var is never reset. The skull then drops to the gravestone, and once that expires searching the rocks only replies "You already have the ghost's skull." The quest dead-ends at found_skull because the coffin requires the skull to be carried.

Fix

Make ownership authoritative at search time rather than depending on death-hook ordering:

  • Extracted the take logic into Player.takeSkull().
  • Searching the emptied rocks now checks ownsItem("muddy_skull") (inventory, equipment, bank, beast of burden) and hands the skull back when the player no longer owns one.
  • Removed the ineffective playerDeath handler. The destroyed handler stays so the rocks visually refill immediately when the skull is destroyed.

This covers every loss path - death, manually dropping it, and an expired gravestone - not just death.

Tests

Two tests added to RestlessGhostQuest:

  • Search the rocks again after losing the skull on death - take the skull, die in the wilderness so it is dropped rather than kept, then re-search the rocks and get it back.
  • Rocks stay empty while still carrying the skull - no duplicate skull while one is held.

The first test fails without the fix. All three tests in the class pass with it.

The rocks at the mining spot tracked whether the skull had been taken
with the `rocks_restless_ghost` player var, and only reset it from a
`playerDeath` handler that checked `ownsItem("muddy_skull")`.

`Death.killed` runs synchronously before `dropItems`, so the skull was
still in the inventory when that handler ran and the var was never
reset. The skull then dropped to the gravestone and, once that expired,
searching the rocks only replied "You already have the ghost's skull."
- leaving the quest stuck at `found_skull` because the coffin requires
the skull to be carried.

Make ownership authoritative at search time instead: searching the
emptied rocks now hands the skull back whenever the player no longer
owns one, which covers death, manually dropping it and an expired
gravestone alike. The ineffective death handler is removed; the
`destroyed` handler stays so the rocks visually refill straight away.
@GregHib
GregHib merged commit 820edfb into GregHib:main Aug 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants