Files
Bubberstation/code/modules/surgery/surgery.dm
Ryll Ryll 0f6496a55c [READY] Adds Medical Wounds: Bamboo Bones and the Skin of Your Teeth (#50558)
About The Pull Request

This PR adds medical wounds, new forms of injuries that people can suffer that cause debilitation and complications, and often require more than what can be found in a medkit to treat. But let's be honest, big complicated walls of text about medical changes make people's eyes glaze over easily- so I created a handy infograph to explain the basics!

Also there's a full guide here!

dreamseeker_2020-04-18_20-42-19.png

The infograph may not be fully up to date with the specifics of the PR's status, but it'll be updated along with major changes so people have something to use as a crash course for familiarizing themselves with how wounds function. I also have another infograph with all 9 of the possible initial wounds coming, and will be up soon. You can also find the longform design doc here with more info on the broad details, including descriptions of treatments: hackmd whee
What this does

There's a lot to cover, but here's the bullet points of the main features and changes:

    Getting lots of damage on a limb can result in wounds, with more damage causing worse wounds. These can range from dislocated joints and minor cuts to compound fractures and fourth degree burns, and can affect you in different ways depending on what bodypart they're applied to (namely with broken bones).
    You can damage individual bodyparts on clothing (only jumpsuits for now) through the use of lasers and sharp weapons. Bodyparts that reach max damage are considered "shredded" and will not apply any protection for that zone until it is repaired with cloth. If all zones are disabled, the entire piece of clothing is shredded and unwearable until repaired with 3 cloth. Jumpsuits give a small amount of wound protection, and since sharp weapons and lasers generally get extra wound bonuses against bare flesh, even a plain jumpsuit provides decent protection from a few laser shots or scalpel stabs.
    Lasers gain a powerful niche versus unarmored/lightly armored carbons! As noted above, lasers can shred clothing and burn away zones of jumpsuits in 2 shots each, after which the target's bare flesh is exposed (barring other clothing), and lasers excel at dealing burn wounds against uncovered skin. Think big, nasty charring!
    Bleeding is now totally limb based, and gauze is as well. Bleeding is also 95% cut wound based, meaning sharp weapons make you bleed rather than just having 40+ brute on a limb.
    The more wounds and damage you get on a bodypart, the easier it'll be to gain more severe wounds. Wounds are arranged from Moderate, to Severe, to Critical in increasing severity, and you'll generally have to suffer the lesser ones before getting the worse ones.

dreamseeker_2020-05-15_03-15-59.png
Above: Someone having an incredibly bad day from bloodloss

dreamseeker_2020-05-04_22-29-29.png
Above: Scars from healed wounds

ShareX_2020-05-15_06-55-20.png
Above: Actual combat involving someone's head getting cracked

Here's a quick, if non-exhaustive, list of things I have left to do before I consider it feature complete

Finish adding treatments for each wound type/severity (mostly surgeries/triage for critical wounds)
Add second winds for bad injuries to give the victim a chance to get away
Flesh out severe & critical injuries in general
Find sprites for the bonesetter, bone gel, and anything else that might be needed
Add the medical items for treating the less severe wounds to the station
Polish code and remove any redundancies I left behind

    Quick balance pass to make sure nothing is horribly abuseable

Why It's Good For The Game

Adds a flexible new system for representing damage on carbons with injuries that can be treated in different ways. Moderate wounds from getting toolboxed or sliced with a scalpel can usually be treated by a buddy or even by yourself with the right tools, but getting flayed with a fireaxe or a laser gun emptied into your bare skin may require extra attention or even surgery in bad cases! Also makes laser guns cooler and more like 40k lasguns that can flash fry people (cool!)

This should also make spessmen more resilient and harder to kill outright, while still adding consequences and complications to getting hurt. Wounds aren't immediately fatal, but they can do things like slow down interactions, deal damage over time through infections, and generally make you more fragile until fixed. They can also give you a "second wind" on being applied that gives you a small adrenaline boost (or whatever) to help disengage and escape immediate danger.
Changelog

🆑 Ryll/Shaps
add: Introduces medical wounds, new injuries that can happen to fleshy carbons when they sustain lots of damage on a bodypart. There's quite a lot of change here, but you can read the guide at: https://tgstation13.org/wiki/Guide_to_wounds and an extended changelog is available here: https://hackmd.io/l_FI9b3tSqa_woDadewJXA
add: Introduces scars and temporal scarring! Healing a wound leaves a scar behind that can be seen by examining someone twice rapidly, and if Temporal Scarring is enabled in character prefs, surviving a round with scars will save them to be granted at roundstart another round! Let your body tell stories!
tweak: Bleeding is now fully bodypart-focused, and 95% of bleeding comes from cut wounds from sharp weapons. Gauze is applied on a limb-by-limb basis, and helps staunch bloodflow rather than totally stop it. Notably, you no longer bleed just from having 40+ brute damage on a limb.
del: Organic bodyparts are no longer disabled at maximum damage, but are easier to cause wounds to
add: O2 medkits in emergency lockers have been replaced with new emergency medkits with basic tools for diagnosing and treating wounds and basic damage
tweak: Herapin now rapidly increases bleeding on all open cuts, rather than causing bleeding by itself. The more cuts on the target, the more it will affect them.
tweak: Neckgrab table slams now hit the targeted limb rather than just the head, with a large chance to dislocate or break a bone
tweak: Sharp weapons and burning weapons can now shred zones on jumpsuits, disabling protection on that limb. Damaged clothes can be repaired with cloth.
tweak: Slaughter demons now deal less raw damage, but gain the ability to cause cut wounds, which becomes more powerful with each attack on a humanoid but resets when bloodcrawling.
/🆑
2020-06-12 23:47:33 +12:00

177 lines
6.6 KiB
Plaintext

/datum/surgery
var/name = "surgery"
var/desc = "surgery description"
var/status = 1
var/list/steps = list() //Steps in a surgery
var/step_in_progress = FALSE //Actively performing a Surgery
var/can_cancel = TRUE //Can cancel this surgery after step 1 with cautery
var/list/target_mobtypes = list(/mob/living/carbon/human) //Acceptable Species
var/location = BODY_ZONE_CHEST //Surgery location
var/requires_bodypart_type = BODYPART_ORGANIC //Prevents you from performing an operation on incorrect limbs. 0 for any limb type
var/list/possible_locs = list() //Multiple locations
var/ignore_clothes = FALSE //This surgery ignores clothes
var/mob/living/carbon/target //Operation target mob
var/obj/item/bodypart/operated_bodypart //Operable body part
var/datum/wound/operated_wound //The actual wound datum instance we're targeting
var/datum/wound/targetable_wound //The wound type this surgery targets
var/requires_bodypart = TRUE //Surgery available only when a bodypart is present, or only when it is missing.
var/speed_modifier = 0 //Step speed modifier
var/requires_real_bodypart = FALSE //Some surgeries don't work on limbs that don't really exist
var/lying_required = TRUE //Does the vicitm needs to be lying down.
var/self_operable = FALSE //Can the surgery be performed on yourself.
var/requires_tech = FALSE //handles techweb-oriented surgeries, previously restricted to the /advanced subtype (You still need to add designs)
var/replaced_by //type; doesn't show up if this type exists. Set to /datum/surgery if you want to hide a "base" surgery (useful for typing parents IE healing.dm just make sure to null it out again)
/datum/surgery/New(surgery_target, surgery_location, surgery_bodypart)
..()
if(surgery_target)
target = surgery_target
target.surgeries += src
if(surgery_location)
location = surgery_location
if(surgery_bodypart)
operated_bodypart = surgery_bodypart
if(targetable_wound)
operated_wound = operated_bodypart.get_wound_type(targetable_wound)
operated_wound.attached_surgery = src
/datum/surgery/Destroy()
if(operated_wound)
operated_wound.attached_surgery = null
if(target)
target.surgeries -= src
target = null
operated_bodypart = null
return ..()
/datum/surgery/proc/can_start(mob/user, mob/living/patient) //FALSE to not show in list
. = TRUE
if(replaced_by == /datum/surgery)
return FALSE
// True surgeons (like abductor scientists) need no instructions
if(HAS_TRAIT(user, TRAIT_SURGEON) || HAS_TRAIT(user.mind, TRAIT_SURGEON))
if(replaced_by) // only show top-level surgeries
return FALSE
else
return TRUE
if(!requires_tech && !replaced_by)
return TRUE
if(requires_tech)
. = FALSE
if(iscyborg(user))
var/mob/living/silicon/robot/R = user
var/obj/item/surgical_processor/SP = locate() in R.module.modules
if(SP) //no early return for !SP since we want to check optable should this not exist.
if(replaced_by in SP.advanced_surgeries)
return FALSE
if(type in SP.advanced_surgeries)
return TRUE
var/turf/T = get_turf(patient)
//Get the relevant operating computer
var/obj/machinery/computer/operating/opcomputer
var/obj/structure/table/optable/table = locate(/obj/structure/table/optable, T)
if(table?.computer)
opcomputer = table.computer
else
var/obj/machinery/stasis/the_stasis_bed = locate(/obj/machinery/stasis, T)
if(the_stasis_bed?.op_computer)
opcomputer = the_stasis_bed.op_computer
if(!opcomputer)
return
if(opcomputer.machine_stat & (NOPOWER|BROKEN))
return .
if(replaced_by in opcomputer.advanced_surgeries)
return FALSE
if(type in opcomputer.advanced_surgeries)
return TRUE
/datum/surgery/proc/next_step(mob/user, intent)
if(location != user.zone_selected)
return FALSE
if(step_in_progress)
return TRUE
var/try_to_fail = FALSE
if(intent == INTENT_DISARM)
try_to_fail = TRUE
var/datum/surgery_step/S = get_surgery_step()
if(S)
var/obj/item/tool = user.get_active_held_item()
if(S.try_op(user, target, user.zone_selected, tool, src, try_to_fail))
return TRUE
if(tool && tool.item_flags & SURGICAL_TOOL) //Just because you used the wrong tool it doesn't mean you meant to whack the patient with it
to_chat(user, "<span class='warning'>This step requires a different tool!</span>")
return TRUE
return FALSE
/datum/surgery/proc/get_surgery_step()
var/step_type = steps[status]
return new step_type
/datum/surgery/proc/get_surgery_next_step()
if(status < steps.len)
var/step_type = steps[status + 1]
return new step_type
else
return null
/datum/surgery/proc/complete()
SSblackbox.record_feedback("tally", "surgeries_completed", 1, type)
qdel(src)
/datum/surgery/advanced
name = "advanced surgery"
requires_tech = TRUE
/obj/item/disk/surgery
name = "Surgery Procedure Disk"
desc = "A disk that contains advanced surgery procedures, must be loaded into an Operating Console."
icon_state = "datadisk1"
custom_materials = list(/datum/material/iron=300, /datum/material/glass=100)
var/list/surgeries
/obj/item/disk/surgery/debug
name = "Debug Surgery Disk"
desc = "A disk that contains all existing surgery procedures."
icon_state = "datadisk1"
custom_materials = list(/datum/material/iron=300, /datum/material/glass=100)
/obj/item/disk/surgery/debug/Initialize()
. = ..()
surgeries = list()
var/list/req_tech_surgeries = subtypesof(/datum/surgery)
for(var/i in req_tech_surgeries)
var/datum/surgery/beep = i
if(initial(beep.requires_tech))
surgeries += beep
//INFO
//Check /mob/living/carbon/attackby for how surgery progresses, and also /mob/living/carbon/attack_hand.
//As of Feb 21 2013 they are in code/modules/mob/living/carbon/carbon.dm, lines 459 and 51 respectively.
//Other important variables are var/list/surgeries (/mob/living) and var/list/internal_organs (/mob/living/carbon)
// var/list/bodyparts (/mob/living/carbon/human) is the LIMBS of a Mob.
//Surgical procedures are initiated by attempt_initiate_surgery(), which is called by surgical drapes and bedsheets.
//TODO
//specific steps for some surgeries (fluff text)
//more interesting failure options
//randomised complications
//more surgeries!
//add a probability modifier for the state of the surgeon- health, twitching, etc. blindness, god forbid.
//helper for converting a zone_sel.selecting to body part (for damage)
//RESOLVED ISSUES //"Todo" jobs that have been completed
//combine hands/feet into the arms - Hands/feet were removed - RR
//surgeries (not steps) that can be initiated on any body part (corresponding with damage locations) - Call this one done, see possible_locs var - c0