mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-14 02:43:16 +00:00
## About The Pull Request Fixes #74326 Did a little uwupsie in #74227 - While writing up the PR body, I moved around some tested code to better follow the logic flow of the procs. And in the process that tested code was now in an untested position. Parent call from `/obj/item/organ/internal/brain/Insert()` to `/obj/item/organ/proc/Insert()` calls the `/obj/item/organ/proc/on_insert()` proc. This proc moves the organ to nullspace immediately. So one of my commits moving the brain loc check from pre-parent call to post-parent call meant the entire system broke, because the brain was moved to nullspace and lost any reference to its former head. Since `on_insert()` is the proc that handles moving the brain to nullspace, and is a proc only run when an insert is successful, I can sneak the code moving the brainmob from the head bodypart back into the brain on the brain's `on_insert()` before the parent call. This broadly makes the order of operations: Attempt to insert brain, calling `Insert()` If successful, call `on_insert()` as parent of parent proc call chain. In `on_insert()`, set the brain's state up for the brainmob properly. Back up the chain for the brain's child proc of `Insert()` all the code now works properly because the brainmob's state was set up from `on_insert()` which has to have been called already to reach this point. The rest of that code still needs to sit in `/obj/item/organ/internal/brain/Insert()` for now. This is because the key transfer portion has to be preceded by the "is the target body a ling?" code. This code relies on the bespoke `no_id_transfer` param on `/obj/item/organ/internal/brain/Insert()` and fussing around with adding a brain-specific param to the base `/obj/item/organ/proc/Insert(mob/living/carbon/receiver, special = FALSE, drop_if_replaced = TRUE)` proc is OOP gone wild. Honestly, the entire thing needs a refactor but don't nobody got the time to do that. In testing I sheared a person's head off and reattached it via surgery a few times. It worked. Ghosted out before surgery and could re-enter body. DC'ed after having head cut off and could still re-enter body. Seems to work. ## Why It's Good For The Game Feeeeeeeeex. ## Changelog 🆑 fix: Actually fixes re-attaching heads unintentionally sending brains to the gem room this time. For realsies. /🆑