mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-25 16:45:42 +00:00
About The Pull Request
This PR adds medical wounds, new forms of injuries that people can suffer that cause debilitation and complications, and often require more than what can be found in a medkit to treat. But let's be honest, big complicated walls of text about medical changes make people's eyes glaze over easily- so I created a handy infograph to explain the basics!
Also there's a full guide here!
dreamseeker_2020-04-18_20-42-19.png
The infograph may not be fully up to date with the specifics of the PR's status, but it'll be updated along with major changes so people have something to use as a crash course for familiarizing themselves with how wounds function. I also have another infograph with all 9 of the possible initial wounds coming, and will be up soon. You can also find the longform design doc here with more info on the broad details, including descriptions of treatments: hackmd whee
What this does
There's a lot to cover, but here's the bullet points of the main features and changes:
Getting lots of damage on a limb can result in wounds, with more damage causing worse wounds. These can range from dislocated joints and minor cuts to compound fractures and fourth degree burns, and can affect you in different ways depending on what bodypart they're applied to (namely with broken bones).
You can damage individual bodyparts on clothing (only jumpsuits for now) through the use of lasers and sharp weapons. Bodyparts that reach max damage are considered "shredded" and will not apply any protection for that zone until it is repaired with cloth. If all zones are disabled, the entire piece of clothing is shredded and unwearable until repaired with 3 cloth. Jumpsuits give a small amount of wound protection, and since sharp weapons and lasers generally get extra wound bonuses against bare flesh, even a plain jumpsuit provides decent protection from a few laser shots or scalpel stabs.
Lasers gain a powerful niche versus unarmored/lightly armored carbons! As noted above, lasers can shred clothing and burn away zones of jumpsuits in 2 shots each, after which the target's bare flesh is exposed (barring other clothing), and lasers excel at dealing burn wounds against uncovered skin. Think big, nasty charring!
Bleeding is now totally limb based, and gauze is as well. Bleeding is also 95% cut wound based, meaning sharp weapons make you bleed rather than just having 40+ brute on a limb.
The more wounds and damage you get on a bodypart, the easier it'll be to gain more severe wounds. Wounds are arranged from Moderate, to Severe, to Critical in increasing severity, and you'll generally have to suffer the lesser ones before getting the worse ones.
dreamseeker_2020-05-15_03-15-59.png
Above: Someone having an incredibly bad day from bloodloss
dreamseeker_2020-05-04_22-29-29.png
Above: Scars from healed wounds
ShareX_2020-05-15_06-55-20.png
Above: Actual combat involving someone's head getting cracked
Here's a quick, if non-exhaustive, list of things I have left to do before I consider it feature complete
Finish adding treatments for each wound type/severity (mostly surgeries/triage for critical wounds)
Add second winds for bad injuries to give the victim a chance to get away
Flesh out severe & critical injuries in general
Find sprites for the bonesetter, bone gel, and anything else that might be needed
Add the medical items for treating the less severe wounds to the station
Polish code and remove any redundancies I left behind
Quick balance pass to make sure nothing is horribly abuseable
Why It's Good For The Game
Adds a flexible new system for representing damage on carbons with injuries that can be treated in different ways. Moderate wounds from getting toolboxed or sliced with a scalpel can usually be treated by a buddy or even by yourself with the right tools, but getting flayed with a fireaxe or a laser gun emptied into your bare skin may require extra attention or even surgery in bad cases! Also makes laser guns cooler and more like 40k lasguns that can flash fry people (cool!)
This should also make spessmen more resilient and harder to kill outright, while still adding consequences and complications to getting hurt. Wounds aren't immediately fatal, but they can do things like slow down interactions, deal damage over time through infections, and generally make you more fragile until fixed. They can also give you a "second wind" on being applied that gives you a small adrenaline boost (or whatever) to help disengage and escape immediate danger.
Changelog
🆑 Ryll/Shaps
add: Introduces medical wounds, new injuries that can happen to fleshy carbons when they sustain lots of damage on a bodypart. There's quite a lot of change here, but you can read the guide at: https://tgstation13.org/wiki/Guide_to_wounds and an extended changelog is available here: https://hackmd.io/l_FI9b3tSqa_woDadewJXA
add: Introduces scars and temporal scarring! Healing a wound leaves a scar behind that can be seen by examining someone twice rapidly, and if Temporal Scarring is enabled in character prefs, surviving a round with scars will save them to be granted at roundstart another round! Let your body tell stories!
tweak: Bleeding is now fully bodypart-focused, and 95% of bleeding comes from cut wounds from sharp weapons. Gauze is applied on a limb-by-limb basis, and helps staunch bloodflow rather than totally stop it. Notably, you no longer bleed just from having 40+ brute damage on a limb.
del: Organic bodyparts are no longer disabled at maximum damage, but are easier to cause wounds to
add: O2 medkits in emergency lockers have been replaced with new emergency medkits with basic tools for diagnosing and treating wounds and basic damage
tweak: Herapin now rapidly increases bleeding on all open cuts, rather than causing bleeding by itself. The more cuts on the target, the more it will affect them.
tweak: Neckgrab table slams now hit the targeted limb rather than just the head, with a large chance to dislocate or break a bone
tweak: Sharp weapons and burning weapons can now shred zones on jumpsuits, disabling protection on that limb. Damaged clothes can be repaired with cloth.
tweak: Slaughter demons now deal less raw damage, but gain the ability to cause cut wounds, which becomes more powerful with each attack on a humanoid but resets when bloodcrawling.
/🆑
269 lines
10 KiB
Plaintext
269 lines
10 KiB
Plaintext
//Status effects are used to apply temporary or permanent effects to mobs. Mobs are aware of their status effects at all times.
|
|
//This file contains their code, plus code for applying and removing them.
|
|
//When making a new status effect, add a define to status_effects.dm in __DEFINES for ease of use!
|
|
|
|
/datum/status_effect
|
|
var/id = "effect" //Used for screen alerts.
|
|
var/duration = -1 //How long the status effect lasts in DECISECONDS. Enter -1 for an effect that never ends unless removed through some means.
|
|
var/tick_interval = 10 //How many deciseconds between ticks, approximately. Leave at 10 for every second. Setting this to -1 will stop processing if duration is also unlimited.
|
|
var/mob/living/owner //The mob affected by the status effect.
|
|
var/status_type = STATUS_EFFECT_UNIQUE //How many of the effect can be on one mob, and what happens when you try to add another
|
|
var/on_remove_on_mob_delete = FALSE //if we call on_remove() when the mob is deleted
|
|
var/examine_text //If defined, this text will appear when the mob is examined - to use he, she etc. use "SUBJECTPRONOUN" and replace it in the examines themselves
|
|
var/alert_type = /obj/screen/alert/status_effect //the alert thrown by the status effect, contains name and description
|
|
var/obj/screen/alert/status_effect/linked_alert = null //the alert itself, if it exists
|
|
|
|
/datum/status_effect/New(list/arguments)
|
|
on_creation(arglist(arguments))
|
|
|
|
/datum/status_effect/proc/on_creation(mob/living/new_owner, ...)
|
|
if(new_owner)
|
|
owner = new_owner
|
|
if(owner)
|
|
LAZYADD(owner.status_effects, src)
|
|
if(!owner || !on_apply())
|
|
qdel(src)
|
|
return
|
|
if(duration != -1)
|
|
duration = world.time + duration
|
|
tick_interval = world.time + tick_interval
|
|
if(alert_type)
|
|
var/obj/screen/alert/status_effect/A = owner.throw_alert(id, alert_type)
|
|
A.attached_effect = src //so the alert can reference us, if it needs to
|
|
linked_alert = A //so we can reference the alert, if we need to
|
|
if(duration > 0 || initial(tick_interval) > 0) //don't process if we don't care
|
|
START_PROCESSING(SSfastprocess, src)
|
|
return TRUE
|
|
|
|
/datum/status_effect/Destroy()
|
|
STOP_PROCESSING(SSfastprocess, src)
|
|
if(owner)
|
|
owner.clear_alert(id)
|
|
LAZYREMOVE(owner.status_effects, src)
|
|
on_remove()
|
|
owner = null
|
|
return ..()
|
|
|
|
/datum/status_effect/process()
|
|
if(!owner)
|
|
qdel(src)
|
|
return
|
|
if(tick_interval < world.time)
|
|
tick()
|
|
tick_interval = world.time + initial(tick_interval)
|
|
if(duration != -1 && duration < world.time)
|
|
qdel(src)
|
|
|
|
/datum/status_effect/proc/on_apply() //Called whenever the buff is applied; returning FALSE will cause it to autoremove itself.
|
|
return TRUE
|
|
/datum/status_effect/proc/tick() //Called every tick.
|
|
/datum/status_effect/proc/on_remove() //Called whenever the buff expires or is removed; do note that at the point this is called, it is out of the owner's status_effects but owner is not yet null
|
|
/datum/status_effect/proc/be_replaced() //Called instead of on_remove when a status effect is replaced by itself or when a status effect with on_remove_on_mob_delete = FALSE has its mob deleted
|
|
owner.clear_alert(id)
|
|
LAZYREMOVE(owner.status_effects, src)
|
|
owner = null
|
|
qdel(src)
|
|
|
|
/datum/status_effect/proc/before_remove() //! Called before being removed; returning FALSE will cancel removal
|
|
return TRUE
|
|
|
|
/datum/status_effect/proc/refresh()
|
|
var/original_duration = initial(duration)
|
|
if(original_duration == -1)
|
|
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
|
|
|
|
/datum/status_effect/proc/nextmove_adjust()
|
|
return 0
|
|
|
|
////////////////
|
|
// ALERT HOOK //
|
|
////////////////
|
|
|
|
/obj/screen/alert/status_effect
|
|
name = "Curse of Mundanity"
|
|
desc = "You don't feel any different..."
|
|
var/datum/status_effect/attached_effect
|
|
|
|
//////////////////
|
|
// HELPER PROCS //
|
|
//////////////////
|
|
|
|
/mob/living/proc/apply_status_effect(effect, ...) //applies a given status effect to this mob, returning the effect if it was successful
|
|
. = FALSE
|
|
var/datum/status_effect/S1 = effect
|
|
LAZYINITLIST(status_effects)
|
|
for(var/datum/status_effect/S in status_effects)
|
|
if(S.id == initial(S1.id) && S.status_type)
|
|
if(S.status_type == STATUS_EFFECT_REPLACE)
|
|
S.be_replaced()
|
|
else if(S.status_type == STATUS_EFFECT_REFRESH)
|
|
S.refresh()
|
|
return
|
|
else
|
|
return
|
|
var/list/arguments = args.Copy()
|
|
arguments[1] = src
|
|
S1 = new effect(arguments)
|
|
. = S1
|
|
|
|
/mob/living/proc/remove_status_effect(effect, ...) //removes all of a given status effect from this mob, returning TRUE if at least one was removed
|
|
. = FALSE
|
|
var/list/arguments = args.Copy(2)
|
|
if(status_effects)
|
|
var/datum/status_effect/S1 = effect
|
|
for(var/datum/status_effect/S in status_effects)
|
|
if(initial(S1.id) == S.id && S.before_remove(arguments))
|
|
qdel(S)
|
|
. = TRUE
|
|
|
|
/mob/living/proc/has_status_effect(effect) //returns the effect if the mob calling the proc owns the given status effect
|
|
. = FALSE
|
|
if(status_effects)
|
|
var/datum/status_effect/S1 = effect
|
|
for(var/datum/status_effect/S in status_effects)
|
|
if(initial(S1.id) == S.id)
|
|
return S
|
|
|
|
/mob/living/proc/has_status_effect_list(effect) //returns a list of effects with matching IDs that the mod owns; use for effects there can be multiple of
|
|
. = list()
|
|
if(status_effects)
|
|
var/datum/status_effect/S1 = effect
|
|
for(var/datum/status_effect/S in status_effects)
|
|
if(initial(S1.id) == S.id)
|
|
. += S
|
|
|
|
//////////////////////
|
|
// STACKING EFFECTS //
|
|
//////////////////////
|
|
|
|
/datum/status_effect/stacking
|
|
id = "stacking_base"
|
|
duration = -1 //removed under specific conditions
|
|
alert_type = null
|
|
var/stacks = 0 //how many stacks are accumulated, also is # of stacks that target will have when first applied
|
|
var/delay_before_decay //deciseconds until ticks start occuring, which removes stacks (first stack will be removed at this time plus tick_interval)
|
|
tick_interval = 10 //deciseconds between decays once decay starts
|
|
var/stack_decay = 1 //how many stacks are lost per tick (decay trigger)
|
|
var/stack_threshold //special effects trigger when stacks reach this amount
|
|
var/max_stacks //stacks cannot exceed this amount
|
|
var/consumed_on_threshold = TRUE //if status should be removed once threshold is crossed
|
|
var/threshold_crossed = FALSE //set to true once the threshold is crossed, false once it falls back below
|
|
var/overlay_file
|
|
var/underlay_file
|
|
var/overlay_state // states in .dmi must be given a name followed by a number which corresponds to a number of stacks. put the state name without the number in these state vars
|
|
var/underlay_state // the number is concatonated onto the string based on the number of stacks to get the correct state name
|
|
var/mutable_appearance/status_overlay
|
|
var/mutable_appearance/status_underlay
|
|
|
|
/datum/status_effect/stacking/proc/threshold_cross_effect() //what happens when threshold is crossed
|
|
|
|
/datum/status_effect/stacking/proc/stacks_consumed_effect() //runs if status is deleted due to threshold being crossed
|
|
|
|
/datum/status_effect/stacking/proc/fadeout_effect() //runs if status is deleted due to being under one stack
|
|
|
|
/datum/status_effect/stacking/proc/stack_decay_effect() //runs every time tick() causes stacks to decay
|
|
|
|
/datum/status_effect/stacking/proc/on_threshold_cross()
|
|
threshold_cross_effect()
|
|
if(consumed_on_threshold)
|
|
stacks_consumed_effect()
|
|
qdel(src)
|
|
|
|
/datum/status_effect/stacking/proc/on_threshold_drop()
|
|
|
|
/datum/status_effect/stacking/proc/can_have_status()
|
|
return owner.stat != DEAD
|
|
|
|
/datum/status_effect/stacking/proc/can_gain_stacks()
|
|
return owner.stat != DEAD
|
|
|
|
/datum/status_effect/stacking/tick()
|
|
if(!can_have_status())
|
|
qdel(src)
|
|
else
|
|
add_stacks(-stack_decay)
|
|
stack_decay_effect()
|
|
|
|
/datum/status_effect/stacking/proc/add_stacks(stacks_added)
|
|
if(stacks_added > 0 && !can_gain_stacks())
|
|
return FALSE
|
|
owner.cut_overlay(status_overlay)
|
|
owner.underlays -= status_underlay
|
|
stacks += stacks_added
|
|
if(stacks > 0)
|
|
if(stacks >= stack_threshold && !threshold_crossed) //threshold_crossed check prevents threshold effect from occuring if changing from above threshold to still above threshold
|
|
threshold_crossed = TRUE
|
|
on_threshold_cross()
|
|
if(consumed_on_threshold)
|
|
return
|
|
else if(stacks < stack_threshold && threshold_crossed)
|
|
threshold_crossed = FALSE //resets threshold effect if we fall below threshold so threshold effect can trigger again
|
|
on_threshold_drop()
|
|
if(stacks_added > 0)
|
|
tick_interval += delay_before_decay //refreshes time until decay
|
|
stacks = min(stacks, max_stacks)
|
|
status_overlay.icon_state = "[overlay_state][stacks]"
|
|
status_underlay.icon_state = "[underlay_state][stacks]"
|
|
owner.add_overlay(status_overlay)
|
|
owner.underlays += status_underlay
|
|
else
|
|
fadeout_effect()
|
|
qdel(src) //deletes status if stacks fall under one
|
|
|
|
/datum/status_effect/stacking/on_creation(mob/living/new_owner, stacks_to_apply)
|
|
. = ..()
|
|
if(.)
|
|
add_stacks(stacks_to_apply)
|
|
|
|
/datum/status_effect/stacking/on_apply()
|
|
if(!can_have_status())
|
|
return FALSE
|
|
status_overlay = mutable_appearance(overlay_file, "[overlay_state][stacks]")
|
|
status_underlay = mutable_appearance(underlay_file, "[underlay_state][stacks]")
|
|
var/icon/I = icon(owner.icon, owner.icon_state, owner.dir)
|
|
var/icon_height = I.Height()
|
|
status_overlay.pixel_x = -owner.pixel_x
|
|
status_overlay.pixel_y = FLOOR(icon_height * 0.25, 1)
|
|
status_overlay.transform = matrix() * (icon_height/world.icon_size) //scale the status's overlay size based on the target's icon size
|
|
status_underlay.pixel_x = -owner.pixel_x
|
|
status_underlay.transform = matrix() * (icon_height/world.icon_size) * 3
|
|
status_underlay.alpha = 40
|
|
owner.add_overlay(status_overlay)
|
|
owner.underlays += status_underlay
|
|
return ..()
|
|
|
|
/datum/status_effect/stacking/Destroy()
|
|
if(owner)
|
|
owner.cut_overlay(status_overlay)
|
|
owner.underlays -= status_underlay
|
|
QDEL_NULL(status_overlay)
|
|
return ..()
|
|
|
|
/// Status effect from multiple sources, when all sources are removed, so is the effect
|
|
/datum/status_effect/grouped
|
|
status_type = STATUS_EFFECT_MULTIPLE //! Adds itself to sources and destroys itself if one exists already, there are never multiple
|
|
var/list/sources = list()
|
|
|
|
/datum/status_effect/grouped/on_creation(mob/living/new_owner, source)
|
|
var/datum/status_effect/grouped/existing = new_owner.has_status_effect(type)
|
|
if(existing)
|
|
existing.sources |= source
|
|
qdel(src)
|
|
return FALSE
|
|
else
|
|
sources |= source
|
|
return ..()
|
|
|
|
/datum/status_effect/grouped/before_remove(source)
|
|
sources -= source
|
|
return !length(sources)
|