From 20fbd0e806796775e736ce09914090551e0aa111 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Mon, 19 Jul 2021 18:24:27 -0400 Subject: [PATCH 01/54] piss --- code/__DEFINES/DNA.dm | 28 ++++++++++++----------- code/__DEFINES/admin.dm | 3 +++ code/__DEFINES/components.dm | 8 ++++++- code/__DEFINES/mobs.dm | 10 ++++++-- code/__DEFINES/obj_flags.dm | 5 ++++ code/__DEFINES/status_effects.dm | 6 ++++- code/__DEFINES/tools.dm | 8 ++++++- code/__HELPERS/_logging.dm | 4 ++++ code/__HELPERS/type2type.dm | 18 +++++++++++++-- code/_onclick/other_mobs.dm | 7 ++++-- code/controllers/subsystem/persistence.dm | 24 ++++++++++++++++++- strings/tips.txt | 6 +++++ 12 files changed, 104 insertions(+), 23 deletions(-) diff --git a/code/__DEFINES/DNA.dm b/code/__DEFINES/DNA.dm index ce7688d026eb..21364568356f 100644 --- a/code/__DEFINES/DNA.dm +++ b/code/__DEFINES/DNA.dm @@ -119,23 +119,25 @@ #define MUTCOLORS_PARTSONLY 8 #define NOZOMBIE 9 /// If we want a race to have a standard color (for now this is only polysmorphs) -#define NOCOLORCHANGE 20 +#define NOCOLORCHANGE 10 /// Uses weird leg sprites. Optional for Lizards, required for ashwalkers. Don't give it to other races unless you make sprites for this (see human_parts_greyscale.dmi) -#define DIGITIGRADE 10 -#define NO_UNDERWEAR 11 -#define NOLIVER 12 -#define NOSTOMACH 13 -#define NO_DNA_COPY 14 -#define DRINKSBLOOD 15 -#define NOFLASH 16 +#define DIGITIGRADE 11 +#define NO_UNDERWEAR 12 +#define NOLIVER 13 +#define NOSTOMACH 14 +#define NO_DNA_COPY 15 +#define DRINKSBLOOD 16 +#define NOFLASH 17 /// Use this if you want to change the race's color without the player being able to pick their own color. AKA special color shifting -#define DYNCOLORS 17 +#define DYNCOLORS 18 /// Forced genders -#define AGENDER 18 -#define FGENDER 21 -#define MGENDER 22 +#define AGENDER 19 +#define FGENDER 20 +#define MGENDER 21 /// Do not draw eyes or eyeless overlay -#define NOEYESPRITES 19 +#define NOEYESPRITES 22 +/// If this species can be scarred (fleshy) +#define CAN_SCAR 23 //organ slots #define ORGAN_SLOT_BRAIN "brain" diff --git a/code/__DEFINES/admin.dm b/code/__DEFINES/admin.dm index 7f619bde73d9..e3e787259cd6 100644 --- a/code/__DEFINES/admin.dm +++ b/code/__DEFINES/admin.dm @@ -79,6 +79,9 @@ #define ADMIN_PUNISHMENT_WHISTLE "Whistle" #define ADMIN_PUNISHMENT_CLUWNE "Cluwne" #define ADMIN_PUNISHMENT_MCNUGGET "Nugget" +#define ADMIN_PUNISHMENT_CRACK ":B:oneless" +#define ADMIN_PUNISHMENT_BLEED ":B:loodless" +#define ADMIN_PUNISHMENT_SCARIFY "Scarify" #define AHELP_ACTIVE 1 #define AHELP_CLOSED 2 diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index 93ada4e1f53d..775b7f4a7ed6 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -228,7 +228,13 @@ #define COMSIG_LIVING_STATUS_SLEEP "living_sleeping" //from base of mob/living/Sleeping() (amount, update, ignore) #define COMPONENT_NO_STUN 1 //For all of them -// /mob/living/carbon signals +// /mob/living/carbon physiology signals +#define COMSIG_CARBON_GAIN_WOUND "carbon_gain_wound" //from /datum/wound/proc/apply_wound() (/mob/living/carbon/C, /datum/wound/W, /obj/item/bodypart/L) +#define COMSIG_CARBON_LOSE_WOUND "carbon_lose_wound" //from /datum/wound/proc/remove_wound() (/mob/living/carbon/C, /datum/wound/W, /obj/item/bodypart/L) +///from base of /obj/item/bodypart/proc/attach_limb(): (new_limb, special) allows you to fail limb attachment +#define COMSIG_CARBON_ATTACH_LIMB "carbon_attach_limb" + #define COMPONENT_NO_ATTACH (1<<0) +#define COMSIG_CARBON_REMOVE_LIMB "carbon_remove_limb" //from base of /obj/item/bodypart/proc/drop_limb(special, dismembered) #define COMSIG_CARBON_SOUNDBANG "carbon_soundbang" //from base of mob/living/carbon/soundbang_act(): (list(intensity)) #define COMSIG_CARBON_STATUS_STAMCRIT "living_stamcrit" //from base of mob/living/carbon/enter_stamcrit() diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 846f8a5a4086..24bc562baec6 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -87,6 +87,7 @@ #define BODYPART_NOT_DISABLED 0 #define BODYPART_DISABLED_DAMAGE 1 #define BODYPART_DISABLED_PARALYSIS 2 +#define BODYPART_DISABLED_WOUND 3 #define DEFAULT_BODYPART_ICON_ORGANIC 'icons/mob/human_parts_greyscale.dmi' #define DEFAULT_BODYPART_ICON_ROBOTIC 'icons/mob/augmentation/augments.dmi' @@ -133,12 +134,14 @@ #define TRAUMA_RESILIENCE_BASIC 1 //Curable with chems #define TRAUMA_RESILIENCE_SURGERY 2 //Curable with brain surgery #define TRAUMA_RESILIENCE_LOBOTOMY 3 //Curable with lobotomy -#define TRAUMA_RESILIENCE_MAGIC 4 //Curable only with magic -#define TRAUMA_RESILIENCE_ABSOLUTE 5 //This is here to stay +#define TRAUMA_RESILIENCE_WOUND 4 //Curable by healing the head wound +#define TRAUMA_RESILIENCE_MAGIC 5 //Curable only with magic +#define TRAUMA_RESILIENCE_ABSOLUTE 6 //This is here to stay //Limit of traumas for each resilience tier #define TRAUMA_LIMIT_BASIC 3 #define TRAUMA_LIMIT_SURGERY 2 +#define TRAUMA_LIMIT_WOUND 2 #define TRAUMA_LIMIT_LOBOTOMY 3 #define TRAUMA_LIMIT_MAGIC 3 #define TRAUMA_LIMIT_ABSOLUTE INFINITY @@ -340,3 +343,6 @@ #define WABBAJACK (1<<6) #define SLEEP_CHECK_DEATH(X) sleep(X); if(QDELETED(src) || stat == DEAD) return; + +/// If you examine the same atom twice in this timeframe, we call examine_more() instead of examine() +#define EXAMINE_MORE_TIME 1 SECONDS \ No newline at end of file diff --git a/code/__DEFINES/obj_flags.dm b/code/__DEFINES/obj_flags.dm index c5742f020f19..44e213195e53 100644 --- a/code/__DEFINES/obj_flags.dm +++ b/code/__DEFINES/obj_flags.dm @@ -54,3 +54,8 @@ /// Flags for the pod_flags var on /obj/structure/closet/supplypod #define FIRST_SOUNDS (1<<0) // If it shouldn't play sounds the first time it lands, used for reverse mode + +/// Integrity defines for clothing (not flags but close enough) +#define CLOTHING_PRISTINE 0 // We have no damage on the clothing +#define CLOTHING_DAMAGED 1 // There's some damage on the clothing but it still has at least one functioning bodypart and can be equipped +#define CLOTHING_SHREDDED 2 // The clothing is useless and cannot be equipped unless repaired first \ No newline at end of file diff --git a/code/__DEFINES/status_effects.dm b/code/__DEFINES/status_effects.dm index 1f7ce9f19d5e..ded8343df597 100644 --- a/code/__DEFINES/status_effects.dm +++ b/code/__DEFINES/status_effects.dm @@ -42,7 +42,9 @@ #define STATUS_EFFECT_CREEP /datum/status_effect/creep //Provides immunity to lightburn for darkspawn, does nothing to anyone else //Yogs - #define STATUS_EFFECT_TIME_DILATION /datum/status_effect/time_dilation //Provides immunity to slowdown and halves click-delay/action times //Yogs +#define STATUS_EFFECT_TIME_DILATION /datum/status_effect/time_dilation //Provides immunity to slowdown and halves click-delay/action times //Yogs + +#define STATUS_EFFECT_DETERMINED /datum/status_effect/determined //currently in a combat high from being seriously wounded ///////////// // DEBUFFS // @@ -109,6 +111,8 @@ #define STATUS_EFFECT_CLOUDSTRUCK /datum/status_effect/cloudstruck //blinds and applies an overlay. +#define STATUS_EFFECT_LIMP /datum/status_effect/limp //For when you have a busted leg (or two!) and want additional slowdown when walking on that leg + ///////////// // NEUTRAL // ///////////// diff --git a/code/__DEFINES/tools.dm b/code/__DEFINES/tools.dm index d028041f5a5a..e8635d0f2448 100644 --- a/code/__DEFINES/tools.dm +++ b/code/__DEFINES/tools.dm @@ -9,7 +9,13 @@ #define TOOL_MINING "mining" #define TOOL_SHOVEL "shovel" #define TOOL_HATCHET "hatchet" - +#define TOOL_RETRACTOR "retractor" +#define TOOL_HEMOSTAT "hemostat" +#define TOOL_CAUTERY "cautery" +#define TOOL_DRILL "drill" +#define TOOL_SCALPEL "scalpel" +#define TOOL_SAW "saw" +#define TOOL_BONESET "bonesetter" // If delay between the start and the end of tool operation is less than MIN_TOOL_SOUND_DELAY, // tool sound is only played when op is started. If not, it's played twice. diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index 1bbae3e42ac2..2338c3380280 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -92,6 +92,10 @@ if (CONFIG_GET(flag/log_attack)) WRITE_LOG(GLOB.world_attack_log, "ATTACK: [text]") +/proc/log_wounded(text) + if (CONFIG_GET(flag/log_attack)) + WRITE_LOG(GLOB.world_attack_log, "WOUND: [text]") + /proc/log_manifest(ckey, datum/mind/mind,mob/body, latejoin = FALSE) if (CONFIG_GET(flag/log_manifest)) WRITE_LOG(GLOB.world_manifest_log, "[ckey] \\ [body.real_name] \\ [mind.assigned_role] \\ [mind.special_role ? mind.special_role : "NONE"] \\ [latejoin ? "LATEJOIN":"ROUNDSTART"]") diff --git a/code/__HELPERS/type2type.dm b/code/__HELPERS/type2type.dm index 258e767d4ab9..34c9a43238ac 100644 --- a/code/__HELPERS/type2type.dm +++ b/code/__HELPERS/type2type.dm @@ -339,10 +339,24 @@ /proc/isLeap(y) return ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0)) - +/// For finding out what body parts a body zone covers, the inverse of the below basically +/proc/zone2body_parts_covered(def_zone) + switch(def_zone) + if(BODY_ZONE_CHEST) + return list(CHEST, GROIN) + if(BODY_ZONE_HEAD) + return list(HEAD) + if(BODY_ZONE_L_ARM) + return list(ARM_LEFT, HAND_LEFT) + if(BODY_ZONE_R_ARM) + return list(ARM_RIGHT, HAND_RIGHT) + if(BODY_ZONE_L_LEG) + return list(LEG_LEFT, FOOT_LEFT) + if(BODY_ZONE_R_LEG) + return list(LEG_RIGHT, FOOT_RIGHT) //Turns a Body_parts_covered bitfield into a list of organ/limb names. -//(I challenge you to find a use for this) +//(I challenge you to find a use for this)-I found a use for it!! /proc/body_parts_covered2organ_names(bpc) var/list/covered_parts = list() diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 36c80e15b0a6..79e61ee41e61 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -1,16 +1,19 @@ /* - Humans: + Humans: Adds an exception for gloves, to allow special glove types like the ninja ones. Otherwise pretty standard. */ /mob/living/carbon/human/UnarmedAttack(atom/A, proximity) - if(HAS_TRAIT(A, TRAIT_NOINTERACT)) to_chat(A, "You can't touch things!") return if(!has_active_hand()) //can't attack without a hand. + var/obj/item/bodypart/check_arm = get_active_hand() + if(check_arm && check_arm.is_disabled() == BODYPART_DISABLED_WOUND) + to_chat(src, "The damage in your [check_arm.name] is preventing you from using it! Get it fixed, or at least splinted!") + return to_chat(src, "You look at your arm and sigh.") return diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index a4f4a158411f..4a2bcca3d0ce 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -152,6 +152,7 @@ SUBSYSTEM_DEF(persistence) CollectAntagReputation() SaveRandomizedRecipes() SavePaintings() + SaveScars() /datum/controller/subsystem/persistence/proc/GetPhotoAlbums() var/album_path = file("data/photo_albums.json") @@ -345,4 +346,25 @@ SUBSYSTEM_DEF(persistence) var/json_file = file("data/paintings.json") fdel(json_file) - WRITE_FILE(json_file, json_encode(paintings)) \ No newline at end of file + WRITE_FILE(json_file, json_encode(paintings)) + +/datum/controller/subsystem/persistence/proc/SaveScars() + for(var/i in GLOB.joined_player_list) + var/mob/living/carbon/human/ending_human = get_mob_by_ckey(i) + if(!istype(ending_human) || !ending_human.mind || !ending_human.client || !ending_human.client.prefs || !ending_human.client.prefs.persistent_scars) + continue + + var/mob/living/carbon/human/original_human = ending_human.mind.original_character + if(!original_human || original_human.stat == DEAD || !original_human.all_scars || !(original_human == ending_human)) + if(ending_human.client) // i was told if i don't check this every step of the way byond might decide a client ceases to exist mid proc so here we go + ending_human.client.prefs.scars_list["[ending_human.client.prefs.scars_index]"] = "" + else + for(var/k in ending_human.all_wounds) + var/datum/wound/W = k + W.remove_wound() // so we can get the scars for open wounds + if(!ending_human.client) + return + ending_human.client.prefs.scars_list["[ending_human.client.prefs.scars_index]"] = ending_human.format_scars() + if(!ending_human.client) + return + ending_human.client.prefs.save_character() \ No newline at end of file diff --git a/strings/tips.txt b/strings/tips.txt index afb1787279a1..e4258429bc86 100644 --- a/strings/tips.txt +++ b/strings/tips.txt @@ -259,3 +259,9 @@ Questions? Consult the Wiki: https://wiki.yogstation.net/wiki/Main_Page Questions? Consult the Mentors using the 'MHelp' system. Starving makes you move slower. Be sure to keep fed! As the Chaplain, You can use your bible on the "Altar of God" to choose a variety of religions with special rites. +As a Changeling, your Regenerate Limbs power will quickly heal all of your wounds, but they'll still leave scars. Changelings can use Fleshmend to get rid of scars, or you can ingest Carpotoxin to get rid of them like a normal person. +Stasis beds halt ALL passive life functions, including regeneration. If your patient isn't responding to treatment, especially with cut or burn wounds, try unbuckling them! +Epipens contain a powerful coagulant that drastically reduces bleeding on all open cuts. If you don't have time to properly treat someone with lots of cuts, stick them with a pen to buy some time! +If a patient has an absurd amount of wounds, putting them in cryo will slowly treat all of their wounds simultaneously. +Anything you can light a cigarette with, you can use to cauterize a bleeding wound. Technically, that includes the supermatter. +Moderate and Severe cuts will slowly clot by themselves and don't require immediate attention on their own. Critical cuts will actively get worse with time, and are an immediate threat to the patient's life. \ No newline at end of file From 5d45f754b91ad26512d4c3afbbe580c995054504 Mon Sep 17 00:00:00 2001 From: SomeguyManperson Date: Tue, 3 Aug 2021 16:52:42 -0400 Subject: [PATCH 02/54] second set of files --- code/__DEFINES/wounds.dm | 43 ++ code/datums/armor.dm | 29 +- code/datums/brain_damage/magic.dm | 2 +- code/datums/components/caltrop.dm | 2 +- .../diseases/advance/symptoms/flesh_eating.dm | 3 +- code/datums/martial/sleeping_carp.dm | 8 +- code/datums/mind.dm | 4 + code/datums/status_effects/buffs.dm | 6 +- code/datums/status_effects/status_effect.dm | 4 + code/datums/status_effects/wound_effects.dm | 186 +++++++ code/datums/wounds/_wounds.dm | 320 ++++++++++++ code/datums/wounds/bones.dm | 461 ++++++++++++++++++ code/datums/wounds/burns.dm | 323 ++++++++++++ code/datums/wounds/cuts.dm | 309 ++++++++++++ code/datums/wounds/scars/_scars.dm | 134 +++++ code/game/atoms.dm | 46 ++ code/game/machinery/doors/door.dm | 4 + code/game/objects/items/devices/flashlight.dm | 14 +- code/game/objects/items/devices/scanners.dm | 105 +++- code/game/objects/items/holy_weapons.dm | 3 + code/game/objects/items/kitchen.dm | 4 +- code/game/objects/items/manuals.dm | 14 +- code/game/objects/items/melee/misc.dm | 5 + code/game/objects/items/melee/transforming.dm | 2 + code/game/objects/items/powerfist.dm | 2 +- code/game/objects/items/stacks/medical.dm | 410 ++++++++++------ code/game/objects/items/stacks/stack.dm | 1 + code/game/objects/items/storage/backpack.dm | 5 +- code/game/objects/items/storage/belt.dm | 1 + code/game/objects/items/storage/firstaid.dm | 22 +- code/game/objects/items/storage/toolbox.dm | 1 + code/game/objects/items/twohanded.dm | 5 + code/game/objects/items/weaponry.dm | 4 +- code/game/objects/objs.dm | 5 + .../crates_lockers/closets/utility_closets.dm | 4 +- code/modules/admin/verbs/randomverbs.dm | 57 ++- .../blob/blobstrains/blazing_oil.dm | 2 +- .../blob/blobstrains/cryogenic_poison.dm | 2 +- .../blob/blobstrains/electromagnetic_web.dm | 2 +- .../blob/blobstrains/explosive_lattice.dm | 6 +- .../blob/blobstrains/networked_fibers.dm | 4 +- .../blob/blobstrains/pressurized_slime.dm | 2 +- .../blob/blobstrains/replicating_foam.dm | 2 +- .../blob/blobstrains/shifting_fragments.dm | 2 +- .../blob/blobstrains/synchronous_mesh.dm | 2 +- .../changeling/powers/fleshmend.dm | 2 +- .../changeling/powers/mutations.dm | 2 + .../changeling/powers/regenerate.dm | 3 + code/modules/antagonists/cult/cult_items.dm | 6 +- code/modules/antagonists/cult/ritual.dm | 2 +- code/modules/mob/living/carbon/human/human.dm | 4 +- .../mob/living/carbon/human/human_defense.dm | 2 +- code/modules/mob/living/carbon/human/life.dm | 4 +- yogstation.dme | 7 + 54 files changed, 2384 insertions(+), 220 deletions(-) create mode 100644 code/__DEFINES/wounds.dm create mode 100644 code/datums/status_effects/wound_effects.dm create mode 100644 code/datums/wounds/_wounds.dm create mode 100644 code/datums/wounds/bones.dm create mode 100644 code/datums/wounds/burns.dm create mode 100644 code/datums/wounds/cuts.dm create mode 100644 code/datums/wounds/scars/_scars.dm diff --git a/code/__DEFINES/wounds.dm b/code/__DEFINES/wounds.dm new file mode 100644 index 000000000000..b993429961dc --- /dev/null +++ b/code/__DEFINES/wounds.dm @@ -0,0 +1,43 @@ +#define WOUND_DAMAGE_EXPONENT 1.4 + +#define WOUND_SEVERITY_TRIVIAL 0 // for jokey/meme wounds like stubbed toe, no standard messages/sounds or second winds +#define WOUND_SEVERITY_MODERATE 1 +#define WOUND_SEVERITY_SEVERE 2 +#define WOUND_SEVERITY_CRITICAL 3 +#define WOUND_SEVERITY_LOSS 4 // theoretical total limb loss, like dismemberment for cuts + +#define WOUND_BRUTE 0 +#define WOUND_SHARP 1 +#define WOUND_BURN 2 + +// How much determination reagent to add each time someone gains a new wound in [/datum/wound/proc/second_wind()] +#define WOUND_DETERMINATION_MODERATE 1 +#define WOUND_DETERMINATION_SEVERE 2.5 +#define WOUND_DETERMINATION_CRITICAL 5 + +#define WOUND_DETERMINATION_MAX 10 + +// set wound_bonus on an item or attack to this to disable checking wounding for the attack +#define CANT_WOUND -100 + +// list in order of highest severity to lowest +#define WOUND_LIST_BONE list(/datum/wound/brute/bone/critical, /datum/wound/brute/bone/severe, /datum/wound/brute/bone/moderate) +#define WOUND_LIST_CUT list(/datum/wound/brute/cut/loss, /datum/wound/brute/cut/critical, /datum/wound/brute/cut/severe, /datum/wound/brute/cut/moderate) +#define WOUND_LIST_BURN list(/datum/wound/burn/critical, /datum/wound/burn/severe, /datum/wound/burn/moderate) + +// Thresholds for infection for burn wounds, once infestation hits each threshold, things get steadily worse +#define WOUND_INFECTION_MODERATE 4 // below this has no ill effects from infection +#define WOUND_INFECTION_SEVERE 8 // then below here, you ooze some pus and suffer minor tox damage, but nothing serious +#define WOUND_INFECTION_CRITICAL 12 // then below here, your limb occasionally locks up from damage and infection and briefly becomes disabled. Things are getting really bad +#define WOUND_INFECTION_SEPTIC 20 // below here, your skin is almost entirely falling off and your limb locks up more frequently. You are within a stone's throw of septic paralysis and losing the limb +// above WOUND_INFECTION_SEPTIC, your limb is completely putrid and you start rolling to lose the entire limb by way of paralyzation. After 3 failed rolls (~4-5% each probably), the limb is paralyzed + +#define WOUND_BURN_SANITIZATION_RATE 0.15 // how quickly sanitization removes infestation and decays per tick +#define WOUND_CUT_MAX_BLOODFLOW 8 // how much blood you can lose per tick per cut max. 8 is a LOT of blood for one cut so don't worry about hitting it easily +#define WOUND_BONE_HEAD_TIME_VARIANCE 20 // if we suffer a bone wound to the head that creates brain traumas, the timer for the trauma cycle is +/- by this percent (0-100) + +// The following are for persistent scar save formats +#define SCAR_SAVE_ZONE 1 // The body_zone we're applying to on granting +#define SCAR_SAVE_DESC 2 // The description we're loading +#define SCAR_SAVE_PRECISE_LOCATION 3 // The precise location we're loading +#define SCAR_SAVE_SEVERITY 4 // The severity the scar had diff --git a/code/datums/armor.dm b/code/datums/armor.dm index cbf4b76c60fb..4acdb5baaa78 100644 --- a/code/datums/armor.dm +++ b/code/datums/armor.dm @@ -1,9 +1,9 @@ -#define ARMORID "armor-[melee]-[bullet]-[laser]-[energy]-[bomb]-[bio]-[rad]-[fire]-[acid]-[magic]" +#define ARMORID "armor-[melee]-[bullet]-[laser]-[energy]-[bomb]-[bio]-[rad]-[fire]-[acid]-[magic]-[wound]" -/proc/getArmor(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 0, acid = 0, magic = 0) +/proc/getArmor(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 0, acid = 0, magic = 0, wound = 0) . = locate(ARMORID) if (!.) - . = new /datum/armor(melee, bullet, laser, energy, bomb, bio, rad, fire, acid, magic) + . = new /datum/armor(melee, bullet, laser, energy, bomb, bio, rad, fire, acid, magic, wound) /datum/armor datum_flags = DF_USE_TAG @@ -17,8 +17,9 @@ var/fire var/acid var/magic + var/wound -/datum/armor/New(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 0, acid = 0, magic = 0) +/datum/armor/New(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 0, acid = 0, magic = 0, wound = 0) src.melee = melee src.bullet = bullet src.laser = laser @@ -29,15 +30,16 @@ src.fire = fire src.acid = acid src.magic = magic + src.wound = wound tag = ARMORID -/datum/armor/proc/modifyRating(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 0, acid = 0, magic = 0) - return getArmor(src.melee+melee, src.bullet+bullet, src.laser+laser, src.energy+energy, src.bomb+bomb, src.bio+bio, src.rad+rad, src.fire+fire, src.acid+acid, src.magic+magic) +/datum/armor/proc/modifyRating(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 0, acid = 0, magic = 0, wound = 0) + return getArmor(src.melee+melee, src.bullet+bullet, src.laser+laser, src.energy+energy, src.bomb+bomb, src.bio+bio, src.rad+rad, src.fire+fire, src.acid+acid, src.magic+magic, src.wound+wound) /datum/armor/proc/modifyAllRatings(modifier = 0) - return getArmor(melee+modifier, bullet+modifier, laser+modifier, energy+modifier, bomb+modifier, bio+modifier, rad+modifier, fire+modifier, acid+modifier, magic+modifier) + return getArmor(melee+modifier, bullet+modifier, laser+modifier, energy+modifier, bomb+modifier, bio+modifier, rad+modifier, fire+modifier, acid+modifier, magic+modifier, wound+modifier) -/datum/armor/proc/setRating(melee, bullet, laser, energy, bomb, bio, rad, fire, acid, magic) +/datum/armor/proc/setRating(melee, bullet, laser, energy, bomb, bio, rad, fire, acid, magic, wound) return getArmor((isnull(melee) ? src.melee : melee),\ (isnull(bullet) ? src.bullet : bullet),\ (isnull(laser) ? src.laser : laser),\ @@ -47,19 +49,20 @@ (isnull(rad) ? src.rad : rad),\ (isnull(fire) ? src.fire : fire),\ (isnull(acid) ? src.acid : acid),\ - (isnull(magic) ? src.magic : magic)) + (isnull(magic) ? src.magic : magic),\ + (isnull(wound) ? src.wound : wound)) /datum/armor/proc/getRating(rating) return vars[rating] /datum/armor/proc/getList() - return list("melee" = melee, "bullet" = bullet, "laser" = laser, "energy" = energy, "bomb" = bomb, "bio" = bio, "rad" = rad, "fire" = fire, "acid" = acid, "magic" = magic) + return list("melee" = melee, "bullet" = bullet, "laser" = laser, "energy" = energy, "bomb" = bomb, "bio" = bio, "rad" = rad, "fire" = fire, "acid" = acid, "magic" = magic, "wound" = wound) /datum/armor/proc/attachArmor(datum/armor/AA) - return getArmor(melee+AA.melee, bullet+AA.bullet, laser+AA.laser, energy+AA.energy, bomb+AA.bomb, bio+AA.bio, rad+AA.rad, fire+AA.fire, acid+AA.acid, magic+AA.magic) + return getArmor(melee+AA.melee, bullet+AA.bullet, laser+AA.laser, energy+AA.energy, bomb+AA.bomb, bio+AA.bio, rad+AA.rad, fire+AA.fire, acid+AA.acid, magic+AA.magic, wound+AA.wound) /datum/armor/proc/detachArmor(datum/armor/AA) - return getArmor(melee-AA.melee, bullet-AA.bullet, laser-AA.laser, energy-AA.energy, bomb-AA.bomb, bio-AA.bio, rad-AA.rad, fire-AA.fire, acid-AA.acid, magic-AA.magic) + return getArmor(melee-AA.melee, bullet-AA.bullet, laser-AA.laser, energy-AA.energy, bomb-AA.bomb, bio-AA.bio, rad-AA.rad, fire-AA.fire, acid-AA.acid, magic-AA.magic, wound-AA.wound) /datum/armor/vv_edit_var(var_name, var_value) if (var_name == NAMEOF(src, tag)) @@ -67,4 +70,4 @@ . = ..() tag = ARMORID // update tag in case armor values were edited -#undef ARMORID +#undef ARMORID \ No newline at end of file diff --git a/code/datums/brain_damage/magic.dm b/code/datums/brain_damage/magic.dm index 1af6f91d5885..5242567535ad 100644 --- a/code/datums/brain_damage/magic.dm +++ b/code/datums/brain_damage/magic.dm @@ -94,7 +94,7 @@ if(get_dist(owner, stalker) <= 1) playsound(owner, 'sound/magic/demon_attack1.ogg', 50) owner.visible_message("[owner] is torn apart by invisible claws!", "Ghostly claws tear your body apart!") - owner.take_bodypart_damage(rand(20, 45)) + owner.take_bodypart_damage(rand(20, 45), wound_bonus=CANT_WOUND) else if(prob(50)) stalker.forceMove(get_step_towards(stalker, owner)) if(get_dist(owner, stalker) <= 8) diff --git a/code/datums/components/caltrop.dm b/code/datums/components/caltrop.dm index d6804564cb78..4ec5d0b44ec9 100644 --- a/code/datums/components/caltrop.dm +++ b/code/datums/components/caltrop.dm @@ -48,7 +48,7 @@ var/damage = rand(min_damage, max_damage) if(HAS_TRAIT(H, TRAIT_LIGHT_STEP)) damage *= 0.75 - H.apply_damage(damage, BRUTE, picked_def_zone) + H.apply_damage(damage, BRUTE, picked_def_zone, wound_bonus = CANT_WOUND) if(cooldown < world.time - 10) //cooldown to avoid message spam. if(!H.incapacitated(ignore_restraints = TRUE)) diff --git a/code/datums/diseases/advance/symptoms/flesh_eating.dm b/code/datums/diseases/advance/symptoms/flesh_eating.dm index b180b72f4e7f..13abac03981f 100644 --- a/code/datums/diseases/advance/symptoms/flesh_eating.dm +++ b/code/datums/diseases/advance/symptoms/flesh_eating.dm @@ -61,7 +61,8 @@ Bonus if(bleed) if(ishuman(M)) var/mob/living/carbon/human/H = M - H.bleed_rate += 5 * power + var/obj/item/bodypart/random_part = pick(H.bodyparts) + random_part.generic_bleedstacks += 5 * power return 1 /* diff --git a/code/datums/martial/sleeping_carp.dm b/code/datums/martial/sleeping_carp.dm index 69a0352a1688..e14c2f915d67 100644 --- a/code/datums/martial/sleeping_carp.dm +++ b/code/datums/martial/sleeping_carp.dm @@ -46,7 +46,7 @@ playsound(get_turf(A), 'sound/weapons/thudswoosh.ogg', 50, 1, -1) D.emote("scream") D.dropItemToGround(D.get_active_held_item()) - D.apply_damage(5, BRUTE, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) + D.apply_damage(5, BRUTE, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM), wound_bonus = CANT_WOUND) D.Stun(60) return TRUE @@ -88,7 +88,7 @@ A.do_attack_animation(D, ATTACK_EFFECT_KICK) D.visible_message("[A] kicks [D] in the head!", \ "[A] kicks you in the jaw!") - D.apply_damage(20, A.dna.species.attack_type, BODY_ZONE_HEAD) + D.apply_damage(20, A.dna.species.attack_type, BODY_ZONE_HEAD, wound_bonus = CANT_WOUND) D.drop_all_held_items() playsound(get_turf(D), 'sound/weapons/punch1.ogg', 50, 1, -1) D.Stun(80) @@ -103,7 +103,7 @@ "[A] piledrives you with their elbow!") if(D.stat) D.death() //FINISH HIM! - D.apply_damage(50, A.dna.species.attack_type, BODY_ZONE_CHEST) + D.apply_damage(50, A.dna.species.attack_type, BODY_ZONE_CHEST, wound_bonus = CANT_WOUND) playsound(get_turf(D), 'sound/weapons/punch1.ogg', 75, 1, -1) return TRUE return basic_hit(A,D) @@ -133,7 +133,7 @@ var/atk_verb = pick("punches", "kicks", "chops", "hits", "slams") D.visible_message("[A] [atk_verb] [D]!", \ "[A] [atk_verb] you!") - D.apply_damage(rand(10,15), BRUTE) + D.apply_damage(rand(10,15), BRUTE, wound_bonus = CANT_WOUND) playsound(get_turf(D), 'sound/weapons/punch1.ogg', 25, 1, -1) if(prob(D.getBruteLoss()) && (D.mobility_flags & MOBILITY_STAND)) D.visible_message("[D] stumbles and falls!", "The blow sends you to the ground!") diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 2150fe2974cd..3150580f0823 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -70,6 +70,8 @@ var/flavour_text = null ///Are we zombified/uncloneable? var/zombified = FALSE + ///What character we spawned in as- either at roundstart or latejoin, so we know for persistent scars if we ended as the same person or not + var/mob/original_character /datum/mind/New(key) src.key = key @@ -91,6 +93,7 @@ return language_holder /datum/mind/proc/transfer_to(mob/new_character, var/force_key_move = 0) + original_character = null var/mood_was_enabled = FALSE//Yogs -- Mood Preferences if(current) // remove ourself from our old body's mind variable // Yogs start -- Mood preferences @@ -145,6 +148,7 @@ new_character.key = key //now transfer the key to link the client to our new body if(new_character.client) new_character.client.init_verbs() // re-initialize character specific verbs + LAZYCLEARLIST(new_character.client.recent_examines) current.update_atom_languages() /datum/mind/proc/set_death_time() diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 460bdff3cd82..954733ca3a0b 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -348,7 +348,7 @@ var/mob/living/carbon/human/H = owner prot = H.get_thermal_protection() - + if(owner.on_fire && (prot < FIRE_IMMUNITY_MAX_TEMP_PROTECT)) linked_alert.icon_state = "fleshmend_fire" return @@ -357,6 +357,10 @@ owner.adjustBruteLoss(-10, FALSE) owner.adjustFireLoss(-5, FALSE) owner.adjustOxyLoss(-10) + if(!iscarbon(owner)) + return + var/mob/living/carbon/C = owner + QDEL_LIST(C.all_scars) /obj/screen/alert/status_effect/fleshmend name = "Fleshmend" diff --git a/code/datums/status_effects/status_effect.dm b/code/datums/status_effects/status_effect.dm index d6377c115e75..a23cf4390fdd 100644 --- a/code/datums/status_effects/status_effect.dm +++ b/code/datums/status_effects/status_effect.dm @@ -70,6 +70,10 @@ return duration = world.time + original_duration +//do_after modifier! +/datum/status_effect/proc/interact_speed_modifier() + return 1 + //clickdelay/nextmove modifiers! /datum/status_effect/proc/nextmove_modifier() return 1 diff --git a/code/datums/status_effects/wound_effects.dm b/code/datums/status_effects/wound_effects.dm new file mode 100644 index 000000000000..751a3508a38e --- /dev/null +++ b/code/datums/status_effects/wound_effects.dm @@ -0,0 +1,186 @@ + +// The shattered remnants of your broken limbs fill you with determination! +/obj/screen/alert/status_effect/determined + name = "Determined" + desc = "The serious wounds you've sustained have put your body into fight-or-flight mode! Now's the time to look for an exit!" + icon_state = "regenerative_core" + +/datum/status_effect/determined + id = "determined" + alert_type = /obj/screen/alert/status_effect/determined + +/datum/status_effect/determined/on_apply() + . = ..() + owner.visible_message("[owner] grits [owner.p_their()] teeth in pain!", "Your senses sharpen as your body tenses up from the wounds you've sustained!", vision_distance=COMBAT_MESSAGE_RANGE) + +/datum/status_effect/determined/on_remove() + owner.visible_message("[owner]'s body slackens noticeably!", "Your adrenaline rush dies off, and the pain from your wounds come aching back in...", vision_distance=COMBAT_MESSAGE_RANGE) + return ..() + +/datum/status_effect/limp + id = "limp" + status_type = STATUS_EFFECT_REPLACE + tick_interval = 10 + alert_type = /obj/screen/alert/status_effect/limp + var/msg_stage = 0//so you dont get the most intense messages immediately + /// The left leg of the limping person + var/obj/item/bodypart/l_leg/left + /// The right leg of the limping person + var/obj/item/bodypart/r_leg/right + /// Which leg we're limping with next + var/obj/item/bodypart/next_leg + /// How many deciseconds we limp for on the left leg + var/slowdown_left = 0 + /// How many deciseconds we limp for on the right leg + var/slowdown_right = 0 + +/datum/status_effect/limp/on_apply() + if(!iscarbon(owner)) + return FALSE + var/mob/living/carbon/C = owner + left = C.get_bodypart(BODY_ZONE_L_LEG) + right = C.get_bodypart(BODY_ZONE_R_LEG) + update_limp() + RegisterSignal(C, COMSIG_MOVABLE_MOVED, .proc/check_step) + RegisterSignal(C, list(COMSIG_CARBON_GAIN_WOUND, COMSIG_CARBON_LOSE_WOUND, COMSIG_CARBON_ATTACH_LIMB, COMSIG_CARBON_REMOVE_LIMB), .proc/update_limp) + return TRUE + +/datum/status_effect/limp/on_remove() + UnregisterSignal(owner, list(COMSIG_MOVABLE_MOVED, COMSIG_CARBON_GAIN_WOUND, COMSIG_CARBON_LOSE_WOUND, COMSIG_CARBON_ATTACH_LIMB, COMSIG_CARBON_REMOVE_LIMB)) + +/obj/screen/alert/status_effect/limp + name = "Limping" + desc = "One or more of your legs has been wounded, slowing down steps with that leg! Get it fixed, or at least splinted!" + +/datum/status_effect/limp/proc/check_step(mob/whocares, OldLoc, Dir, forced) + if(!owner.client || !(owner.mobility_flags & MOBILITY_STAND) || !owner.has_gravity() || (owner.movement_type & FLYING) || forced) + return + var/determined_mod = 1 + if(owner.has_status_effect(STATUS_EFFECT_DETERMINED)) + determined_mod = 0.25 + if(next_leg == left) + owner.client.move_delay += slowdown_left * determined_mod + next_leg = right + else + owner.client.move_delay += slowdown_right * determined_mod + next_leg = left + +/datum/status_effect/limp/proc/update_limp() + var/mob/living/carbon/C = owner + left = C.get_bodypart(BODY_ZONE_L_LEG) + right = C.get_bodypart(BODY_ZONE_R_LEG) + + if(!left && !right) + C.remove_status_effect(src) + return + + slowdown_left = 0 + slowdown_right = 0 + + if(left) + for(var/thing in left.wounds) + var/datum/wound/W = thing + slowdown_left += W.limp_slowdown + + if(right) + for(var/thing in right.wounds) + var/datum/wound/W = thing + slowdown_right += W.limp_slowdown + + // this handles losing your leg with the limp and the other one being in good shape as well + if(!slowdown_left && !slowdown_right) + C.remove_status_effect(src) + return + + +///////////////////////// +//////// WOUNDS ///////// +///////////////////////// + +// wound alert +/obj/screen/alert/status_effect/wound + name = "Wounded" + desc = "Your body has sustained serious damage, click here to inspect yourself." + +/obj/screen/alert/status_effect/wound/Click() + var/mob/living/carbon/C = usr + C.check_self_for_injuries() + +// wound status effect base +/datum/status_effect/wound + id = "wound" + status_type = STATUS_EFFECT_MULTIPLE + var/obj/item/bodypart/linked_limb + var/datum/wound/linked_wound + alert_type = NONE + +/datum/status_effect/wound/on_creation(mob/living/new_owner, incoming_wound) + . = ..() + var/datum/wound/W = incoming_wound + linked_wound = W + linked_limb = linked_wound.limb + +/datum/status_effect/wound/on_remove() + linked_wound = null + linked_limb = null + UnregisterSignal(owner, COMSIG_CARBON_LOSE_WOUND) + +/datum/status_effect/wound/on_apply() + if(!iscarbon(owner)) + return FALSE + RegisterSignal(owner, COMSIG_CARBON_LOSE_WOUND, .proc/check_remove) + return TRUE + +/// check if the wound getting removed is the wound we're tied to +/datum/status_effect/wound/proc/check_remove(mob/living/L, datum/wound/W) + if(W == linked_wound) + qdel(src) + + +// bones +/datum/status_effect/wound/bone + +/datum/status_effect/wound/bone/interact_speed_modifier() + var/mob/living/carbon/C = owner + + if(C.get_active_hand() == linked_limb) + to_chat(C, "The [lowertext(linked_wound)] in your [linked_limb.name] slows your progress!") + return linked_wound.interaction_efficiency_penalty + + return 1 + +/datum/status_effect/wound/bone/nextmove_modifier() + var/mob/living/carbon/C = owner + + if(C.get_active_hand() == linked_limb) + return linked_wound.interaction_efficiency_penalty + + return 1 + +/datum/status_effect/wound/bone/moderate + id = "disjoint" +/datum/status_effect/wound/bone/severe + id = "hairline" + +/datum/status_effect/wound/bone/critical + id = "compound" + +// cuts +/datum/status_effect/wound/cut/moderate + id = "abrasion" + +/datum/status_effect/wound/cut/severe + id = "laceration" + +/datum/status_effect/wound/cut/critical + id = "avulsion" + +// burns +/datum/status_effect/wound/burn/moderate + id = "seconddeg" + +/datum/status_effect/wound/burn/severe + id = "thirddeg" + +/datum/status_effect/wound/burn/critical + id = "fourthdeg" diff --git a/code/datums/wounds/_wounds.dm b/code/datums/wounds/_wounds.dm new file mode 100644 index 000000000000..d70a4ebdb2d9 --- /dev/null +++ b/code/datums/wounds/_wounds.dm @@ -0,0 +1,320 @@ +/* + Wounds are specific medical complications that can arise and be applied to (currently) carbons, with a focus on humans. All of the code for and related to this is heavily WIP, + and the documentation will be slanted towards explaining what each part/piece is leading up to, until such a time as I finish the core implementations. The original design doc + can be found at https://hackmd.io/@Ryll/r1lb4SOwU + + Wounds are datums that operate like a mix of diseases, brain traumas, and components, and are applied to a /obj/item/bodypart (preferably attached to a carbon) when they take large spikes of damage + or under other certain conditions (thrown hard against a wall, sustained exposure to plasma fire, etc). Wounds are categorized by the three following criteria: + 1. Severity: Either MODERATE, SEVERE, or CRITICAL. See the hackmd for more details + 2. Viable zones: What body parts the wound is applicable to. Generic wounds like broken bones and severe burns can apply to every zone, but you may want to add special wounds for certain limbs + like a twisted ankle for legs only, or open air exposure of the organs for particularly gruesome chest wounds. Wounds should be able to function for every zone they are marked viable for. + 3. Damage type: Currently either BRUTE or BURN. Again, see the hackmd for a breakdown of my plans for each type. + + When a body part suffers enough damage to get a wound, the severity (determined by a roll or something, worse damage leading to worse wounds), affected limb, and damage type sustained are factored into + deciding what specific wound will be applied. I'd like to have a few different types of wounds for at least some of the choices, but I'm just doing rough generals for now. Expect polishing +*/ + +/datum/wound + /// What it's named + var/name = "ouchie" + /// The description shown on the scanners + var/desc = "" + /// The basic treatment suggested by health analyzers + var/treat_text = "" + /// What the limb looks like on a cursory examine + var/examine_desc = "is badly hurt" + + /// needed for "your arm has a compound fracture" vs "your arm has some third degree burns" + var/a_or_from = "a" + /// The visible message when this happens + var/occur_text = "" + /// This sound will be played upon the wound being applied + var/sound_effect + + /// Either WOUND_SEVERITY_TRIVIAL (meme wounds like stubbed toe), WOUND_SEVERITY_MODERATE, WOUND_SEVERITY_SEVERE, or WOUND_SEVERITY_CRITICAL (or maybe WOUND_SEVERITY_LOSS) + var/severity = WOUND_SEVERITY_MODERATE + /// The list of wounds it belongs in, WOUND_LIST_BONE, WOUND_LIST_CUT, or WOUND_LIST_BURN + var/wound_type + + /// What body zones can we affect + var/list/viable_zones = list(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) + /// Who owns the body part that we're wounding + var/mob/living/carbon/victim = null + /// If we only work on organics (everything right now) + var/organic_only = TRUE + /// The bodypart we're parented to + var/obj/item/bodypart/limb = null + + /// Specific items such as bandages or sutures that can try directly treating this wound + var/list/treatable_by + /// Specific items such as bandages or sutures that can try directly treating this wound only if the user has the victim in an aggressive grab or higher + var/list/treatable_by_grabbed + /// Tools with the specified tool flag will also be able to try directly treating this wound + var/treatable_tool + /// Set to TRUE if we don't give a shit about the patient's comfort and are allowed to just use any random sharp thing on this wound. Will require an aggressive grab or more to perform + var/treatable_sharp + /// How long it will take to treat this wound with a standard effective tool, assuming it doesn't need surgery + var/base_treat_time = 5 SECONDS + + /// Using this limb in a do_after interaction will multiply the length by this duration (arms) + var/interaction_efficiency_penalty = 1 + /// Incoming damage on this limb will be multiplied by this, to simulate tenderness and vulnerability (mostly burns). + var/damage_mulitplier_penalty = 1 + /// If set and this wound is applied to a leg, we take this many deciseconds extra per step on this leg + var/limp_slowdown + /// How much we're contributing to this limb's bleed_rate + var/blood_flow + + /// The minimum we need to roll on [/obj/item/bodypart/proc/check_wounding()] to begin suffering this wound, see check_wounding_mods() for more + var/threshold_minimum + /// How much having this wound will add to all future check_wounding() rolls on this limb, to allow progression to worse injuries with repeated damage + var/threshold_penalty + /// If we need to process each life tick + var/processes = FALSE + + /// If TRUE and an item that can treat multiple different types of coexisting wounds (gauze can be used to splint broken bones, staunch bleeding, and cover burns), we get first dibs if we come up first for it, then become nonpriority. + /// Otherwise, if no untreated wound claims the item, we cycle through the non priority wounds and pick a random one who can use that item. + var/treat_priority = FALSE + + /// If having this wound makes currently makes the parent bodypart unusable + var/disabling + + /// What status effect we assign on application + var/status_effect_type + /// The status effect we're linked to + var/datum/status_effect/linked_status_effect + /// If we're operating on this wound and it gets healed, we'll nix the surgery too + var/datum/surgery/attached_surgery + /// if you're a lazy git and just throw them in cryo, the wound will go away after accumulating severity * 25 power + var/cryo_progress + + /// What kind of scars this wound will create description wise once healed + var/list/scarring_descriptions = list("general disfigurement") + /// If we've already tried scarring while removing (since remove_wound calls qdel, and qdel calls remove wound, .....) TODO: make this cleaner + var/already_scarred = FALSE + /// If we forced this wound through badmin smite, we won't count it towards the round totals + var/from_smite + +/datum/wound/Destroy() + if(attached_surgery) + QDEL_NULL(attached_surgery) + if(limb?.wounds && (src in limb.wounds)) // destroy can call remove_wound() and remove_wound() calls qdel, so we check to make sure there's anything to remove first + remove_wound() + limb = null + victim = null + return ..() + +/** + * apply_wound() is used once a wound type is instantiated to assign it to a bodypart, and actually come into play. + * + * + * Arguments: + * * L: The bodypart we're wounding, we don't care about the person, we can get them through the limb + * * silent: Not actually necessary I don't think, was originally used for demoting wounds so they wouldn't make new messages, but I believe old_wound took over that, I may remove this shortly + * * old_wound: If our new wound is a replacement for one of the same time (promotion or demotion), we can reference the old one just before it's removed to copy over necessary vars + * * smited- If this is a smite, we don't care about this wound for stat tracking purposes (not yet implemented) + */ +/datum/wound/proc/apply_wound(obj/item/bodypart/L, silent = FALSE, datum/wound/old_wound = null, smited = FALSE) + if(!istype(L) || !L.owner || !(L.body_zone in viable_zones) || isalien(L.owner)) + qdel(src) + return + + if(ishuman(L.owner)) + var/mob/living/carbon/human/H = L.owner + if(organic_only && ((NOBLOOD in H.dna.species.species_traits) || !L.is_organic_limb())) + qdel(src) + return + + // we accept promotions and demotions, but no point in redundancy. This should have already been checked wherever the wound was rolled and applied for (see: bodypart damage code), but we do an extra check + // in case we ever directly add wounds + for(var/i in L.wounds) + var/datum/wound/preexisting_wound = i + if((preexisting_wound.type == type) && (preexisting_wound != old_wound)) + qdel(src) + return + + victim = L.owner + limb = L + LAZYADD(victim.all_wounds, src) + LAZYADD(limb.wounds, src) + limb.update_wounds() + if(status_effect_type) + linked_status_effect = victim.apply_status_effect(status_effect_type, src) + SEND_SIGNAL(victim, COMSIG_CARBON_GAIN_WOUND, src, limb) + if(!victim.alerts["wound"]) // only one alert is shared between all of the wounds + victim.throw_alert("wound", /obj/screen/alert/status_effect/wound) + + var/demoted + if(old_wound) + demoted = (severity <= old_wound.severity) + + if(severity == WOUND_SEVERITY_TRIVIAL) + return + + if(!(silent || demoted)) + var/msg = "[victim]'s [limb.name] [occur_text]!" + var/vis_dist = COMBAT_MESSAGE_RANGE + + if(severity != WOUND_SEVERITY_MODERATE) + msg = "[msg]" + vis_dist = DEFAULT_MESSAGE_RANGE + + victim.visible_message(msg, "Your [limb.name] [occur_text]!", vision_distance = vis_dist) + if(sound_effect) + playsound(L.owner, sound_effect, 60 + 20 * severity, TRUE) + + if(!demoted) + wound_injury(old_wound) + second_wind() + +/// Remove the wound from whatever it's afflicting, and cleans up whateverstatus effects it had or modifiers it had on interaction times. ignore_limb is used for detachments where we only want to forget the victim +/datum/wound/proc/remove_wound(ignore_limb, replaced = FALSE) + //TODO: have better way to tell if we're getting removed without replacement (full heal) scar stuff + if(limb && !already_scarred && !replaced) + already_scarred = TRUE + var/datum/scar/new_scar = new + new_scar.generate(limb, src) + if(victim) + LAZYREMOVE(victim.all_wounds, src) + if(!victim.all_wounds) + victim.clear_alert("wound") + SEND_SIGNAL(victim, COMSIG_CARBON_LOSE_WOUND, src, limb) + if(limb && !ignore_limb) + LAZYREMOVE(limb.wounds, src) + limb.update_wounds() + +/** + * replace_wound() is used when you want to replace the current wound with a new wound, presumably of the same category, just of a different severity (either up or down counts) + * + * This proc actually instantiates the new wound based off the specific type path passed, then returns the new instantiated wound datum. + * + * Arguments: + * * new_type- The TYPE PATH of the wound you want to replace this, like /datum/wound/brute/cut/severe + * * smited- If this is a smite, we don't care about this wound for stat tracking purposes (not yet implemented) + */ +/datum/wound/proc/replace_wound(new_type, smited = FALSE) + var/datum/wound/new_wound = new new_type + already_scarred = TRUE + remove_wound(replaced=TRUE) + new_wound.apply_wound(limb, old_wound = src, smited = smited) + qdel(src) + return new_wound + +/// The immediate negative effects faced as a result of the wound +/datum/wound/proc/wound_injury(datum/wound/old_wound = null) + return + +/// Additional beneficial effects when the wound is gained, in case you want to give a temporary boost to allow the victim to try an escape or last stand +/datum/wound/proc/second_wind() + if(HAS_TRAIT(victim, TRAIT_NOMETABOLISM)) + return + + switch(severity) + if(WOUND_SEVERITY_MODERATE) + victim.reagents.add_reagent(/datum/reagent/determination, WOUND_DETERMINATION_MODERATE) + if(WOUND_SEVERITY_SEVERE) + victim.reagents.add_reagent(/datum/reagent/determination, WOUND_DETERMINATION_SEVERE) + if(WOUND_SEVERITY_CRITICAL) + victim.reagents.add_reagent(/datum/reagent/determination, WOUND_DETERMINATION_CRITICAL) + +/** + * try_treating() is an intercept run from [/mob/living/carbon/attackby()] right after surgeries but before anything else. Return TRUE here if the item is something that is relevant to treatment to take over the interaction. + * + * This proc leads into [/datum/wound/proc/treat()] and probably shouldn't be added onto in children types. You can specify what items or tools you want to be intercepted + * with var/list/treatable_by and var/treatable_tool, then if an item fulfills one of those requirements and our wound claims it first, it goes over to treat() and treat_self(). + * + * Arguments: + * * I: The item we're trying to use + * * user: The mob trying to use it on us + */ +/datum/wound/proc/try_treating(obj/item/I, mob/user) + // first we weed out if we're not dealing with our wound's bodypart, or if it might be an attack + if(!I || limb.body_zone != user.zone_selected || (I.force && user.a_intent != INTENT_HELP)) + return FALSE + + var/allowed = FALSE + + // check if we have a valid treatable tool (or, if cauteries are allowed, if we have something hot) + if((I.tool_behaviour == treatable_tool) || (treatable_tool == TOOL_CAUTERY && I.get_temperature())) + allowed = TRUE + // failing that, see if we're aggro grabbing them and if we have an item that works for aggro grabs only + else if(user.pulling == victim && user.grab_state >= GRAB_AGGRESSIVE && check_grab_treatments(I, user)) + allowed = TRUE + // failing THAT, we check if we have a generally allowed item + else + for(var/allowed_type in treatable_by) + if(istype(I, allowed_type)) + allowed = TRUE + break + + // if none of those apply, we return false to avoid interrupting + if(!allowed) + return FALSE + + // now that we've determined we have a valid attempt at treating, we can stomp on their dreams if we're already interacting with the patient + if(INTERACTING_WITH(user, victim)) + to_chat(user, "You're already interacting with [victim]!") + return TRUE + + // lastly, treat them + treat(I, user) + return TRUE + +/// Return TRUE if we have an item that can only be used while aggro grabbed (unhanded aggro grab treatments go in [/datum/wound/proc/try_handling()]). Treatment is still is handled in [/datum/wound/proc/treat()] +/datum/wound/proc/check_grab_treatments(obj/item/I, mob/user) + return FALSE + +/// Like try_treating() but for unhanded interactions from humans, used by joint dislocations for manual bodypart chiropractice for example. +/datum/wound/proc/try_handling(mob/living/carbon/human/user) + return FALSE + +/// Someone is using something that might be used for treating the wound on this limb +/datum/wound/proc/treat(obj/item/I, mob/user) + return + +/// If var/processing is TRUE, this is run on each life tick +/datum/wound/proc/handle_process() + return + +/// For use in do_after callback checks +/datum/wound/proc/still_exists() + return (!QDELETED(src) && limb) + +/// When our parent bodypart is hurt +/datum/wound/proc/receive_damage(wounding_type, wounding_dmg, wound_bonus) + return + +/// Called from cryoxadone and pyroxadone when they're proc'ing. Wounds will slowly be fixed separately from other methods when these are in effect. crappy name but eh +/datum/wound/proc/on_xadone(power) + cryo_progress += power + if(cryo_progress > 33 * severity) + qdel(src) + +/// Called when we're crushed in an airlock or firedoor, for one of the improvised joint dislocation fixes +/datum/wound/proc/crush() + return + +/** + * get_examine_description() is used in carbon/examine and human/examine to show the status of this wound. Useful if you need to show some status like the wound being splinted or bandaged. + * + * Return the full string line you want to show, note that we're already dealing with the 'warning' span at this point, and that \n is already appended for you in the place this is called from + * + * Arguments: + * * mob/user: The user examining the wound's owner, if that matters + */ +/datum/wound/proc/get_examine_description(mob/user) + return "[victim.p_their(TRUE)] [limb.name] [examine_desc]!" + +/datum/wound/proc/get_scanner_description(mob/user) + return "Type: [name]\nSeverity: [severity_text()]\nDescription: [desc]\nRecommended Treatment: [treat_text]" + +/datum/wound/proc/severity_text() + switch(severity) + if(WOUND_SEVERITY_TRIVIAL) + return "Trivial" + if(WOUND_SEVERITY_MODERATE) + return "Moderate" + if(WOUND_SEVERITY_SEVERE) + return "Severe" + if(WOUND_SEVERITY_CRITICAL) + return "Critical" diff --git a/code/datums/wounds/bones.dm b/code/datums/wounds/bones.dm new file mode 100644 index 000000000000..6926d3216602 --- /dev/null +++ b/code/datums/wounds/bones.dm @@ -0,0 +1,461 @@ + +/* + Bones +*/ +// TODO: well, a lot really, but i'd kill to get overlays and a bonebreaking effect like Blitz: The League, similar to electric shock skeletons + +/* + Base definition +*/ +/datum/wound/brute/bone + sound_effect = 'sound/effects/crack1.ogg' + wound_type = WOUND_LIST_BONE + + /// The item we're currently splinted with, if there is one + var/obj/item/stack/splinted + + /// Have we been taped? + var/taped + /// Have we been bone gel'd? + var/gelled + /// If we did the gel + surgical tape healing method for fractures, how many regen points we need + var/regen_points_needed + /// Our current counter for gel + surgical tape regeneration + var/regen_points_current + /// If we suffer severe head booboos, we can get brain traumas tied to them + var/datum/brain_trauma/active_trauma + /// What brain trauma group, if any, we can draw from for head wounds + var/brain_trauma_group + /// If we deal brain traumas, when is the next one due? + var/next_trauma_cycle + /// How long do we wait +/- 20% for the next trauma? + var/trauma_cycle_cooldown + /// If this is a chest wound and this is set, we have this chance to cough up blood when hit in the chest + var/chance_internal_bleeding = 0 + +/* + Overwriting of base procs +*/ +/datum/wound/brute/bone/wound_injury(datum/wound/old_wound = null) + if(limb.body_zone == BODY_ZONE_HEAD && brain_trauma_group) + processes = TRUE + active_trauma = victim.gain_trauma_type(brain_trauma_group, TRAUMA_RESILIENCE_WOUND) + next_trauma_cycle = world.time + (rand(100-WOUND_BONE_HEAD_TIME_VARIANCE, 100+WOUND_BONE_HEAD_TIME_VARIANCE) * 0.01 * trauma_cycle_cooldown) + + RegisterSignal(victim, COMSIG_HUMAN_EARLY_UNARMED_ATTACK, .proc/attack_with_hurt_hand) + if(limb.held_index && victim.get_item_for_held_index(limb.held_index) && (disabling || prob(30 * severity))) + var/obj/item/I = victim.get_item_for_held_index(limb.held_index) + if(istype(I, /obj/item/offhand)) + I = victim.get_inactive_held_item() + + if(I && victim.dropItemToGround(I)) + victim.visible_message("[victim] drops [I] in shock!", "The force on your [limb.name] causes you to drop [I]!", vision_distance=COMBAT_MESSAGE_RANGE) + + update_inefficiencies() + +/datum/wound/brute/bone/remove_wound(ignore_limb, replaced) + limp_slowdown = 0 + QDEL_NULL(active_trauma) + if(victim) + UnregisterSignal(victim, COMSIG_HUMAN_EARLY_UNARMED_ATTACK) + return ..() + +/datum/wound/brute/bone/handle_process() + . = ..() + if(limb.body_zone == BODY_ZONE_HEAD && brain_trauma_group && world.time > next_trauma_cycle) + if(active_trauma) + QDEL_NULL(active_trauma) + else + active_trauma = victim.gain_trauma_type(brain_trauma_group, TRAUMA_RESILIENCE_WOUND) + next_trauma_cycle = world.time + (rand(100-WOUND_BONE_HEAD_TIME_VARIANCE, 100+WOUND_BONE_HEAD_TIME_VARIANCE) * 0.01 * trauma_cycle_cooldown) + + if(!regen_points_needed) + return + + regen_points_current++ + if(prob(severity * 2)) + victim.take_bodypart_damage(rand(2, severity * 2), stamina=rand(2, severity * 2.5), wound_bonus=CANT_WOUND) + if(prob(33)) + to_chat(victim, "You feel a sharp pain in your body as your bones are reforming!") + + if(regen_points_current > regen_points_needed) + if(!victim || !limb) + qdel(src) + return + to_chat(victim, "Your [limb.name] has recovered from your fracture!") + remove_wound() + +/// If we're a human who's punching something with a broken arm, we might hurt ourselves doing so +/datum/wound/brute/bone/proc/attack_with_hurt_hand(mob/M, atom/target, proximity) + if(victim.get_active_hand() != limb || victim.a_intent == INTENT_HELP || !ismob(target) || severity <= WOUND_SEVERITY_MODERATE) + return + + // With a severe or critical wound, you have a 15% or 30% chance to proc pain on hit + if(prob((severity - 1) * 15)) + // And you have a 70% or 50% chance to actually land the blow, respectively + if(prob(70 - 20 * (severity - 1))) + to_chat(victim, "The fracture in your [limb.name] shoots with pain as you strike [target]!") + limb.receive_damage(brute=rand(1,5)) + else + victim.visible_message("[victim] weakly strikes [target] with [victim.p_their()] broken [limb.name], recoiling from pain!", \ + "You fail to strike [target] as the fracture in your [limb.name] lights up in unbearable pain!", vision_distance=COMBAT_MESSAGE_RANGE) + victim.emote("scream") + victim.Stun(0.5 SECONDS) + limb.receive_damage(brute=rand(3,7)) + return COMPONENT_NO_ATTACK_HAND + +/datum/wound/brute/bone/receive_damage(wounding_type, wounding_dmg, wound_bonus) + if(!victim) + return + + if(limb.body_zone == BODY_ZONE_CHEST && victim.blood_volume && prob(chance_internal_bleeding + wounding_dmg)) + var/blood_bled = rand(1, wounding_dmg * (severity == WOUND_SEVERITY_CRITICAL ? 2 : 1.5)) // 12 brute toolbox can cause up to 18/24 bleeding with a severe/critical chest wound + switch(blood_bled) + if(1 to 6) + victim.bleed(blood_bled, TRUE) + if(7 to 13) + victim.visible_message("[victim] coughs up a bit of blood from the blow to [victim.p_their()] chest.", "You cough up a bit of blood from the blow to your chest.") + victim.bleed(blood_bled, TRUE) + if(14 to 19) + victim.visible_message("[victim] spits out a string of blood from the blow to [victim.p_their()] chest!", "You spit out a string of blood from the blow to your chest!") + new /obj/effect/temp_visual/dir_setting/bloodsplatter(victim.loc, victim.dir) + victim.bleed(blood_bled) + if(20 to INFINITY) + victim.visible_message("[victim] chokes up a spray of blood from the blow to [victim.p_their()] chest!", "You choke up on a spray of blood from the blow to your chest!") + victim.bleed(blood_bled) + new /obj/effect/temp_visual/dir_setting/bloodsplatter(victim.loc, victim.dir) + victim.add_splatter_floor(get_step(victim.loc, victim.dir)) + + if(!(wounding_type in list(WOUND_SHARP, WOUND_BURN)) || !splinted || wound_bonus == CANT_WOUND) + return + + splinted.take_damage(wounding_dmg, damage_type = (wounding_type == WOUND_SHARP ? BRUTE : BURN), sound_effect = FALSE) + if(QDELETED(splinted)) + var/destroyed_verb = (wounding_type == WOUND_SHARP ? "torn" : "burned") + victim.visible_message("The splint securing [victim]'s [limb.name] is [destroyed_verb] away!", "The splint securing your [limb.name] is [destroyed_verb] away!", vision_distance=COMBAT_MESSAGE_RANGE) + splinted = null + treat_priority = TRUE + update_inefficiencies() + + +/datum/wound/brute/bone/get_examine_description(mob/user) + if(!splinted && !gelled && !taped) + return ..() + + var/msg = "" + if(!splinted) + msg = "[victim.p_their(TRUE)] [limb.name] [examine_desc]" + else + var/splint_condition = "" + // how much life we have left in these bandages + switch(splinted.obj_integrity / splinted.max_integrity * 100) + if(0 to 25) + splint_condition = "just barely " + if(25 to 50) + splint_condition = "loosely " + if(50 to 75) + splint_condition = "mostly " + if(75 to INFINITY) + splint_condition = "tightly " + + msg = "[victim.p_their(TRUE)] [limb.name] is [splint_condition] fastened in a splint of [splinted.name]" + + if(taped) + msg += ", and appears to be reforming itself under some surgical tape!" + else if(gelled) + msg += ", with fizzing flecks of blue bone gel sparking off the bone!" + else + msg += "!" + return "[msg]" + +/* + New common procs for /datum/wound/brute/bone/ +*/ + +/datum/wound/brute/bone/proc/update_inefficiencies() + if(limb.body_zone in list(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) + if(splinted) + limp_slowdown = initial(limp_slowdown) * splinted.splint_factor + else + limp_slowdown = initial(limp_slowdown) + victim.apply_status_effect(STATUS_EFFECT_LIMP) + else if(limb.body_zone in list(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)) + if(splinted) + interaction_efficiency_penalty = 1 + ((interaction_efficiency_penalty - 1) * splinted.splint_factor) + else + interaction_efficiency_penalty = interaction_efficiency_penalty + + if(initial(disabling) && splinted) + disabling = FALSE + else if(initial(disabling)) + disabling = TRUE + + limb.update_wounds() + +/* + BEWARE OF REDUNDANCY AHEAD THAT I MUST PARE DOWN +*/ + +/datum/wound/brute/bone/proc/splint(obj/item/stack/I, mob/user) + if(splinted && splinted.splint_factor >= I.splint_factor) + to_chat(user, "The splint already on [user == victim ? "your" : "[victim]'s"] [limb.name] is better than you can do with [I].") + return + + user.visible_message("[user] begins splinting [victim]'s [limb.name] with [I].", "You begin splinting [user == victim ? "your" : "[victim]'s"] [limb.name] with [I]...") + + if(!do_after(user, base_treat_time * (user == victim ? 1.5 : 1), target = victim, extra_checks=CALLBACK(src, .proc/still_exists))) + return + + user.visible_message("[user] finishes splinting [victim]'s [limb.name]!", "You finish splinting [user == victim ? "your" : "[victim]'s"] [limb.name]!") + treat_priority = FALSE + splinted = new I.type(limb) + splinted.amount = 1 + I.use(1) + update_inefficiencies() + +/* + Moderate (Joint Dislocation) +*/ + +/datum/wound/brute/bone/moderate + name = "Joint Dislocation" + desc = "Patient's bone has been unset from socket, causing pain and reduced motor function." + treat_text = "Recommended application of bonesetter to affected limb, though manual relocation by applying an aggressive grab to the patient and helpfully interacting with afflicted limb may suffice." + examine_desc = "is awkwardly jammed out of place" + occur_text = "jerks violently and becomes unseated" + severity = WOUND_SEVERITY_MODERATE + viable_zones = list(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) + interaction_efficiency_penalty = 1.5 + limp_slowdown = 3 + threshold_minimum = 35 + threshold_penalty = 15 + treatable_tool = TOOL_BONESET + status_effect_type = /datum/status_effect/wound/bone/moderate + scarring_descriptions = list("light discoloring", "a slight blue tint") + +/datum/wound/brute/bone/moderate/crush() + if(prob(33)) + victim.visible_message("[victim]'s dislocated [limb.name] pops back into place!", "Your dislocated [limb.name] pops back into place! Ow!") + remove_wound() + +/datum/wound/brute/bone/moderate/try_handling(mob/living/carbon/human/user) + if(user.pulling != victim || user.zone_selected != limb.body_zone || user.a_intent == INTENT_GRAB) + return FALSE + + if(user.grab_state == GRAB_PASSIVE) + to_chat(user, "You must have [victim] in an aggressive grab to manipulate [victim.p_their()] [lowertext(name)]!") + return TRUE + + if(user.grab_state >= GRAB_AGGRESSIVE) + user.visible_message("[user] begins twisting and straining [victim]'s dislocated [limb.name]!", "You begin twisting and straining [victim]'s dislocated [limb.name]...", ignored_mobs=victim) + to_chat(victim, "[user] begins twisting and straining your dislocated [limb.name]!") + if(user.a_intent == INTENT_HELP) + chiropractice(user) + else + malpractice(user) + return TRUE + +/// If someone is snapping our dislocated joint back into place by hand with an aggro grab and help intent +/datum/wound/brute/bone/moderate/proc/chiropractice(mob/living/carbon/human/user) + var/time = base_treat_time + var/time_mod = user.mind?.get_skill_modifier(/datum/skill/healing, SKILL_SPEED_MODIFIER) + var/prob_mod = user.mind?.get_skill_modifier(/datum/skill/healing, SKILL_PROBS_MODIFIER) + if(time_mod) + time *= time_mod + + if(!do_after(user, time, target=victim, extra_checks = CALLBACK(src, .proc/still_exists))) + return + + if(prob(65 + prob_mod)) + user.visible_message("[user] snaps [victim]'s dislocated [limb.name] back into place!", "You snap [victim]'s dislocated [limb.name] back into place!", ignored_mobs=victim) + to_chat(victim, "[user] snaps your dislocated [limb.name] back into place!") + victim.emote("scream") + limb.receive_damage(brute=20, wound_bonus=CANT_WOUND) + qdel(src) + else + user.visible_message("[user] wrenches [victim]'s dislocated [limb.name] around painfully!", "You wrench [victim]'s dislocated [limb.name] around painfully!", ignored_mobs=victim) + to_chat(victim, "[user] wrenches your dislocated [limb.name] around painfully!") + limb.receive_damage(brute=10, wound_bonus=CANT_WOUND) + chiropractice(user) + +/// If someone is snapping our dislocated joint into a fracture by hand with an aggro grab and harm or disarm intent +/datum/wound/brute/bone/moderate/proc/malpractice(mob/living/carbon/human/user) + var/time = base_treat_time + var/time_mod = user.mind?.get_skill_modifier(/datum/skill/healing, SKILL_SPEED_MODIFIER) + var/prob_mod = user.mind?.get_skill_modifier(/datum/skill/healing, SKILL_PROBS_MODIFIER) + if(time_mod) + time *= time_mod + + if(!do_after(user, time, target=victim, extra_checks = CALLBACK(src, .proc/still_exists))) + return + + if(prob(65 + prob_mod)) + user.visible_message("[user] snaps [victim]'s dislocated [limb.name] with a sickening crack!", "You snap [victim]'s dislocated [limb.name] with a sickening crack!", ignored_mobs=victim) + to_chat(victim, "[user] snaps your dislocated [limb.name] with a sickening crack!") + victim.emote("scream") + limb.receive_damage(brute=25, wound_bonus=30 + prob_mod * 3) + else + user.visible_message("[user] wrenches [victim]'s dislocated [limb.name] around painfully!", "You wrench [victim]'s dislocated [limb.name] around painfully!", ignored_mobs=victim) + to_chat(victim, "[user] wrenches your dislocated [limb.name] around painfully!") + limb.receive_damage(brute=10, wound_bonus=CANT_WOUND) + malpractice(user) + + +/datum/wound/brute/bone/moderate/treat(obj/item/I, mob/user) + if(victim == user) + victim.visible_message("[user] begins resetting [victim.p_their()] [limb.name] with [I].", "You begin resetting your [limb.name] with [I]...") + else + user.visible_message("[user] begins resetting [victim]'s [limb.name] with [I].", "You begin resetting [victim]'s [limb.name] with [I]...") + + if(!do_after(user, base_treat_time * (user == victim ? 1.5 : 1), target = victim, extra_checks=CALLBACK(src, .proc/still_exists))) + return + + if(victim == user) + limb.receive_damage(brute=15, wound_bonus=CANT_WOUND) + victim.visible_message("[user] finishes resetting [victim.p_their()] [limb.name]!", "You reset your [limb.name]!") + else + limb.receive_damage(brute=10, wound_bonus=CANT_WOUND) + user.visible_message("[user] finishes resetting [victim]'s [limb.name]!", "You finish resetting [victim]'s [limb.name]!", victim) + to_chat(victim, "[user] resets your [limb.name]!") + + victim.emote("scream") + qdel(src) + +/* + Severe (Hairline Fracture) +*/ + +/datum/wound/brute/bone/severe + name = "Hairline Fracture" + desc = "Patient's bone has suffered a crack in the foundation, causing serious pain and reduced limb functionality." + treat_text = "Recommended light surgical application of bone gel, though splinting will prevent worsening situation." + examine_desc = "appears bruised and grotesquely swollen" + + occur_text = "sprays chips of bone and develops a nasty looking bruise" + severity = WOUND_SEVERITY_SEVERE + interaction_efficiency_penalty = 2 + limp_slowdown = 6 + threshold_minimum = 60 + threshold_penalty = 30 + treatable_by = list(/obj/item/stack/sticky_tape/surgical, /obj/item/stack/medical/gauze, /obj/item/stack/medical/bone_gel) + status_effect_type = /datum/status_effect/wound/bone/severe + treat_priority = TRUE + scarring_descriptions = list("a faded, fist-sized bruise", "a vaguely triangular peel scar") + brain_trauma_group = BRAIN_TRAUMA_MILD + trauma_cycle_cooldown = 1.5 MINUTES + chance_internal_bleeding = 40 + +/datum/wound/brute/bone/critical + name = "Compound Fracture" + desc = "Patient's bones have suffered multiple gruesome fractures, causing significant pain and near uselessness of limb." + treat_text = "Immediate binding of affected limb, followed by surgical intervention ASAP." + examine_desc = "has a cracked bone sticking out of it" + occur_text = "cracks apart, exposing broken bones to open air" + severity = WOUND_SEVERITY_CRITICAL + interaction_efficiency_penalty = 4 + limp_slowdown = 9 + sound_effect = 'sound/effects/crack2.ogg' + threshold_minimum = 115 + threshold_penalty = 50 + disabling = TRUE + treatable_by = list(/obj/item/stack/sticky_tape/surgical, /obj/item/stack/medical/gauze, /obj/item/stack/medical/bone_gel) + status_effect_type = /datum/status_effect/wound/bone/critical + treat_priority = TRUE + scarring_descriptions = list("a section of janky skin lines and badly healed scars", "a large patch of uneven skin tone", "a cluster of calluses") + brain_trauma_group = BRAIN_TRAUMA_SEVERE + trauma_cycle_cooldown = 2.5 MINUTES + chance_internal_bleeding = 60 + +// doesn't make much sense for "a" bone to stick out of your head +/datum/wound/brute/bone/critical/apply_wound(obj/item/bodypart/L, silent, datum/wound/old_wound, smited) + if(L.body_zone == BODY_ZONE_HEAD) + occur_text = "splits open, exposing a bare, cracked skull through the flesh and blood" + examine_desc = "has an unsettling indent, with bits of skull poking out" + . = ..() + +/// if someone is using bone gel on our wound +/datum/wound/brute/bone/proc/gel(obj/item/stack/medical/bone_gel/I, mob/user) + if(gelled) + to_chat(user, "[user == victim ? "Your" : "[victim]'s"] [limb.name] is already coated with bone gel!") + return + + user.visible_message("[user] begins hastily applying [I] to [victim]'s' [limb.name]...", "You begin hastily applying [I] to [user == victim ? "your" : "[victim]'s"] [limb.name], disregarding the warning label...") + + if(!do_after(user, base_treat_time * 1.5 * (user == victim ? 1.5 : 1), target = victim, extra_checks=CALLBACK(src, .proc/still_exists))) + return + + I.use(1) + victim.emote("scream") + if(user != victim) + user.visible_message("[user] finishes applying [I] to [victim]'s [limb.name], emitting a fizzing noise!", "You finish applying [I] to [victim]'s [limb.name]!", ignored_mobs=victim) + to_chat(victim, "[user] finishes applying [I] to your [limb.name], and you can feel the bones exploding with pain as they begin melting and reforming!") + else + var/painkiller_bonus = 0 + if(victim.drunkenness) + painkiller_bonus += 5 + if(victim.reagents && victim.reagents.has_reagent(/datum/reagent/medicine/morphine)) + painkiller_bonus += 10 + if(victim.reagents && victim.reagents.has_reagent(/datum/reagent/determination)) + painkiller_bonus += 5 + + if(prob(25 + (20 * severity - 2) - painkiller_bonus)) // 25%/45% chance to fail self-applying with severe and critical wounds, modded by painkillers + victim.visible_message("[victim] fails to finish applying [I] to [victim.p_their()] [limb.name], passing out from the pain!", "You black out from the pain of applying [I] to your [limb.name] before you can finish!") + victim.AdjustUnconscious(5 SECONDS) + return + victim.visible_message("[victim] finishes applying [I] to [victim.p_their()] [limb.name], grimacing from the pain!", "You finish applying [I] to your [limb.name], and your bones explode in pain!") + + limb.receive_damage(30, stamina=100, wound_bonus=CANT_WOUND) + if(!gelled) + gelled = TRUE + +/// if someone is using surgical tape on our wound +/datum/wound/brute/bone/proc/tape(obj/item/stack/sticky_tape/surgical/I, mob/user) + if(!gelled) + to_chat(user, "[user == victim ? "Your" : "[victim]'s"] [limb.name] must be coated with bone gel to perform this emergency operation!") + return + if(taped) + to_chat(user, "[user == victim ? "Your" : "[victim]'s"] [limb.name] is already wrapped in [I.name] and reforming!") + return + + user.visible_message("[user] begins applying [I] to [victim]'s' [limb.name]...", "You begin applying [I] to [user == victim ? "your" : "[victim]'s"] [limb.name]...") + + if(!do_after(user, base_treat_time * (user == victim ? 1.5 : 1), target = victim, extra_checks=CALLBACK(src, .proc/still_exists))) + return + + regen_points_current = 0 + regen_points_needed = 30 SECONDS * (user == victim ? 1.5 : 1) * (severity - 1) + I.use(1) + if(user != victim) + user.visible_message("[user] finishes applying [I] to [victim]'s [limb.name], emitting a fizzing noise!", "You finish applying [I] to [victim]'s [limb.name]!", ignored_mobs=victim) + to_chat(victim, "[user] finishes applying [I] to your [limb.name], you immediately begin to feel your bones start to reform!") + else + victim.visible_message("[victim] finishes applying [I] to [victim.p_their()] [limb.name], !", "You finish applying [I] to your [limb.name], and you immediately begin to feel your bones start to reform!") + + taped = TRUE + processes = TRUE + +/datum/wound/brute/bone/treat(obj/item/I, mob/user) + if(istype(I, /obj/item/stack/medical/bone_gel)) + gel(I, user) + else if(istype(I, /obj/item/stack/sticky_tape/surgical)) + tape(I, user) + else if(istype(I, /obj/item/stack/medical/gauze)) + splint(I, user) + +/datum/wound/brute/bone/get_scanner_description(mob/user) + . = ..() + + . += "
" + + if(!gelled) + . += "Alternative Treatment: Apply bone gel directly to injured limb, then apply surgical tape to begin bone regeneration. This is both excruciatingly painful and slow, and only recommended in dire circumstances.\n" + else if(!taped) + . += "Continue Alternative Treatment: Apply surgical tape directly to injured limb to begin bone regeneration. Note, this is both excruciatingly painful and slow.\n" + else + . += "Note: Bone regeneration in effect. Bone is [round(regen_points_current/regen_points_needed)]% regenerated.\n" + + if(limb.body_zone == BODY_ZONE_HEAD) + . += "Cranial Trauma Detected: Patient will suffer random bouts of [severity == WOUND_SEVERITY_SEVERE ? "mild" : "severe"] brain traumas until bone is repaired." + else if(limb.body_zone == BODY_ZONE_CHEST && victim.blood_volume) + . += "Ribcage Trauma Detected: Further trauma to chest is likely to worsen internal bleeding until bone is repaired." + . += "
" diff --git a/code/datums/wounds/burns.dm b/code/datums/wounds/burns.dm new file mode 100644 index 000000000000..feff9bf4de45 --- /dev/null +++ b/code/datums/wounds/burns.dm @@ -0,0 +1,323 @@ + + + +// TODO: well, a lot really, but specifically I want to add potential fusing of clothing/equipment on the affected area, and limb infections, though those may go in body part code +/datum/wound/burn + a_or_from = "from" + wound_type = WOUND_LIST_BURN + processes = TRUE + sound_effect = 'sound/effects/sizzle1.ogg' + + treatable_by = list(/obj/item/stack/medical/gauze, /obj/item/stack/medical/ointment, /obj/item/stack/medical/mesh) // sterilizer and alcohol will require reagent treatments, coming soon + + // Flesh damage vars + /// How much damage to our flesh we currently have. Once both this and infestation reach 0, the wound is considered healed + var/flesh_damage = 5 + /// Our current counter for how much flesh regeneration we have stacked from regenerative mesh/synthflesh/whatever, decrements each tick and lowers flesh_damage + var/flesh_healing = 0 + + // Infestation vars (only for severe and critical) + /// How quickly infection breeds on this burn if we don't have disinfectant + var/infestation_rate = 0 + /// Our current level of infection + var/infestation = 0 + /// Our current level of sanitization/anti-infection, from disinfectants/alcohol/UV lights. While positive, totally pauses and slowly reverses infestation effects each tick + var/sanitization = 0 + + /// Once we reach infestation beyond WOUND_INFESTATION_SEPSIS, we get this many warnings before the limb is completely paralyzed (you'd have to ignore a really bad burn for a really long time for this to happen) + var/strikes_to_lose_limb = 3 + + /// The current bandage we have for this wound (maybe move bandages to the limb?) + var/obj/item/stack/current_bandage + +/datum/wound/burn/handle_process() + . = ..() + if(strikes_to_lose_limb == 0) + victim.adjustToxLoss(0.5) + if(prob(1)) + victim.visible_message("The infection on the remnants of [victim]'s [limb.name] shift and bubble nauseatingly!", "You can feel the infection on the remnants of your [limb.name] coursing through your veins!") + return + + if(victim.reagents) + if(victim.reagents.has_reagent(/datum/reagent/medicine/spaceacillin)) + sanitization += 0.9 + if(victim.reagents.has_reagent(/datum/reagent/space_cleaner/sterilizine/)) + sanitization += 0.9 + if(victim.reagents.has_reagent(/datum/reagent/medicine/mine_salve)) + sanitization += 0.3 + flesh_healing += 0.5 + + if(current_bandage) + current_bandage.absorption_capacity -= WOUND_BURN_SANITIZATION_RATE + if(current_bandage.absorption_capacity <= 0) + victim.visible_message("Pus soaks through \the [current_bandage] on [victim]'s [limb.name].", "Pus soaks through \the [current_bandage] on your [limb.name].", vision_distance=COMBAT_MESSAGE_RANGE) + QDEL_NULL(current_bandage) + treat_priority = TRUE + + if(flesh_healing > 0) + var/bandage_factor = (current_bandage ? current_bandage.splint_factor : 1) + flesh_damage = max(0, flesh_damage - 1) + flesh_healing = max(0, flesh_healing - bandage_factor) // good bandages multiply the length of flesh healing + + // here's the check to see if we're cleared up + if((flesh_damage <= 0) && (infestation <= 1)) + to_chat(victim, "The burns on your [limb.name] have cleared up!") + qdel(src) + return + + // sanitization is checked after the clearing check but before the rest, because we freeze the effects of infection while we have sanitization + if(sanitization > 0) + var/bandage_factor = (current_bandage ? current_bandage.splint_factor : 1) + infestation = max(0, infestation - WOUND_BURN_SANITIZATION_RATE) + sanitization = max(0, sanitization - (WOUND_BURN_SANITIZATION_RATE * bandage_factor)) + return + + infestation += infestation_rate + + switch(infestation) + if(0 to WOUND_INFECTION_MODERATE) + if(WOUND_INFECTION_MODERATE to WOUND_INFECTION_SEVERE) + if(prob(30)) + victim.adjustToxLoss(0.2) + if(prob(6)) + to_chat(victim, "The blisters on your [limb.name] ooze a strange pus...") + if(WOUND_INFECTION_SEVERE to WOUND_INFECTION_CRITICAL) + if(!disabling && prob(2)) + to_chat(victim, "Your [limb.name] completely locks up, as you struggle for control against the infection!") + disabling = TRUE + else if(disabling && prob(8)) + to_chat(victim, "You regain sensation in your [limb.name], but it's still in terrible shape!") + disabling = FALSE + else if(prob(20)) + victim.adjustToxLoss(0.5) + if(WOUND_INFECTION_CRITICAL to WOUND_INFECTION_SEPTIC) + if(!disabling && prob(3)) + to_chat(victim, "You suddenly lose all sensation of the festering infection in your [limb.name]!") + disabling = TRUE + else if(disabling && prob(3)) + to_chat(victim, "You can barely feel your [limb.name] again, and you have to strain to retain motor control!") + disabling = FALSE + else if(prob(1)) + to_chat(victim, "You contemplate life without your [limb.name]...") + victim.adjustToxLoss(0.75) + else if(prob(4)) + victim.adjustToxLoss(1) + if(WOUND_INFECTION_SEPTIC to INFINITY) + if(prob(infestation)) + switch(strikes_to_lose_limb) + if(3 to INFINITY) + to_chat(victim, "The skin on your [limb.name] is literally dripping off, you feel awful!") + if(2) + to_chat(victim, "The infection in your [limb.name] is literally dripping off, you feel horrible!") + if(1) + to_chat(victim, "Infection has just about completely claimed your [limb.name]!") + if(0) + to_chat(victim, "The last of the nerve endings in your [limb.name] wither away, as the infection completely paralyzes your joint connector.") + threshold_penalty = 120 // piss easy to destroy + var/datum/brain_trauma/severe/paralysis/sepsis = new (limb.body_zone) + victim.gain_trauma(sepsis) + strikes_to_lose_limb-- + +/datum/wound/burn/get_examine_description(mob/user) + if(strikes_to_lose_limb <= 0) + return "[victim.p_their(TRUE)] [limb.name] is completely dead and unrecognizable as organic." + + var/condition = "" + if(current_bandage) + var/bandage_condition + switch(current_bandage.absorption_capacity) + if(0 to 1.25) + bandage_condition = "nearly ruined " + if(1.25 to 2.75) + bandage_condition = "badly worn " + if(2.75 to 4) + bandage_condition = "slightly pus-stained " + if(4 to INFINITY) + bandage_condition = "clean " + + condition += " underneath a dressing of [bandage_condition] [current_bandage.name]" + else + switch(infestation) + if(WOUND_INFECTION_MODERATE to WOUND_INFECTION_SEVERE) + condition += ", with small spots of discoloration along the nearby veins!" + if(WOUND_INFECTION_SEVERE to WOUND_INFECTION_CRITICAL) + condition += ", with dark clouds spreading outwards under the skin!" + if(WOUND_INFECTION_CRITICAL to WOUND_INFECTION_SEPTIC) + condition += ", with streaks of rotten infection pulsating outward!" + if(WOUND_INFECTION_SEPTIC to INFINITY) + return "[victim.p_their(TRUE)] [limb.name] is a mess of char and rot, skin literally dripping off the bone with infection!" + else + condition += "!" + + return "[victim.p_their(TRUE)] [limb.name] [examine_desc][condition]" + +/datum/wound/burn/get_scanner_description(mob/user) + if(strikes_to_lose_limb == 0) + var/oopsie = "Type: [name]\nSeverity: [severity_text()]" + oopsie += "
Infection Level: The infection is total. The bodypart is lost. Amputate or augment limb immediately.
" + return oopsie + + . = ..() + . += "
" + + if(infestation <= sanitization && flesh_damage <= flesh_healing) + . += "No further treatment required: Burns will heal shortly." + else + switch(infestation) + if(WOUND_INFECTION_MODERATE to WOUND_INFECTION_SEVERE) + . += "Infection Level: Moderate\n" + if(WOUND_INFECTION_SEVERE to WOUND_INFECTION_CRITICAL) + . += "Infection Level: Severe\n" + if(WOUND_INFECTION_CRITICAL to WOUND_INFECTION_SEPTIC) + . += "Infection Level: CRITICAL\n" + if(WOUND_INFECTION_SEPTIC to INFINITY) + . += "Infection Level: LOSS IMMINENT\n" + if(infestation > sanitization) + . += "\tSurgical debridement, antiobiotics/sterilizers, or regenerative mesh will rid infection. Paramedic UV penlights are also effective.\n" + + if(flesh_damage > 0) + . += "Flesh damage detected: Please apply ointment or regenerative mesh to allow recovery.\n" + . += "
" + +/* + new burn common procs +*/ + +/// if someone is using ointment on our burns +/datum/wound/burn/proc/ointment(obj/item/stack/medical/ointment/I, mob/user) + user.visible_message("[user] begins applying [I] to [victim]'s [limb.name]...", "You begin applying [I] to [user == victim ? "your" : "[victim]'s"] [limb.name]...") + if(!do_after(user, (user == victim ? I.self_delay : I.other_delay), extra_checks = CALLBACK(src, .proc/still_exists))) + return + + limb.heal_damage(I.heal_brute, I.heal_burn) + user.visible_message("[user] applies [I] to [victim].", "You apply [I] to [user == victim ? "your" : "[victim]'s"] [limb.name].") + I.use(1) + sanitization += I.sanitization + flesh_healing += I.flesh_regeneration + + if((infestation <= 0 || sanitization >= infestation) && (flesh_damage <= 0 || flesh_healing > flesh_damage)) + to_chat(user, "You've done all you can with [I], now you must wait for the flesh on [victim]'s [limb.name] to recover.") + else + try_treating(I, user) + +/// for use in the burn dressing surgery since we don't want to make them do another do_after obviously +/datum/wound/burn/proc/force_bandage(obj/item/stack/medical/gauze/I, mob/user) + QDEL_NULL(current_bandage) + current_bandage = new I.type(limb) + current_bandage.amount = 1 + treat_priority = FALSE + sanitization += I.sanitization + I.use(1) + +/// if someone is wrapping gauze on our burns +/datum/wound/burn/proc/bandage(obj/item/stack/medical/gauze/I, mob/user) + if(current_bandage) + if(current_bandage.absorption_capacity > I.absorption_capacity + 1) + to_chat(user, "The [current_bandage] on [victim]'s [limb.name] is still in better condition than your [I.name]!") + return + user.visible_message("[user] begins to redress the burns on [victim]'s [limb.name] with [I]...", "You begin redressing the burns on [user == victim ? "your" : "[victim]'s"] [limb.name] with [I]...") + else + user.visible_message("[user] begins to dress the burns on [victim]'s [limb.name] with [I]...", "You begin dressing the burns on [user == victim ? "your" : "[victim]'s"] [limb.name] with [I]...") + + if(!do_after(user, (user == victim ? I.self_delay : I.other_delay), target=victim, extra_checks = CALLBACK(src, .proc/still_exists))) + return + + user.visible_message("[user] applies [I] to [victim].", "You apply [I] to [user == victim ? "your" : "[victim]'s"] [limb.name].") + QDEL_NULL(current_bandage) + current_bandage = new I.type(limb) + current_bandage.amount = 1 + treat_priority = FALSE + sanitization += I.sanitization + I.use(1) + +/// if someone is using mesh on our burns +/datum/wound/burn/proc/mesh(obj/item/stack/medical/mesh/I, mob/user) + user.visible_message("[user] begins wrapping [victim]'s [limb.name] with [I]...", "You begin wrapping [user == victim ? "your" : "[victim]'s"] [limb.name] with [I]...") + if(!do_after(user, (user == victim ? I.self_delay : I.other_delay), target=victim, extra_checks = CALLBACK(src, .proc/still_exists))) + return + + limb.heal_damage(I.heal_brute, I.heal_burn) + user.visible_message("[user] applies [I] to [victim].", "You apply [I] to [user == victim ? "your" : "[victim]'s"] [limb.name].") + I.use(1) + sanitization += I.sanitization + flesh_healing += I.flesh_regeneration + + if(sanitization >= infestation && flesh_healing > flesh_damage) + to_chat(user, "You've done all you can with [I], now you must wait for the flesh on [victim]'s [limb.name] to recover.") + else + try_treating(I, user) + +/// Paramedic UV penlights +/datum/wound/burn/proc/uv(obj/item/flashlight/pen/paramedic/I, mob/user) + if(I.uv_cooldown > world.time) + to_chat(user, "[I] is still recharging!") + return + if(infestation <= 0 || infestation < sanitization) + to_chat(user, "There's no infection to treat on [victim]'s [limb.name]!") + return + + user.visible_message("[user] flashes the burns on [victim]'s [limb] with [I].", "You flash the burns on [user == victim ? "your" : "[victim]'s"] [limb.name] with [I].", vision_distance=COMBAT_MESSAGE_RANGE) + sanitization += I.uv_power + I.uv_cooldown = world.time + I.uv_cooldown_length + +/datum/wound/burn/treat(obj/item/I, mob/user) + if(istype(I, /obj/item/stack/medical/gauze)) + bandage(I, user) + else if(istype(I, /obj/item/stack/medical/ointment)) + ointment(I, user) + else if(istype(I, /obj/item/stack/medical/mesh)) + mesh(I, user) + else if(istype(I, /obj/item/flashlight/pen/paramedic)) + uv(I, user) + +/// basic support for instabitaluri/synthflesh healing flesh damage, more chem support in the future +/datum/wound/burn/proc/regenerate_flesh(amount) + flesh_healing += amount * 0.5 // 20u patch will heal 10 flesh standard + +// we don't even care about first degree burns, straight to second +/datum/wound/burn/moderate + name = "Second Degree Burns" + desc = "Patient is suffering considerable burns with mild skin penetration, weakening limb integrity and increased burning sensations." + treat_text = "Recommended application of topical ointment or regenerative mesh to affected region." + examine_desc = "is badly burned and breaking out in blisters" + occur_text = "breaks out with violent red burns" + severity = WOUND_SEVERITY_MODERATE + damage_mulitplier_penalty = 1.1 + threshold_minimum = 40 + threshold_penalty = 30 // burns cause significant decrease in limb integrity compared to other wounds + status_effect_type = /datum/status_effect/wound/burn/moderate + flesh_damage = 5 + scarring_descriptions = list("small amoeba-shaped skinmarks", "a faded streak of depressed skin") + +/datum/wound/burn/severe + name = "Third Degree Burns" + desc = "Patient is suffering extreme burns with full skin penetration, creating serious risk of infection and greatly reduced limb integrity." + treat_text = "Recommended immediate disinfection and excision of any infected skin, followed by bandaging and ointment." + examine_desc = "appears seriously charred, with aggressive red splotches" + occur_text = "chars rapidly, exposing ruined tissue and spreading angry red burns" + severity = WOUND_SEVERITY_SEVERE + damage_mulitplier_penalty = 1.2 + threshold_minimum = 80 + threshold_penalty = 40 + status_effect_type = /datum/status_effect/wound/burn/severe + treatable_by = list(/obj/item/flashlight/pen/paramedic, /obj/item/stack/medical/gauze, /obj/item/stack/medical/ointment, /obj/item/stack/medical/mesh) + infestation_rate = 0.05 // appx 13 minutes to reach sepsis without any treatment + flesh_damage = 12.5 + scarring_descriptions = list("a large, jagged patch of faded skin", "random spots of shiny, smooth skin", "spots of taut, leathery skin") + +/datum/wound/burn/critical + name = "Catastrophic Burns" + desc = "Patient is suffering near complete loss of tissue and significantly charred muscle and bone, creating life-threatening risk of infection and negligible limb integrity." + treat_text = "Immediate surgical debriding of any infected skin, followed by potent tissue regeneration formula and bandaging." + examine_desc = "is a ruined mess of blanched bone, melted fat, and charred tissue" + occur_text = "vaporizes as flesh, bone, and fat melt together in a horrifying mess" + severity = WOUND_SEVERITY_CRITICAL + damage_mulitplier_penalty = 1.3 + sound_effect = 'sound/effects/sizzle2.ogg' + threshold_minimum = 140 + threshold_penalty = 80 + status_effect_type = /datum/status_effect/wound/burn/critical + treatable_by = list(/obj/item/flashlight/pen/paramedic, /obj/item/stack/medical/gauze, /obj/item/stack/medical/ointment, /obj/item/stack/medical/mesh) + infestation_rate = 0.15 // appx 4.33 minutes to reach sepsis without any treatment + flesh_damage = 20 + scarring_descriptions = list("massive, disfiguring keloid scars", "several long streaks of badly discolored and malformed skin", "unmistakeable splotches of dead tissue from serious burns") diff --git a/code/datums/wounds/cuts.dm b/code/datums/wounds/cuts.dm new file mode 100644 index 000000000000..61a4b8a1ea05 --- /dev/null +++ b/code/datums/wounds/cuts.dm @@ -0,0 +1,309 @@ + +/* + Cuts +*/ + +/datum/wound/brute/cut + sound_effect = 'sound/weapons/slice.ogg' + processes = TRUE + wound_type = WOUND_LIST_CUT + treatable_by = list(/obj/item/stack/medical/suture, /obj/item/stack/medical/gauze) + treatable_by_grabbed = list(/obj/item/gun/energy/laser) + treatable_tool = TOOL_CAUTERY + treat_priority = TRUE + base_treat_time = 3 SECONDS + + /// How much blood we start losing when this wound is first applied + var/initial_flow + /// When we have less than this amount of flow, either from treatment or clotting, we demote to a lower cut or are healed of the wound + var/minimum_flow + /// How fast our blood flow will naturally decrease per tick, not only do larger cuts bleed more faster, they clot slower + var/clot_rate + + /// Once the blood flow drops below minimum_flow, we demote it to this type of wound. If there's none, we're all better + var/demotes_to + + /// How much staunching per type (cautery, suturing, bandaging) you can have before that type is no longer effective for this cut NOT IMPLEMENTED + var/max_per_type + /// The maximum flow we've had so far + var/highest_flow + /// How much flow we've already cauterized + var/cauterized + /// How much flow we've already sutured + var/sutured + + /// The current bandage we have for this wound (maybe move bandages to the limb?) + var/obj/item/stack/current_bandage + /// A bad system I'm using to track the worst scar we earned (since we can demote, we want the biggest our wound has been, not what it was when it was cured (probably moderate)) + var/datum/scar/highest_scar + +/datum/wound/brute/cut/wound_injury(datum/wound/brute/cut/old_wound = null) + blood_flow = initial_flow + if(old_wound) + blood_flow = max(old_wound.blood_flow, initial_flow) + if(old_wound.severity > severity && old_wound.highest_scar) + highest_scar = old_wound.highest_scar + old_wound.highest_scar = null + if(old_wound.current_bandage) + current_bandage = old_wound.current_bandage + old_wound.current_bandage = null + + if(!highest_scar) + highest_scar = new + highest_scar.generate(limb, src, add_to_scars=FALSE) + +/datum/wound/brute/cut/remove_wound(ignore_limb, replaced) + if(!replaced && highest_scar) + already_scarred = TRUE + highest_scar.lazy_attach(limb) + return ..() + +/datum/wound/brute/cut/get_examine_description(mob/user) + if(!current_bandage) + return ..() + + var/bandage_condition = "" + // how much life we have left in these bandages + switch(current_bandage.absorption_capacity) + if(0 to 1.25) + bandage_condition = "nearly ruined " + if(1.25 to 2.75) + bandage_condition = "badly worn " + if(2.75 to 4) + bandage_condition = "slightly bloodied " + if(4 to INFINITY) + bandage_condition = "clean " + return "The cuts on [victim.p_their()] [limb.name] are wrapped with [bandage_condition] [current_bandage.name]!" + +/datum/wound/brute/cut/receive_damage(wounding_type, wounding_dmg, wound_bonus) + if(victim.stat != DEAD && wounding_type == WOUND_SHARP) // can't stab dead bodies to make it bleed faster this way + blood_flow += 0.05 * wounding_dmg + +/datum/wound/brute/cut/handle_process() + blood_flow = min(blood_flow, WOUND_CUT_MAX_BLOODFLOW) + + if(victim.reagents && victim.reagents.has_reagent(/datum/reagent/toxin/heparin)) + blood_flow += 0.5 // old herapin used to just add +2 bleed stacks per tick, this adds 0.5 bleed flow to all open cuts which is probably even stronger as long as you can cut them first + else if(victim.reagents && victim.reagents.has_reagent(/datum/reagent/medicine/coagulant)) + blood_flow -= 0.25 + + if(current_bandage) + if(clot_rate > 0) + blood_flow -= clot_rate + blood_flow -= current_bandage.absorption_rate + current_bandage.absorption_capacity -= current_bandage.absorption_rate + if(current_bandage.absorption_capacity < 0) + victim.visible_message("Blood soaks through \the [current_bandage] on [victim]'s [limb.name].", "Blood soaks through \the [current_bandage] on your [limb.name].", vision_distance=COMBAT_MESSAGE_RANGE) + QDEL_NULL(current_bandage) + treat_priority = TRUE + else + blood_flow -= clot_rate + + if(blood_flow > highest_flow) + highest_flow = blood_flow + + if(blood_flow < minimum_flow) + if(demotes_to) + replace_wound(demotes_to) + else + to_chat(victim, "The cut on your [limb.name] has stopped bleeding!") + qdel(src) + +/* BEWARE, THE BELOW NONSENSE IS MADNESS. bones.dm looks more like what I have in mind and is sufficiently clean, don't pay attention to this messiness */ + +/datum/wound/brute/cut/check_grab_treatments(obj/item/I, mob/user) + if(istype(I, /obj/item/gun/energy/laser)) + return TRUE + +/datum/wound/brute/cut/treat(obj/item/I, mob/user) + if(istype(I, /obj/item/gun/energy/laser)) + las_cauterize(I, user) + else if(I.tool_behaviour == TOOL_CAUTERY || I.get_temperature() > 300) + tool_cauterize(I, user) + else if(istype(I, /obj/item/stack/medical/gauze)) + bandage(I, user) + else if(istype(I, /obj/item/stack/medical/suture)) + suture(I, user) + +/datum/wound/brute/cut/try_handling(mob/living/carbon/human/user) + if(user.pulling != victim || user.zone_selected != limb.body_zone || user.a_intent == INTENT_GRAB) + return FALSE + + if(!isfelinid(user)) + return FALSE + + lick_wounds(user) + return TRUE + +/// if a felinid is licking this cut to reduce bleeding +/datum/wound/brute/cut/proc/lick_wounds(mob/living/carbon/human/user) + if(INTERACTING_WITH(user, victim)) + to_chat(user, "You're already interacting with [victim]!") + return + + user.visible_message("[user] begins licking the wounds on [victim]'s [limb.name].", "You begin licking the wounds on [victim]'s [limb.name]...", ignored_mobs=victim) + to_chat(victim, "[user] begins to lick the wounds on your [limb.name].[user] licks the wounds on [victim]'s [limb.name].", "You lick some of the wounds on [victim]'s [limb.name]", ignored_mobs=victim) + to_chat(victim, "[user] licks the wounds on your [limb.name]! minimum_flow) + try_handling(user) + else if(demotes_to) + to_chat(user, "You successfully lower the severity of [victim]'s cuts.") + +/datum/wound/brute/cut/on_xadone(power) + . = ..() + blood_flow -= 0.03 * power // i think it's like a minimum of 3 power, so .09 blood_flow reduction per tick is pretty good for 0 effort + +/// If someone's putting a laser gun up to our cut to cauterize it +/datum/wound/brute/cut/proc/las_cauterize(obj/item/gun/energy/laser/lasgun, mob/user) + var/self_penalty_mult = (user == victim ? 1.25 : 1) + user.visible_message("[user] begins aiming [lasgun] directly at [victim]'s [limb.name]...", "You begin aiming [lasgun] directly at [user == victim ? "your" : "[victim]'s"] [limb.name]...") + if(!do_after(user, base_treat_time * self_penalty_mult, target=victim, extra_checks = CALLBACK(src, .proc/still_exists))) + return + var/damage = lasgun.chambered.BB.damage + lasgun.chambered.BB.wound_bonus -= 30 + lasgun.chambered.BB.damage *= self_penalty_mult + if(!lasgun.process_fire(victim, victim, TRUE, null, limb.body_zone)) + return + victim.emote("scream") + blood_flow -= damage / (5 * self_penalty_mult) // 20 / 5 = 4 bloodflow removed, p good + cauterized += damage / (5 * self_penalty_mult) + victim.visible_message("The cuts on [victim]'s [limb.name] scar over!") + +/// If someone is using either a cautery tool or something with heat to cauterize this cut +/datum/wound/brute/cut/proc/tool_cauterize(obj/item/I, mob/user) + var/self_penalty_mult = (user == victim ? 1.5 : 1) + user.visible_message("[user] begins cauterizing [victim]'s [limb.name] with [I]...", "You begin cauterizing [user == victim ? "your" : "[victim]'s"] [limb.name] with [I]...") + var/time_mod = user.mind?.get_skill_modifier(/datum/skill/healing, SKILL_SPEED_MODIFIER) || 1 + if(!do_after(user, base_treat_time * time_mod * self_penalty_mult, target=victim, extra_checks = CALLBACK(src, .proc/still_exists))) + return + + user.visible_message("[user] cauterizes some of the bleeding on [victim].", "You cauterize some of the bleeding on [victim].") + limb.receive_damage(burn = 2 + severity, wound_bonus = CANT_WOUND) + if(prob(30)) + victim.emote("scream") + var/blood_cauterized = (0.6 / self_penalty_mult) + blood_flow -= blood_cauterized + cauterized += blood_cauterized + + if(blood_flow > minimum_flow) + try_treating(I, user) + else if(demotes_to) + to_chat(user, "You successfully lower the severity of [user == victim ? "your" : "[victim]'s"] cuts.") + +/// If someone is using a suture to close this cut +/datum/wound/brute/cut/proc/suture(obj/item/stack/medical/suture/I, mob/user) + var/self_penalty_mult = (user == victim ? 1.4 : 1) + user.visible_message("[user] begins stitching [victim]'s [limb.name] with [I]...", "You begin stitching [user == victim ? "your" : "[victim]'s"] [limb.name] with [I]...") + var/time_mod = user.mind?.get_skill_modifier(/datum/skill/healing, SKILL_SPEED_MODIFIER) || 1 + if(!do_after(user, base_treat_time * time_mod * self_penalty_mult, target=victim, extra_checks = CALLBACK(src, .proc/still_exists))) + return + user.visible_message("[user] stitches up some of the bleeding on [victim].", "You stitch up some of the bleeding on [user == victim ? "yourself" : "[victim]"].") + var/blood_sutured = I.stop_bleeding / self_penalty_mult + blood_flow -= blood_sutured + sutured += blood_sutured + limb.heal_damage(I.heal_brute, I.heal_burn) + + if(blood_flow > minimum_flow) + try_treating(I, user) + else if(demotes_to) + to_chat(user, "You successfully lower the severity of [user == victim ? "your" : "[victim]'s"] cuts.") + +/// If someone is using gauze on this cut +/datum/wound/brute/cut/proc/bandage(obj/item/stack/I, mob/user) + if(current_bandage) + if(current_bandage.absorption_capacity > I.absorption_capacity + 1) + to_chat(user, "The [current_bandage] on [victim]'s [limb.name] is still in better condition than your [I.name]!") + return + else + user.visible_message("[user] begins rewrapping the cuts on [victim]'s [limb.name] with [I]...", "You begin rewrapping the cuts on [user == victim ? "your" : "[victim]'s"] [limb.name] with [I]...") + else + user.visible_message("[user] begins wrapping the cuts on [victim]'s [limb.name] with [I]...", "You begin wrapping the cuts on [user == victim ? "your" : "[victim]'s"] [limb.name] with [I]...") + var/time_mod = user.mind?.get_skill_modifier(/datum/skill/healing, SKILL_SPEED_MODIFIER) || 1 + if(!do_after(user, base_treat_time * time_mod, target=victim, extra_checks = CALLBACK(src, .proc/still_exists))) + return + + user.visible_message("[user] applies [I] to [victim]'s [limb.name].", "You bandage some of the bleeding on [user == victim ? "yourself" : "[victim]"].") + QDEL_NULL(current_bandage) + current_bandage = new I.type(limb) + current_bandage.amount = 1 + treat_priority = FALSE + I.use(1) + + +/datum/wound/brute/cut/moderate + name = "Rough Abrasion" + desc = "Patient's skin has been badly scraped, generating moderate blood loss." + treat_text = "Application of clean bandages or first-aid grade sutures, followed by food and rest." + examine_desc = "has an open cut" + occur_text = "is cut open, slowly leaking blood" + sound_effect = 'sound/effects/blood1.ogg' + severity = WOUND_SEVERITY_MODERATE + initial_flow = 2 + minimum_flow = 0.5 + max_per_type = 3 + clot_rate = 0.15 + threshold_minimum = 20 + threshold_penalty = 10 + status_effect_type = /datum/status_effect/wound/cut/moderate + scarring_descriptions = list("light, faded lines", "minor cut marks", "a small faded slit", "a series of small scars") + +/datum/wound/brute/cut/severe + name = "Open Laceration" + desc = "Patient's skin is ripped clean open, allowing significant blood loss." + treat_text = "Speedy application of first-aid grade sutures and clean bandages, followed by vitals monitoring to ensure recovery." + examine_desc = "has a severe cut" + occur_text = "is ripped open, veins spurting blood" + sound_effect = 'sound/effects/blood2.ogg' + severity = WOUND_SEVERITY_SEVERE + initial_flow = 3.25 + minimum_flow = 2.75 + clot_rate = 0.07 + max_per_type = 4 + threshold_minimum = 50 + threshold_penalty = 25 + demotes_to = /datum/wound/brute/cut/moderate + status_effect_type = /datum/status_effect/wound/cut/severe + scarring_descriptions = list("a twisted line of faded gashes", "a gnarled sickle-shaped slice scar", "a long-faded puncture wound") + +/datum/wound/brute/cut/critical + name = "Weeping Avulsion" + desc = "Patient's skin is completely torn open, along with significant loss of tissue. Extreme blood loss will lead to quick death without intervention." + treat_text = "Immediate bandaging and either suturing or cauterization, followed by supervised resanguination." + examine_desc = "is spurting blood at an alarming rate" + occur_text = "is torn open, spraying blood wildly" + sound_effect = 'sound/effects/blood3.ogg' + severity = WOUND_SEVERITY_CRITICAL + initial_flow = 4.25 + minimum_flow = 4 + clot_rate = -0.05 // critical cuts actively get worse instead of better + max_per_type = 5 + threshold_minimum = 80 + threshold_penalty = 40 + demotes_to = /datum/wound/brute/cut/severe + status_effect_type = /datum/status_effect/wound/cut/critical + scarring_descriptions = list("a winding path of very badly healed scar tissue", "a series of peaks and valleys along a gruesome line of cut scar tissue", "a grotesque snake of indentations and stitching scars") + +// TODO: see about moving dismemberment over to this, i'll have to add judging dismembering power/wound potential wrt item size i guess +/datum/wound/brute/cut/loss + name = "Dismembered" + desc = "oof ouch!!" + occur_text = "is violently dismembered!" + sound_effect = 'sound/effects/dismember.ogg' + viable_zones = list(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) + severity = WOUND_SEVERITY_LOSS + threshold_minimum = 180 + status_effect_type = null + +/datum/wound/brute/cut/loss/apply_wound(obj/item/bodypart/L, silent, datum/wound/brute/cut/old_wound, smited = FALSE) + if(!L.dismemberable) + qdel(src) + return + + L.dismember() + qdel(src) diff --git a/code/datums/wounds/scars/_scars.dm b/code/datums/wounds/scars/_scars.dm new file mode 100644 index 000000000000..bfbaab835e64 --- /dev/null +++ b/code/datums/wounds/scars/_scars.dm @@ -0,0 +1,134 @@ +/** + * scars are cosmetic datums that are assigned to bodyparts once they recover from wounds. Each wound type and severity have their own descriptions for what the scars + * look like, and then each body part has a list of "specific locations" like your elbow or wrist or wherever the scar can appear, to make it more interesting than "right arm" + * + * + * Arguments: + * * + */ +/datum/scar + var/obj/item/bodypart/limb + var/mob/living/carbon/victim + var/severity + var/description + var/precise_location + + /// Scars from the longtimer quirk are "fake" and won't be saved with persistent scarring, since it makes you spawn with a lot by default + var/fake=FALSE + + /// How many tiles away someone can see this scar, goes up with severity. Clothes covering this limb will decrease visibility by 1 each, except for the head/face which is a binary "is mask obscuring face" check + var/visibility = 2 + /// Whether this scar can actually be covered up by clothing + var/coverable = TRUE + /// What zones this scar can be applied to + var/list/applicable_zones = list(BODY_ZONE_CHEST, BODY_ZONE_HEAD, BODY_ZONE_L_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_ARM, BODY_ZONE_R_LEG) + +/datum/scar/Destroy(force, ...) + if(limb) + LAZYREMOVE(limb.scars, src) + if(victim) + LAZYREMOVE(victim.all_scars, src) + . = ..() + +/** + * generate() is used to actually fill out the info for a scar, according to the limb and wound it is provided. + * + * After creating a scar, call this on it while targeting the scarred bodypart with a given wound to apply the scar. + * + * Arguments: + * * BP- The bodypart being targeted + * * W- The wound being used to generate the severity and description info + * * add_to_scars- Should always be TRUE unless you're just storing a scar for later usage, like how cuts want to store a scar for the highest severity of cut, rather than the severity when the wound is fully healed (probably demoted to moderate) + */ +/datum/scar/proc/generate(obj/item/bodypart/BP, datum/wound/W, add_to_scars=TRUE) + if(!(BP.body_zone in applicable_zones)) + qdel(src) + return + limb = BP + severity = W.severity + if(limb.owner) + victim = limb.owner + if(add_to_scars) + LAZYADD(limb.scars, src) + if(victim) + LAZYADD(victim.all_scars, src) + + description = pick(W.scarring_descriptions) + precise_location = pick(limb.specific_locations) + switch(W.severity) + if(WOUND_SEVERITY_MODERATE) + visibility = 2 + if(WOUND_SEVERITY_SEVERE) + visibility = 3 + if(WOUND_SEVERITY_CRITICAL) + visibility = 5 + +/// Used when we finalize a scar from a healing cut +/datum/scar/proc/lazy_attach(obj/item/bodypart/BP, datum/wound/W) + LAZYADD(BP.scars, src) + if(BP.owner) + victim = BP.owner + LAZYADD(victim.all_scars, src) + +/// Used to "load" a persistent scar +/datum/scar/proc/load(obj/item/bodypart/BP, description, specific_location, severity=WOUND_SEVERITY_SEVERE) + if(!(BP.body_zone in applicable_zones)) + qdel(src) + return + limb = BP + src.severity = severity + LAZYADD(limb.scars, src) + if(BP.owner) + victim = BP.owner + LAZYADD(victim.all_scars, src) + src.description = description + precise_location = specific_location + switch(severity) + if(WOUND_SEVERITY_MODERATE) + visibility = 2 + if(WOUND_SEVERITY_SEVERE) + visibility = 3 + if(WOUND_SEVERITY_CRITICAL) + visibility = 5 + return TRUE + +/// What will show up in examine_more() if this scar is visible +/datum/scar/proc/get_examine_description(mob/viewer) + if(!victim || !is_visible(viewer)) + return + + var/msg = "[victim.p_they(TRUE)] [victim.p_have()] [description] on [victim.p_their()] [precise_location]." + switch(severity) + if(WOUND_SEVERITY_MODERATE) + msg = "[msg]" + if(WOUND_SEVERITY_SEVERE) + msg = "[msg]" + if(WOUND_SEVERITY_CRITICAL) + msg = "[msg]" + return "\t[msg]" + +/// Whether a scar can currently be seen by the viewer +/datum/scar/proc/is_visible(mob/viewer) + if(!victim || !viewer) + return + if(get_dist(viewer, victim) > visibility) + return + + if(!ishuman(victim) || isobserver(viewer) || victim == viewer) + return TRUE + + var/mob/living/carbon/human/H = victim + if(istype(limb, /obj/item/bodypart/head)) + if((H.wear_mask && (H.wear_mask.flags_inv & HIDEFACE)) || (H.head && (H.head.flags_inv & HIDEFACE))) + return FALSE + else if(limb.scars_covered_by_clothes) + var/num_covers = LAZYLEN(H.clothingonpart(limb)) + if(num_covers + get_dist(viewer, victim) >= visibility) + return FALSE + + return TRUE + +/// Used to format a scar to safe in preferences for persistent scars +/datum/scar/proc/format() + if(!fake) + return "[limb.body_zone]|[description]|[precise_location]|[severity]" diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 5cecc473357f..8742a75a9b05 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -488,6 +488,20 @@ SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .) +/** + * Called when a mob examines (shift click or verb) this atom twice (or more) within EXAMINE_MORE_TIME (default 1.5 seconds) + * + * This is where you can put extra information on something that may be superfluous or not important in critical gameplay + * moments, while allowing people to manually double-examine to take a closer look + * + * Produces a signal [COMSIG_PARENT_EXAMINE_MORE] + */ +/atom/proc/examine_more(mob/user) + . = list() + SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE_MORE, user, .) + if(!LAZYLEN(.)) // lol ..length + return list("You examine [src] closer, but find nothing of interest...") + /** * An atom we are buckled or is contained within us has tried to move * @@ -1101,6 +1115,38 @@ var/reverse_message = "has been [what_done] by [ssource][postfix]" target.log_message(reverse_message, LOG_ATTACK, color="orange", log_globally=FALSE) +/** + * log_wound() is for when someone is *attacked* and suffers a wound. Note that this only captures wounds from damage, so smites/forced wounds aren't logged, as well as demotions like cuts scabbing over + * + * Note that this has no info on the attack that dealt the wound: information about where damage came from isn't passed to the bodypart's damaged proc. When in doubt, check the attack log for attacks at that same time + * TODO later: Add logging for healed wounds, though that will require some rewriting of healing code to prevent admin heals from spamming the logs. Not high priority + * + * Arguments: + * * victim- The guy who got wounded + * * suffered_wound- The wound, already applied, that we're logging. It has to already be attached so we can get the limb from it + * * dealt_damage- How much damage is associated with the attack that dealt with this wound. + * * dealt_wound_bonus- The wound_bonus, if one was specified, of the wounding attack + * * dealt_bare_wound_bonus- The bare_wound_bonus, if one was specified *and applied*, of the wounding attack. Not shown if armor was present + * * base_roll- Base wounding ability of an attack is a random number from 1 to (dealt_damage ** WOUND_DAMAGE_EXPONENT). This is the number that was rolled in there, before mods + */ +/proc/log_wound(atom/victim, datum/wound/suffered_wound, dealt_damage, dealt_wound_bonus, dealt_bare_wound_bonus, base_roll) + var/message = "has suffered: [suffered_wound] to [suffered_wound.limb.name]" // maybe indicate if it's a promote/demote? + + if(dealt_damage) + message += " | Damage: [dealt_damage]" + // The base roll is useful since it can show how lucky someone got with the given attack. For example, dealing a cut + if(base_roll) + message += "(rolled [base_roll]/[dealt_damage ** WOUND_DAMAGE_EXPONENT])" + + if(dealt_wound_bonus) + message += " | WB: [dealt_wound_bonus]" + + if(dealt_bare_wound_bonus) + message += " | BWB: [dealt_bare_wound_bonus]" + + victim.log_message(message, LOG_ATTACK, color="blue") + + /atom/movable/proc/add_filter(name,priority,list/params) if(!filter_data) filter_data = list() diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 665ff85b222e..2d5dfe985826 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -371,6 +371,10 @@ /obj/machinery/door/proc/crush() for(var/mob/living/L in get_turf(src)) L.visible_message("[src] closes on [L], crushing [L.p_them()]!", "[src] closes on you and crushes you!") + if(iscarbon(L)) + var/mob/living/carbon/C = L + for(var/datum/wound/W in C.all_wounds) + W.crush(DOOR_CRUSH_DAMAGE) if(isalien(L)) //For xenos L.adjustBruteLoss(DOOR_CRUSH_DAMAGE * 1.5) //Xenos go into crit after aproximately the same amount of crushes as humans. L.emote("roar") diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index bd77bd88c498..f647e978e7a2 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -180,9 +180,21 @@ var/T = get_turf(target) if(locate(/mob/living) in T) new /obj/effect/temp_visual/medical_holosign(T,user) //produce a holographic glow - holo_cooldown = world.time + 100 + holo_cooldown = world.time + 10 SECONDS return +// see: [/datum/wound/burn/proc/uv()] +/obj/item/flashlight/pen/paramedic + name = "paramedic penlight" + desc = "A high-powered UV penlight intended to help stave off infection in the field on serious burned patients. Probably really bad to look into." + icon_state = "penlight_surgical" + /// Our current UV cooldown + var/uv_cooldown = 0 + /// How long between UV fryings + var/uv_cooldown_length = 1 MINUTES + /// How much sanitization to apply to the burn wound + var/uv_power = 1 + /obj/effect/temp_visual/medical_holosign name = "medical holosign" desc = "A small holographic glow that indicates a medic is coming to treat a patient." diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 1c19a96cd32b..f03024e3307b 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -8,8 +8,13 @@ GAS ANALYZER SLIME SCANNER NANITE SCANNER GENE SCANNER - */ + +// Describes the three modes of scanning available for health analyzers +#define SCANMODE_HEALTH 0 +#define SCANMODE_CHEMICAL 1 +#define SCANMODE_WOUND 2 + /obj/item/t_scanner name = "\improper T-ray scanner" desc = "A terahertz-ray emitter and scanner used to detect underfloor objects such as cables and pipes." @@ -95,12 +100,14 @@ GENE SCANNER return BRUTELOSS /obj/item/healthanalyzer/attack_self(mob/user) - if(!scanmode) - to_chat(user, "You switch the health analyzer to scan chemical contents.") - scanmode = 1 - else - to_chat(user, "You switch the health analyzer to check physical health.") - scanmode = 0 + scanmode = (scanmode + 1) % 3 + switch(scanmode) + if(SCANMODE_HEALTH) + to_chat(user, "You switch the health analyzer to check physical health.") + if(SCANMODE_CHEMICAL) + to_chat(user, "You switch the health analyzer to scan chemical contents.") + if(SCANMODE_WOUND) + to_chat(user, "You switch the health analyzer to report extra info on wounds.") /obj/item/healthanalyzer/attack(mob/living/M, mob/living/carbon/human/user) flick("[icon_state]-scan", src) //makes it so that it plays the scan animation upon scanning, including clumsy scanning @@ -117,10 +124,13 @@ GENE SCANNER user.visible_message("[user] has analyzed [M]'s vitals.") - if(scanmode == 0) + switch(scanmode) + if(SCANMODE_HEALTH) healthscan(user, M, advanced) - else if(scanmode == 1) + if(SCANMODE_CHEMICAL) chemscan(user, M) + else + woundscan(user, M, src) add_fingerprint(user) @@ -177,6 +187,8 @@ GENE SCANNER trauma_desc += "severe " if(TRAUMA_RESILIENCE_LOBOTOMY) trauma_desc += "deep-rooted " + if(TRAUMA_RESILIENCE_WOUND) + trauma_desc += "fracture-derived " if(TRAUMA_RESILIENCE_MAGIC, TRAUMA_RESILIENCE_ABSOLUTE) trauma_desc += "permanent " trauma_desc += B.scan_desc @@ -368,6 +380,18 @@ GENE SCANNER if(tdelta < (DEFIB_TIME_LIMIT * 10)) to_chat(user, "Subject died [DisplayTimeText(tdelta)] ago, defibrillation may be possible!") + // Wounds + if(iscarbon(M)) + var/mob/living/carbon/C = M + var/list/wounded_parts = C.get_wounded_bodyparts() + for(var/i in wounded_parts) + var/obj/item/bodypart/wounded_part = i + render_list += "Warning: Physical trauma[LAZYLEN(wounded_part.wounds) > 1? "s" : ""] detected in [wounded_part.name]" + for(var/k in wounded_part.wounds) + var/datum/wound/W = k + render_list += "
Type: [W.name]\nSeverity: [W.severity_text()]\nRecommended Treatment: [W.treat_text]
\n" // less lines than in woundscan() so we don't overload people trying to get basic med info + render_list += "
" + for(var/thing in M.diseases) var/datum/disease/D = thing if(!(D.visibility_flags & HIDDEN_SCANNER)) @@ -380,7 +404,7 @@ GENE SCANNER if(blood_id) if(ishuman(C)) var/mob/living/carbon/human/H = C - if(H.bleed_rate) + if(H.is_bleeding()) to_chat(user, "Subject is bleeding!") var/blood_percent = round((C.blood_volume / BLOOD_VOLUME_NORMAL(C))*100) var/blood_type = C.dna.blood_type @@ -447,6 +471,63 @@ GENE SCANNER return TRUE return +/// Displays wounds with extended information on their status vs medscanners +/proc/woundscan(mob/user, mob/living/carbon/patient, obj/item/healthanalyzer/wound/scanner) + if(!istype(patient)) + return + + var/render_list = "" + for(var/i in patient.get_wounded_bodyparts()) + var/obj/item/bodypart/wounded_part = i + render_list += "Warning: Physical trauma[LAZYLEN(wounded_part.wounds) > 1? "s" : ""] detected in [wounded_part.name]" + for(var/k in wounded_part.wounds) + var/datum/wound/W = k + render_list += "
[W.get_scanner_description()]
\n" + render_list += "
" + + if(render_list == "") + playsound(scanner, 'sound/machines/ping.ogg', 50, FALSE) + to_chat(user, "\The [scanner] makes a happy ping and briefly displays a smiley face with several exclamation points! It's really excited to report that [patient] has no wounds!") + else + to_chat(user, jointext(render_list, "")) + +/obj/item/healthanalyzer/wound + name = "first aid analyzer" + icon_state = "adv_spectrometer" + desc = "A prototype MeLo-Tech medical scanner used to diagnose injuries and recommend treatment for serious wounds, but offers no further insight into the patient's health. You hope the final version is less annoying to read!" + var/next_encouragement + var/greedy + +/obj/item/healthanalyzer/wound/attack_self(mob/user) + if(next_encouragement < world.time) + playsound(src, 'sound/machines/ping.ogg', 50, FALSE) + var/list/encouragements = list("briefly displays a happy face, gazing emptily at you", "briefly displays a spinning cartoon heart", "displays an encouraging message about eating healthy and exercising", \ + "reminds you that everyone is doing their best", "displays a message wishing you well", "displays a sincere thank-you for your interest in first-aid", "formally absolves you of all your sins") + to_chat(user, "\The [src] makes a happy ping and [pick(encouragements)]!") + next_encouragement = world.time + 10 SECONDS + greedy = FALSE + else if(!greedy) + to_chat(user, "\The [src] displays an eerily high-definition frowny face, chastizing you for asking it for too much encouragement.") + greedy = TRUE + else + playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE) + if(isliving(user)) + var/mob/living/L = user + to_chat(L, "\The [src] makes a disappointed buzz and pricks your finger for being greedy. Ow!") + L.adjustBruteLoss(4) + L.dropItemToGround(src) + +/obj/item/healthanalyzer/wound/attack(mob/living/carbon/patient, mob/living/carbon/human/user) + add_fingerprint(user) + user.visible_message("[user] scans [patient] for serious injuries.", "You scan [patient] for serious injuries.") + + if(!istype(patient)) + playsound(src, 'sound/machines/buzz-sigh.ogg', 30, TRUE) + to_chat(user, "\The [src] makes a sad buzz and briefly displays a frowny face, indicating it can't scan [patient].") + return + + woundscan(user, patient, src) + /obj/item/analyzer desc = "A hand-held environmental scanner which reports current gas levels. Alt-Click to use the built in barometer function." name = "analyzer" @@ -821,3 +902,7 @@ GENE SCANNER return "[HM.name] ([HM.alias])" else return HM.alias + +#undef SCANMODE_HEALTH +#undef SCANMODE_CHEMICAL +#undef SCANMODE_WOUND \ No newline at end of file diff --git a/code/game/objects/items/holy_weapons.dm b/code/game/objects/items/holy_weapons.dm index d2b489cdb757..795e88fcab1c 100644 --- a/code/game/objects/items/holy_weapons.dm +++ b/code/game/objects/items/holy_weapons.dm @@ -245,6 +245,7 @@ throwforce = 10 w_class = WEIGHT_CLASS_TINY obj_flags = UNIQUE_RENAME + wound_bonus = -10 var/reskinned = FALSE var/chaplain_spawnable = TRUE @@ -656,6 +657,8 @@ item_flags = ABSTRACT w_class = WEIGHT_CLASS_HUGE sharpness = IS_SHARP + wound_bonus = -20 + bare_wound_bonus = 25 /obj/item/nullrod/armblade/Initialize() . = ..() diff --git a/code/game/objects/items/kitchen.dm b/code/game/objects/items/kitchen.dm index 7d23ef3b5d10..029759351c0f 100644 --- a/code/game/objects/items/kitchen.dm +++ b/code/game/objects/items/kitchen.dm @@ -80,6 +80,8 @@ armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 50) var/bayonet = TRUE //Can this be attached to a gun? custom_price = 30 + wound_bonus = -5 + bare_wound_bonus = 10 /obj/item/kitchen/knife/Initialize() . = ..() @@ -192,7 +194,7 @@ /obj/item/kitchen/knife/carrotshiv/suicide_act(mob/living/carbon/user) user.visible_message("[user] forcefully drives \the [src] into [user.p_their()] eye! It looks like [user.p_theyre()] trying to commit suicide!") return BRUTELOSS - + // Shank - Makeshift weapon that can embed on throw /obj/item/kitchen/knife/shank name = "Shank" diff --git a/code/game/objects/items/manuals.dm b/code/game/objects/items/manuals.dm index f77f8511a05f..a2dce52c72ee 100644 --- a/code/game/objects/items/manuals.dm +++ b/code/game/objects/items/manuals.dm @@ -211,15 +211,15 @@ var/wikiurl = CONFIG_GET(string/wikiurl) if(wikiurl) dat = {" -