Fix wound surgical state (#94858)

## About The Pull Request

Fixes #94855

Three things

1. We filter incompatible surgical states when removing the wound. I'm
not sure if this contributed to the problem, but it seemed wrong
regardless - At that point we don't really care about incompatible
states since we're removing everything regardless
2. `COMSIG_BODYPART_UPDATING_SURGERY_STATE` was registered before adding
the states, which would cause the act of adding the states to clear the
variable.
3. The signal handler was missing the source arg, so it was removing the
wrong values.

## Changelog

🆑 Melbert
fix: Surgical state applied by wounds no longer persist after fix
/🆑
This commit is contained in:
MrMelbert
2026-01-14 15:14:42 -07:00
committed by GitHub
parent 659f564373
commit 2a9faabcd7
3 changed files with 110 additions and 14 deletions
@@ -131,7 +131,9 @@
/datum/surgery_operation/limb/retract_skin/on_success(obj/item/bodypart/limb)
. = ..()
limb.add_surgical_state(SURGERY_SKIN_OPEN)
// the limb SHOULD either have unclamped or clamped vessels if we're retracting skin
// if it doesn't, some shenanigans happened (likely due to wounds), so we add unclamped if needed - just to be thorough
limb.add_surgical_state(SURGERY_SKIN_OPEN | (LIMB_HAS_SURGERY_STATE(limb, SURGERY_VESSELS_CLAMPED) ? NONE : SURGERY_VESSELS_UNCLAMPED))
limb.remove_surgical_state(SURGERY_SKIN_CUT)
/datum/surgery_operation/limb/retract_skin/abductor