Files
Bubberstation/code/modules/surgery/cavity_implant.dm
John Willard 3b0794eca9 Surgery code improvements (#71182)
## About The Pull Request

* Changes a lot of things about surgeries to hopefully bring it up to
more modern code standards.
* Removes a ton of single-letter vars used in checking surgeries on
people.
* Makes use of continue/break in for() loops.
* Properly documents the vars on surgeries
* Turns 'ignore clothes', 'self operating', 'lying required', 'require
limb' and 'require real limb' from vars into surgery flags
* Removes a lot re-defines of target_mobtype being set to human, as
that's the base anyways.
* Also tries to organize the vars on each surgery a bit.
* Makes the surgery initiator hopefully a little bit more sane
* Removes the surgery's can_cancel and stomach pump's
accumulated_experience vars, as they were entirely unused.

## Why It's Good For The Game

I looked at surgery code and couldn't stand it, this is hopefully
helping bring it to something we can stand.
This however doesn't touch the individual surgery steps.

## Changelog

im exhausted i don't know if this has in-game effects
2022-11-20 23:22:46 -08:00

82 lines
3.2 KiB
Plaintext

/datum/surgery/cavity_implant
name = "Cavity implant"
possible_locs = list(BODY_ZONE_CHEST)
steps = list(
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/incise,
/datum/surgery_step/handle_cavity,
/datum/surgery_step/close)
//handle cavity
/datum/surgery_step/handle_cavity
name = "implant item"
accept_hand = 1
implements = list(/obj/item = 100)
repeatable = TRUE
time = 32
preop_sound = 'sound/surgery/organ1.ogg'
success_sound = 'sound/surgery/organ2.ogg'
var/obj/item/item_for_cavity
/datum/surgery_step/handle_cavity/tool_check(mob/user, obj/item/tool)
if(tool.tool_behaviour == TOOL_CAUTERY || istype(tool, /obj/item/gun/energy/laser))
return FALSE
return !tool.get_temperature()
/datum/surgery_step/handle_cavity/preop(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
var/obj/item/bodypart/chest/target_chest = target.get_bodypart(BODY_ZONE_CHEST)
item_for_cavity = target_chest.cavity_item
if(tool)
display_results(
user,
target,
span_notice("You begin to insert [tool] into [target]'s [target_zone]..."),
span_notice("[user] begins to insert [tool] into [target]'s [target_zone]."),
span_notice("[user] begins to insert [tool.w_class > WEIGHT_CLASS_SMALL ? tool : "something"] into [target]'s [target_zone]."),
)
display_pain(target, "You can feel something being inserted into your [target_zone], it hurts like hell!")
else
display_results(
user,
target,
span_notice("You check for items in [target]'s [target_zone]..."),
span_notice("[user] checks for items in [target]'s [target_zone]."),
span_notice("[user] looks for something in [target]'s [target_zone]."),
)
/datum/surgery_step/handle_cavity/success(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery = FALSE)
var/obj/item/bodypart/chest/target_chest = target.get_bodypart(BODY_ZONE_CHEST)
if(tool)
if(item_for_cavity || tool.w_class > WEIGHT_CLASS_NORMAL || HAS_TRAIT(tool, TRAIT_NODROP) || isorgan(tool))
to_chat(user, span_warning("You can't seem to fit [tool] in [target]'s [target_zone]!"))
return FALSE
else
display_results(
user,
target,
span_notice("You stuff [tool] into [target]'s [target_zone]."),
span_notice("[user] stuffs [tool] into [target]'s [target_zone]!"),
span_notice("[user] stuffs [tool.w_class > WEIGHT_CLASS_SMALL ? tool : "something"] into [target]'s [target_zone]."),
)
user.transferItemToLoc(tool, target, TRUE)
target_chest.cavity_item = tool
return ..()
else
if(item_for_cavity)
display_results(
user,
target,
span_notice("You pull [item_for_cavity] out of [target]'s [target_zone]."),
span_notice("[user] pulls [item_for_cavity] out of [target]'s [target_zone]!"),
span_notice("[user] pulls [item_for_cavity.w_class > WEIGHT_CLASS_SMALL ? item_for_cavity : "something"] out of [target]'s [target_zone]."),
)
display_pain(target, "Something is pulled out of your [target_zone]! It hurts like hell!")
user.put_in_hands(item_for_cavity)
target_chest.cavity_item = null
return ..()
else
to_chat(user, span_warning("You don't find anything in [target]'s [target_zone]."))
return FALSE