Files
Bubberstation/code/modules/surgery/tools.dm
Watermelon914 375a20e49b Refactors most spans into span procs (#59645)
Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs.
Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines.

Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing.
Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc.

(Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
2021-06-14 13:03:53 -07:00

415 lines
15 KiB
Plaintext

/obj/item/retractor
name = "retractor"
desc = "Retracts stuff."
icon = 'icons/obj/surgery.dmi'
icon_state = "retractor"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
inhand_icon_state = "clamps"
custom_materials = list(/datum/material/iron=6000, /datum/material/glass=3000)
flags_1 = CONDUCT_1
item_flags = SURGICAL_TOOL
w_class = WEIGHT_CLASS_TINY
tool_behaviour = TOOL_RETRACTOR
toolspeed = 1
/obj/item/retractor/augment
desc = "Micro-mechanical manipulator for retracting stuff."
toolspeed = 0.5
/obj/item/hemostat
name = "hemostat"
desc = "You think you have seen this before."
icon = 'icons/obj/surgery.dmi'
icon_state = "hemostat"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
inhand_icon_state = "clamps"
custom_materials = list(/datum/material/iron=5000, /datum/material/glass=2500)
flags_1 = CONDUCT_1
item_flags = SURGICAL_TOOL
w_class = WEIGHT_CLASS_TINY
attack_verb_continuous = list("attacks", "pinches")
attack_verb_simple = list("attack", "pinch")
tool_behaviour = TOOL_HEMOSTAT
toolspeed = 1
/obj/item/hemostat/augment
desc = "Tiny servos power a pair of pincers to stop bleeding."
toolspeed = 0.5
/obj/item/cautery
name = "cautery"
desc = "This stops bleeding."
icon = 'icons/obj/surgery.dmi'
icon_state = "cautery"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
inhand_icon_state = "cautery"
custom_materials = list(/datum/material/iron=2500, /datum/material/glass=750)
flags_1 = CONDUCT_1
item_flags = SURGICAL_TOOL
w_class = WEIGHT_CLASS_TINY
attack_verb_continuous = list("burns")
attack_verb_simple = list("burn")
tool_behaviour = TOOL_CAUTERY
toolspeed = 1
/obj/item/cautery/ignition_effect(atom/A, mob/user)
. = span_notice("[user] touches the end of [src] to \the [A], igniting it with a puff of smoke.")
/obj/item/cautery/augment
desc = "A heated element that cauterizes wounds."
toolspeed = 0.5
/obj/item/cautery/advanced
name = "searing tool"
desc = "It projects a high power laser used for medical applications."
icon = 'icons/obj/surgery.dmi'
icon_state = "cautery_a"
hitsound = 'sound/items/welder.ogg'
toolspeed = 0.7
light_system = MOVABLE_LIGHT
light_range = 1
light_color = COLOR_SOFT_RED
/obj/item/cautery/advanced/attack_self(mob/user)
playsound(get_turf(user), 'sound/weapons/tap.ogg', 50, TRUE)
if(tool_behaviour == TOOL_CAUTERY)
tool_behaviour = TOOL_DRILL
to_chat(user, span_notice("You dilate the lenses of [src], it is now in drilling mode."))
icon_state = "surgicaldrill_a"
else
tool_behaviour = TOOL_CAUTERY
to_chat(user, span_notice("You focus the lenses of [src], it is now in mending mode."))
icon_state = "cautery_a"
/obj/item/cautery/advanced/examine()
. = ..()
. += " It's set to [tool_behaviour == TOOL_CAUTERY ? "mending" : "drilling"] mode."
/obj/item/surgicaldrill
name = "surgical drill"
desc = "You can drill using this item. You dig?"
icon = 'icons/obj/surgery.dmi'
icon_state = "drill"
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
hitsound = 'sound/weapons/circsawhit.ogg'
custom_materials = list(/datum/material/iron=10000, /datum/material/glass=6000)
flags_1 = CONDUCT_1
item_flags = SURGICAL_TOOL
force = 15
w_class = WEIGHT_CLASS_NORMAL
attack_verb_continuous = list("drills")
attack_verb_simple = list("drill")
tool_behaviour = TOOL_DRILL
toolspeed = 1
sharpness = SHARP_POINTY
wound_bonus = 10
bare_wound_bonus = 10
/obj/item/surgicaldrill/Initialize()
. = ..()
AddElement(/datum/element/eyestab)
/obj/item/surgicaldrill/suicide_act(mob/user)
user.visible_message(span_suicide("[user] rams [src] into [user.p_their()] chest! It looks like [user.p_theyre()] trying to commit suicide!"))
addtimer(CALLBACK(user, /mob/living/carbon.proc/gib, null, null, TRUE, TRUE), 25)
user.SpinAnimation(3, 10)
playsound(user, 'sound/machines/juicer.ogg', 20, TRUE)
return (MANUAL_SUICIDE)
/obj/item/surgicaldrill/augment
desc = "Effectively a small power drill contained within your arm. May or may not pierce the heavens."
hitsound = 'sound/weapons/circsawhit.ogg'
w_class = WEIGHT_CLASS_SMALL
toolspeed = 0.5
/obj/item/scalpel
name = "scalpel"
desc = "Cut, cut, and once more cut."
icon = 'icons/obj/surgery.dmi'
icon_state = "scalpel"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
inhand_icon_state = "scalpel"
flags_1 = CONDUCT_1
item_flags = SURGICAL_TOOL
force = 10
w_class = WEIGHT_CLASS_TINY
throwforce = 5
throw_speed = 3
throw_range = 5
custom_materials = list(/datum/material/iron=4000, /datum/material/glass=1000)
attack_verb_continuous = list("attacks", "slashes", "stabs", "slices", "tears", "lacerates", "rips", "dices", "cuts")
attack_verb_simple = list("attack", "slash", "stab", "slice", "tear", "lacerate", "rip", "dice", "cut")
hitsound = 'sound/weapons/bladeslice.ogg'
sharpness = SHARP_EDGED
tool_behaviour = TOOL_SCALPEL
toolspeed = 1
wound_bonus = 15
bare_wound_bonus = 15
/obj/item/scalpel/Initialize()
. = ..()
AddComponent(/datum/component/butchering, 80 * toolspeed, 100, 0)
AddElement(/datum/element/eyestab)
/obj/item/scalpel/augment
desc = "Ultra-sharp blade attached directly to your bone for extra-accuracy."
toolspeed = 0.5
/obj/item/scalpel/suicide_act(mob/user)
user.visible_message(span_suicide("[user] is slitting [user.p_their()] [pick("wrists", "throat", "stomach")] with [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
return (BRUTELOSS)
/obj/item/circular_saw
name = "circular saw"
desc = "For heavy duty cutting."
icon = 'icons/obj/surgery.dmi'
icon_state = "saw"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
hitsound = 'sound/weapons/circsawhit.ogg'
mob_throw_hit_sound = 'sound/weapons/pierce.ogg'
flags_1 = CONDUCT_1
item_flags = SURGICAL_TOOL
force = 15
w_class = WEIGHT_CLASS_NORMAL
throwforce = 9
throw_speed = 2
throw_range = 5
custom_materials = list(/datum/material/iron=1000)
attack_verb_continuous = list("attacks", "slashes", "saws", "cuts")
attack_verb_simple = list("attack", "slash", "saw", "cut")
sharpness = SHARP_EDGED
tool_behaviour = TOOL_SAW
toolspeed = 1
wound_bonus = 15
bare_wound_bonus = 10
/obj/item/circular_saw/Initialize()
. = ..()
AddComponent(/datum/component/butchering, 40 * toolspeed, 100, 5, 'sound/weapons/circsawhit.ogg') //saws are very accurate and fast at butchering
/obj/item/circular_saw/augment
desc = "A small but very fast spinning saw. It rips and tears until it is done."
w_class = WEIGHT_CLASS_SMALL
toolspeed = 0.5
/obj/item/surgical_drapes
name = "surgical drapes"
desc = "Nanotrasen brand surgical drapes provide optimal safety and infection control."
icon = 'icons/obj/surgery.dmi'
icon_state = "surgical_drapes"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
inhand_icon_state = "drapes"
w_class = WEIGHT_CLASS_TINY
attack_verb_continuous = list("slaps")
attack_verb_simple = list("slap")
/obj/item/surgical_drapes/Initialize(mapload)
. = ..()
AddComponent(/datum/component/surgery_initiator, null)
/obj/item/surgical_processor //allows medical cyborgs to scan and initiate advanced surgeries
name = "\improper Surgical Processor"
desc = "A device for scanning and initiating surgeries from a disk or operating computer."
icon = 'icons/obj/device.dmi'
icon_state = "spectrometer"
item_flags = NOBLUDGEON
var/list/advanced_surgeries = list()
/obj/item/surgical_processor/afterattack(obj/item/O, mob/user, proximity)
. = ..()
if(!proximity)
return
if(istype(O, /obj/item/disk/surgery))
to_chat(user, span_notice("You load the surgery protocol from [O] into [src]."))
var/obj/item/disk/surgery/D = O
if(do_after(user, 10, target = O))
advanced_surgeries |= D.surgeries
return TRUE
if(istype(O, /obj/machinery/computer/operating))
to_chat(user, span_notice("You copy surgery protocols from [O] into [src]."))
var/obj/machinery/computer/operating/OC = O
if(do_after(user, 10, target = O))
advanced_surgeries |= OC.advanced_surgeries
return TRUE
return
/obj/item/scalpel/advanced
name = "laser scalpel"
desc = "An advanced scalpel which uses laser technology to cut."
icon = 'icons/obj/surgery.dmi'
icon_state = "scalpel_a"
hitsound = 'sound/weapons/blade1.ogg'
force = 16
toolspeed = 0.7
light_system = MOVABLE_LIGHT
light_range = 1
light_color = LIGHT_COLOR_GREEN
sharpness = SHARP_EDGED
/obj/item/scalpel/advanced/attack_self(mob/user)
playsound(get_turf(user), 'sound/machines/click.ogg', 50, TRUE)
if(tool_behaviour == TOOL_SCALPEL)
tool_behaviour = TOOL_SAW
to_chat(user, span_notice("You increase the power of [src], now it can cut bones."))
set_light_range(2)
force += 1 //we don't want to ruin sharpened stuff
icon_state = "saw_a"
else
tool_behaviour = TOOL_SCALPEL
to_chat(user, span_notice("You lower the power of [src], it can no longer cut bones."))
set_light_range(1)
force -= 1
icon_state = "scalpel_a"
/obj/item/scalpel/advanced/examine()
. = ..()
. += " It's set to [tool_behaviour == TOOL_SCALPEL ? "scalpel" : "saw"] mode."
/obj/item/retractor/advanced
name = "mechanical pinches"
desc = "An agglomerate of rods and gears."
icon = 'icons/obj/surgery.dmi'
icon_state = "retractor_a"
toolspeed = 0.7
/obj/item/retractor/advanced/attack_self(mob/user)
playsound(get_turf(user), 'sound/items/change_drill.ogg', 50, TRUE)
if(tool_behaviour == TOOL_RETRACTOR)
tool_behaviour = TOOL_HEMOSTAT
to_chat(user, span_notice("You configure the gears of [src], they are now in hemostat mode."))
icon_state = "hemostat_a"
else
tool_behaviour = TOOL_RETRACTOR
to_chat(user, span_notice("You configure the gears of [src], they are now in retractor mode."))
icon_state = "retractor_a"
/obj/item/retractor/advanced/examine()
. = ..()
. += " It resembles a [tool_behaviour == TOOL_RETRACTOR ? "retractor" : "hemostat"]."
/obj/item/shears
name = "amputation shears"
desc = "A type of heavy duty surgical shears used for achieving a clean separation between limb and patient. Keeping the patient still is imperative to be able to secure and align the shears."
icon = 'icons/obj/surgery.dmi'
icon_state = "shears"
flags_1 = CONDUCT_1
item_flags = SURGICAL_TOOL
toolspeed = 1
force = 12
w_class = WEIGHT_CLASS_NORMAL
throwforce = 6
throw_speed = 2
throw_range = 5
custom_materials = list(/datum/material/iron=8000, /datum/material/titanium=6000)
attack_verb_continuous = list("shears", "snips")
attack_verb_simple = list("shear", "snip")
sharpness = SHARP_EDGED
custom_premium_price = PAYCHECK_MEDIUM * 14
/obj/item/shears/attack(mob/living/M, mob/living/user)
if(!iscarbon(M) || user.combat_mode)
return ..()
if(user.zone_selected == BODY_ZONE_CHEST)
return ..()
var/mob/living/carbon/patient = M
if(HAS_TRAIT(patient, TRAIT_NODISMEMBER))
to_chat(user, span_warning("The patient's limbs look too sturdy to amputate."))
return
var/candidate_name
var/obj/item/organ/tail_snip_candidate
var/obj/item/bodypart/limb_snip_candidate
if(user.zone_selected == BODY_ZONE_PRECISE_GROIN)
tail_snip_candidate = patient.getorganslot(ORGAN_SLOT_TAIL)
if(!tail_snip_candidate)
to_chat(user, span_warning("[patient] does not have a tail."))
return
candidate_name = tail_snip_candidate.name
else
limb_snip_candidate = patient.get_bodypart(check_zone(user.zone_selected))
if(!limb_snip_candidate)
to_chat(user, span_warning("[patient] is already missing that limb, what more do you want?"))
return
candidate_name = limb_snip_candidate.name
var/amputation_speed_mod = 1
patient.visible_message(span_danger("[user] begins to secure [src] around [patient]'s [candidate_name]."), span_userdanger("[user] begins to secure [src] around your [candidate_name]!"))
playsound(get_turf(patient), 'sound/items/ratchet.ogg', 20, TRUE)
if(patient.stat >= UNCONSCIOUS || HAS_TRAIT(patient, TRAIT_INCAPACITATED)) //if you're incapacitated (due to paralysis, a stun, being in staminacrit, etc.), critted, unconscious, or dead, it's much easier to properly line up a snip
amputation_speed_mod *= 0.5
if(patient.stat != DEAD && patient.jitteriness) //jittering will make it harder to secure the shears, even if you can't otherwise move
amputation_speed_mod *= 1.5 //15*0.5*1.5=11.25, so staminacritting someone who's jittering (from, say, a stun baton) won't give you enough time to snip their head off, but staminacritting someone who isn't jittering will
if(do_after(user, toolspeed * 15 SECONDS * amputation_speed_mod, target = patient))
playsound(get_turf(patient), 'sound/weapons/bladeslice.ogg', 250, TRUE)
if(user.zone_selected == BODY_ZONE_PRECISE_GROIN) //OwO
tail_snip_candidate.Remove(patient)
tail_snip_candidate.forceMove(get_turf(patient))
else
limb_snip_candidate.dismember()
user.visible_message(span_danger("[src] violently slams shut, amputating [patient]'s [candidate_name]."), span_notice("You amputate [patient]'s [candidate_name] with [src]."))
/obj/item/shears/suicide_act(mob/living/carbon/user)
user.visible_message(span_suicide("[user] is pinching [user.p_them()]self with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
var/timer = 1 SECONDS
for(var/obj/item/bodypart/thing in user.bodyparts)
if(thing.body_part == CHEST)
continue
addtimer(CALLBACK(thing, /obj/item/bodypart/.proc/dismember), timer)
addtimer(CALLBACK(GLOBAL_PROC, .proc/playsound, user, 'sound/weapons/bladeslice.ogg', 70), timer)
timer += 1 SECONDS
sleep(timer)
return BRUTELOSS
/obj/item/bonesetter
name = "bonesetter"
desc = "For setting things right."
icon = 'icons/obj/surgery.dmi'
icon_state = "bone setter"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
custom_materials = list(/datum/material/iron=5000, /datum/material/glass=2500)
flags_1 = CONDUCT_1
item_flags = SURGICAL_TOOL
w_class = WEIGHT_CLASS_SMALL
attack_verb_continuous = list("corrects", "properly sets")
attack_verb_simple = list("correct", "properly set")
tool_behaviour = TOOL_BONESET
toolspeed = 1
/obj/item/blood_filter
name = "blood filter"
desc = "For filtering the blood."
icon = 'icons/obj/surgery.dmi'
icon_state = "bloodfilter"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
custom_materials = list(/datum/material/iron=2000, /datum/material/glass=1500, /datum/material/silver=500)
item_flags = SURGICAL_TOOL
w_class = WEIGHT_CLASS_NORMAL
attack_verb_continuous = list("pumps", "siphons")
attack_verb_simple = list("pump", "siphon")
tool_behaviour = TOOL_BLOODFILTER
toolspeed = 1