mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-20 11:40:07 +01:00
## About The Pull Request So, my original goal was just a refactor for the emissive overlays of eyes, as a way to implement the specular emissive introduced by smartkar some time ago, but somehow I found myself dragged into a bigger refactor or cleanup of organ damage, thresholds, failures. One of the main problem was that there were no procs called when a organ suffered enough damage to fail or when recovering from failure. It'd just enable or disable a bitflag, leaving it up to subtypes to decide how to tackle organ failure their own ways: diverse, funky and sometimes incompatible. More often than not relying on their very own "update_thingamajig" kinda procs that run whenever the organ takes damage, rather than just when the threshold is reached (low, high, failure. There are however a couple organs with their own quirky thresholds, I let those slide). There's also a bit of old code, especially for ears, with the `AdjustEarDamage` and temporary deafness both predating the framework for organ damage as far as I know. It really needed a coat of fresh paint. Oh, there were also more than a handful of organs that still heavily relied on some ORGAN_TRAIT source instead of the `organ_traits` list and the two add/remove procs `add_organ_trait` or `remove_organ_trait`. This include organs that lose or gain specific traits when failing et viceversa. ~~Lastly, felinids (and the halloween ghost species) having reflective eyes. It's just a nod to the tapetum lucidum that animals with night vision often have (including cats), which is why their eyes are a bit brighter in the dark. Felinids however, do not have night vision (nor do ghosts). This is merely cosmetic.~~ Cut out for the time being due to issues with the specular emissive... ## Why It's Good For The Game Refactoring / cleaning up old organ code. ## Changelog 🆑 refactor: Refactored organ damage code a little. Hopefully there won't be issues (otherwise report them). /🆑
75 lines
2.9 KiB
Plaintext
75 lines
2.9 KiB
Plaintext
//Head surgery to fix the ears organ
|
|
/datum/surgery/ear_surgery
|
|
name = "Ear surgery"
|
|
requires_bodypart_type = NONE
|
|
organ_to_manipulate = ORGAN_SLOT_EARS
|
|
possible_locs = list(BODY_ZONE_HEAD)
|
|
steps = list(
|
|
/datum/surgery_step/incise,
|
|
/datum/surgery_step/retract_skin,
|
|
/datum/surgery_step/saw,
|
|
/datum/surgery_step/clamp_bleeders,
|
|
/datum/surgery_step/fix_ears,
|
|
/datum/surgery_step/close,
|
|
)
|
|
|
|
//fix ears
|
|
/datum/surgery_step/fix_ears
|
|
name = "fix ears (hemostat)"
|
|
implements = list(
|
|
TOOL_HEMOSTAT = 100,
|
|
TOOL_SCREWDRIVER = 45,
|
|
/obj/item/pen = 25)
|
|
time = 6.4 SECONDS
|
|
|
|
/datum/surgery/ear_surgery/can_start(mob/user, mob/living/carbon/target)
|
|
return target.get_organ_slot(ORGAN_SLOT_EARS) && ..()
|
|
|
|
/datum/surgery_step/fix_ears/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
display_results(
|
|
user,
|
|
target,
|
|
span_notice("You begin to fix [target]'s ears..."),
|
|
span_notice("[user] begins to fix [target]'s ears."),
|
|
span_notice("[user] begins to perform surgery on [target]'s ears."),
|
|
)
|
|
display_pain(target, "You feel a dizzying pain in your head!")
|
|
|
|
/datum/surgery_step/fix_ears/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
|
|
var/obj/item/organ/ears/target_ears = target.get_organ_slot(ORGAN_SLOT_EARS)
|
|
display_results(
|
|
user,
|
|
target,
|
|
span_notice("You succeed in fixing [target]'s ears."),
|
|
span_notice("[user] successfully fixes [target]'s ears!"),
|
|
span_notice("[user] completes the surgery on [target]'s ears."),
|
|
)
|
|
display_pain(target, "Your head swims, but it seems like you can feel your hearing coming back!")
|
|
target_ears.set_organ_damage(0)
|
|
///makes you temporarily deaf for a duration post-surgery
|
|
var/deaf_change = 40 SECONDS - target_ears.temporary_deafness
|
|
target_ears.adjust_temporary_deafness(deaf_change)
|
|
return ..()
|
|
|
|
/datum/surgery_step/fix_ears/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
if(target.get_organ_by_type(/obj/item/organ/brain))
|
|
display_results(
|
|
user,
|
|
target,
|
|
span_warning("You accidentally stab [target] right in the brain!"),
|
|
span_warning("[user] accidentally stabs [target] right in the brain!"),
|
|
span_warning("[user] accidentally stabs [target] right in the brain!"),
|
|
)
|
|
display_pain(target, "You feel a visceral stabbing pain right through your head, into your brain!")
|
|
target.adjustOrganLoss(ORGAN_SLOT_BRAIN, 70)
|
|
else
|
|
display_results(
|
|
user,
|
|
target,
|
|
span_warning("You accidentally stab [target] right in the brain! Or would have, if [target] had a brain."),
|
|
span_warning("[user] accidentally stabs [target] right in the brain! Or would have, if [target] had a brain."),
|
|
span_warning("[user] accidentally stabs [target] right in the brain!"),
|
|
)
|
|
display_pain(target, "You feel a visceral stabbing pain right through your head!") // dunno who can feel pain w/o a brain but may as well be consistent.
|
|
return FALSE
|