fixing runtime errors when removing a brain with skillchips. (#88178)

## About The Pull Request
The organs code changes bundled with the organ fishing PR have broken a
few things, while unveiling a bunch of other problems that flew under
the radar. This concern the first category actually. Anyway, I've also
included a unit test to ensure this won't be an inssue in the future.

## Why It's Good For The Game
Fixing some errors.
This commit is contained in:
Ghom
2024-12-03 18:10:46 -06:00
committed by GitHub
parent ba9e3a0219
commit ee96509686
3 changed files with 30 additions and 8 deletions
+20
View File
@@ -98,3 +98,23 @@
TEST_ASSERT_EQUAL(dummy.get_organ_loss(slot_to_use), test_organ.maxHealth, \
"Mob level \"apply organ damage\" can exceed the [slot_to_use] organ's damage cap with a large maximum supplied.")
dummy.fully_heal(HEAL_ORGANS)
///Allocate a human mob, give 'em a skillchip and a generic trauma, then see if it throws any error when the brain is removed.
/datum/unit_test/chipped_traumatized_brain_removal
/datum/unit_test/chipped_traumatized_brain_removal/Run()
var/mob/living/carbon/human/dummy/dummy = allocate(__IMPLIED_TYPE__)
//add the chip and activate it
var/obj/item/skillchip/basketweaving/chip = new(dummy.loc)
dummy.implant_skillchip(chip, force = TRUE)
TEST_ASSERT(chip.holding_brain, "Skillchip couldn't be implanted successfully, 'holding_brain' is null")
chip.try_activate_skillchip(force = TRUE)
TEST_ASSERT(chip.active, "Skillchip couldn't be activated")
//add a trauma
dummy.gain_trauma_type(BRAIN_TRAUMA_MILD)
var/obj/item/organ/brain = locate() in dummy.organs
brain.forceMove(dummy.loc)
allocated += brain