Skip to content

Commit

Permalink
4th of July American Gauze sprites (and rework) (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMelbert authored Jul 8, 2024
1 parent c1df956 commit 42913f9
Show file tree
Hide file tree
Showing 20 changed files with 311 additions and 115 deletions.
7 changes: 7 additions & 0 deletions code/datums/wounds/blunt.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/datum/wound/blunt
name = "Blunt Wound"
sound_effect = 'sound/effects/wounds/crack1.ogg'

/datum/wound/blunt/wound_injury(datum/wound/old_wound, attack_direction)
if(!old_wound && limb.current_gauze && (wound_flags & ACCEPTS_GAUZE))
// oops your bone injury knocked off your gauze, gotta re-apply it
limb.remove_gauze(limb.drop_location())

return ..()
11 changes: 10 additions & 1 deletion code/datums/wounds/burns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
a_or_from = "from"
sound_effect = 'sound/effects/wounds/sizzle1.ogg'

/datum/wound/burn/wound_injury(datum/wound/old_wound, attack_direction)
if(!old_wound && limb.current_gauze && (wound_flags & ACCEPTS_GAUZE))
qdel(limb.remove_gauze())
// oops your existing gauze got burned, need a new one now
var/obj/effect/decal/cleanable/ash/ash = new(limb.drop_location())
ash.desc += " It looks like it used to be some kind of bandage."

return ..()

/datum/wound/burn/flesh
name = "Burn (Flesh) Wound"
a_or_from = "from"
Expand Down Expand Up @@ -149,7 +158,7 @@
if(4 to INFINITY)
bandage_condition = "clean"

condition += " underneath a dressing of [bandage_condition] [limb.current_gauze.name]"
condition += " underneath a dressing of [bandage_condition] [limb.current_gauze.name]."
else
switch(infestation)
if(WOUND_INFECTION_MODERATE to WOUND_INFECTION_SEVERE)
Expand Down
12 changes: 9 additions & 3 deletions code/datums/wounds/pierce.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
*/
/datum/wound/pierce

/datum/wound/pierce/wound_injury(datum/wound/old_wound, attack_direction)
if(!old_wound && limb.current_gauze && (wound_flags & ACCEPTS_GAUZE))
// oops your existing gauze got penetrated through! need a new one now
limb.seep_gauze(initial(limb.current_gauze.absorption_capacity) * 0.8)
return ..()

/datum/wound/pierce/bleed
name = "Piercing Wound"
sound_effect = 'sound/weapons/slice.ogg'
Expand All @@ -29,7 +35,6 @@
set_blood_flow(initial_flow)
if(limb.can_bleed() && attack_direction && victim.blood_volume > BLOOD_VOLUME_OKAY)
victim.spray_blood(attack_direction, severity)

return ..()

/datum/wound/pierce/bleed/receive_damage(wounding_type, wounding_dmg, wound_bonus)
Expand Down Expand Up @@ -82,8 +87,9 @@
adjust_blood_flow(0.25 * seconds_per_tick) // old heparin 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

if(limb.current_gauze)
adjust_blood_flow(-limb.current_gauze.absorption_rate * gauzed_clot_rate * seconds_per_tick)
limb.current_gauze.absorption_capacity -= limb.current_gauze.absorption_rate * seconds_per_tick
var/amt_blocking = limb.current_gauze.absorption_rate * seconds_per_tick
adjust_blood_flow(-1 * amt_blocking * gauzed_clot_rate)
limb.seep_gauze(amt_blocking)

if(blood_flow <= 0)
qdel(src)
Expand Down
6 changes: 6 additions & 0 deletions code/datums/wounds/slash.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
name = "Slashing (Cut) Wound"
sound_effect = 'sound/weapons/slice.ogg'

/datum/wound/slash/wound_injury(datum/wound/old_wound, attack_direction)
if(!old_wound && limb.current_gauze && (wound_flags & ACCEPTS_GAUZE))
// oops your existing gauze got cut through! need a new one now
limb.seep_gauze(initial(limb.current_gauze.absorption_capacity) * 0.8)
return ..()

/datum/wound_pregen_data/flesh_slash
abstract = TRUE

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/decals/cleanable/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
pixel_x = rand(-10, 10)
pixel_y = rand(-10, 10)
if(!isnull(oldname))
desc = "The sad remains of what used to be [oldname]"
desc = "The sad remains of what used to be [oldname]."
. = ..()

/obj/effect/decal/cleanable/glitter
Expand Down
116 changes: 88 additions & 28 deletions code/game/objects/items/stacks/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
source = /datum/robot_energy_storage/medical
merge_type = /obj/item/stack/medical
pickup_sound = 'maplestation_modules/sound/items/pickup/surgery_cloth.ogg'
/// Sound played when heal doafter begins
var/heal_sound
/// How long it takes to apply it to yourself
var/self_delay = 5 SECONDS
/// How long it takes to apply it to someone else
Expand Down Expand Up @@ -86,6 +88,8 @@
if(iscarbon(patient))
new_self_delay = looping ? clamp((self_delay - assessing_injury_delay), 0, self_delay) : self_delay
new_other_delay = looping ? clamp((other_delay - assessing_injury_delay), 0, other_delay) : other_delay
if(heal_sound)
playsound(patient, heal_sound, 33, FALSE)
if(patient == user)
if(!silent)
user.visible_message(
Expand Down Expand Up @@ -231,15 +235,48 @@
burn_cleanliness_bonus = 0.35
merge_type = /obj/item/stack/medical/gauze
drop_sound = 'sound/items/handling/cloth_drop.ogg'
var/obj/item/bodypart/gauzed_bodypart
/// tracks how many times we've been scrubbed thoroughly
var/times_cleaned = 0

/obj/item/stack/medical/gauze/Destroy(force)
/obj/item/stack/medical/gauze/update_name(updates)
. = ..()
var/base_cap = initial(absorption_capacity)
if(!base_cap)
return

if(absorption_capacity <= 0)
name = "used [initial(name)]"
else if(absorption_capacity <= base_cap * 0.2)
name = "dirty [initial(name)]"
else if(absorption_capacity <= base_cap * 0.8)
name = "worn [initial(name)]"
else
name = initial(name)

if (gauzed_bodypart)
gauzed_bodypart.current_gauze = null
SEND_SIGNAL(gauzed_bodypart, COMSIG_BODYPART_UNGAUZED, src)
gauzed_bodypart = null
/obj/item/stack/medical/gauze/can_merge(obj/item/stack/medical/gauze/check, inhand)
. = ..()
if(!.)
return .
// need to be in +- 0.5 dirtiness of each other
// otherwise you can merge a completely used bandage with a brand new one, which would magically unuse it
if(check.absorption_capacity < absorption_capacity - 0.25 || check.absorption_capacity > absorption_capacity + 0.25)
return FALSE
return .

/obj/item/stack/medical/gauze/wash(clean_types)
. = ..()
if(.)
return .
if(!(clean_types & CLEAN_TYPE_HARD_DECAL)) // gotta scrub realllly hard to clean gauze
return .
times_cleaned += 1
var/clean_to = initial(absorption_capacity) * (3 / (times_cleaned + 3))
if(absorption_capacity < clean_to)
absorption_capacity = clean_to
update_appearance(UPDATE_NAME)
. = TRUE

return .

// gauze is only relevant for wounds, which are handled in the wounds themselves
/obj/item/stack/medical/gauze/try_heal(mob/living/patient, mob/user, silent, looping)
Expand All @@ -248,40 +285,62 @@

var/obj/item/bodypart/limb = patient.get_bodypart(check_zone(user.zone_selected))
if(!limb)
patient.balloon_alert(user, "missing limb!")
return
if(!LAZYLEN(limb.wounds))
patient.balloon_alert(user, "no wounds!") // good problem to have imo
return

var/gauzeable_wound = FALSE
var/datum/wound/woundies
for(var/i in limb.wounds)
woundies = i
if(woundies.wound_flags & ACCEPTS_GAUZE)
gauzeable_wound = TRUE
break
if(!gauzeable_wound)
patient.balloon_alert(user, "can't heal those!")
patient.balloon_alert(user, "no limb!")
return

if(limb.current_gauze && (limb.current_gauze.absorption_capacity * 1.2 > absorption_capacity)) // ignore if our new wrap is < 20% better than the current one, so someone doesn't bandage it 5 times in a row
patient.balloon_alert(user, pick("already bandaged!", "bandage is clean!")) // good enough
return

if(HAS_TRAIT(woundies, TRAIT_WOUND_SCANNED))
var/boosted = FALSE
if(LAZYLEN(limb.wounds))
for(var/datum/wound/wound as anything in limb.wounds)
if(HAS_TRAIT(wound, TRAIT_WOUND_SCANNED))
boosted = TRUE
break
else
// gives you extra time so you realize you're not treating a wound
treatment_delay *= 2

var/whose = user == patient ? "your" : "[patient]'s"
var/theirs = user == patient ? patient.p_their() : "[patient]'s"
var/wrap_or_replace = limb.current_gauze ? "replacing [limb.current_gauze] on" : "wrapping"
var/with_what = limb.current_gauze?.type == type ? "more of [src]" : src
if(boosted)
treatment_delay *= 0.5
if(user == patient)
to_chat(user, span_notice("You keep in mind the indications from the holo-image about your injury, and expertly begin wrapping your wounds with [src]."))
else
user.visible_message(span_warning("[user] begins expertly wrapping the wounds on [patient]'s [limb.plaintext_zone] with [src]..."), span_warning("You begin quickly wrapping the wounds on [patient]'s [limb.plaintext_zone] with [src], keeping the holo-image indications in mind..."))
user.visible_message(
span_notice("[user] begins expertly [wrap_or_replace] [theirs] [limb.plaintext_zone] with [with_what]."),
span_notice("You begin quickly [wrap_or_replace] [whose] [limb.plaintext_zone] with [with_what], keeping the holo-image indications in mind..."),
)
else
user.visible_message(span_warning("[user] begins wrapping the wounds on [patient]'s [limb.plaintext_zone] with [src]..."), span_warning("You begin wrapping the wounds on [user == patient ? "your" : "[patient]'s"] [limb.plaintext_zone] with [src]..."))
user.visible_message(
span_notice("[user] begins [wrap_or_replace] [theirs] [limb.plaintext_zone] with [with_what]."),
span_notice("You begin [wrap_or_replace] [whose] [limb.plaintext_zone] with [with_what]..."),
)
user.balloon_alert(user, "applying gauze...")
if(user != patient)
user.balloon_alert(patient, "applying gauze...")

playsound(patient, pick(
'maplestation_modules/sound/items/rip1.ogg',
'maplestation_modules/sound/items/rip2.ogg',
'maplestation_modules/sound/items/rip3.ogg',
'maplestation_modules/sound/items/rip4.ogg',
), 33)

if(!do_after(user, treatment_delay, target = patient))
user.balloon_alert(user, "interrupted!")
return
if(limb.current_gauze && (limb.current_gauze.absorption_capacity * 1.2 > absorption_capacity)) // double check for sanity
return
user.balloon_alert(user, "gauze applied")
if(user != patient)
user.balloon_alert(patient, "gauze applied")

user.visible_message("<span class='infoplain'><span class='green'>[user] applies [src] to [patient]'s [limb.plaintext_zone].</span></span>", "<span class='infoplain'><span class='green'>You bandage the wounds on [user == patient ? "your" : "[patient]'s"] [limb.plaintext_zone].</span></span>")
user.visible_message(
span_infoplain(span_green("[user] applies [src] to [theirs] [limb.plaintext_zone].")),
span_infoplain(span_green("You [limb.current_gauze?.type == type ? "replace" : "bandage"] the wounds on [whose] [limb.plaintext_zone].")),
)
limb.apply_gauze(src)

/obj/item/stack/medical/gauze/twelve
Expand Down Expand Up @@ -343,6 +402,7 @@
stop_bleeding = 0.6
grind_results = list(/datum/reagent/medicine/spaceacillin = 2)
merge_type = /obj/item/stack/medical/suture
heal_sound = 'maplestation_modules/sound/items/snip.ogg'

/obj/item/stack/medical/suture/emergency
name = "emergency suture"
Expand Down
8 changes: 8 additions & 0 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@
SEND_SIGNAL(src, COMSIG_CARBON_EMBED_RIP, I, L)
return

if(href_list["gauze_limb"])
var/obj/item/bodypart/gauzed = locate(href_list["gauze_limb"]) in bodyparts
if(isnull(gauzed?.current_gauze))
return
// rest of the sanity is handled in the proc itself
gauzed.help_remove_gauze(usr)
return

if(href_list["show_paper_note"])
var/obj/item/paper/paper_note = locate(href_list["show_paper_note"])
if(!paper_note)
Expand Down
17 changes: 5 additions & 12 deletions code/modules/mob/living/carbon/carbon_update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -332,20 +332,13 @@
remove_overlay(DAMAGE_LAYER)

var/mutable_appearance/damage_overlay
var/digi_filter = FALSE
for(var/obj/item/bodypart/iter_part as anything in bodyparts)
if(!iter_part.dmg_overlay_type)
var/list/part_overlays = iter_part.get_bodypart_damage_state()
if(!LAZYLEN(part_overlays))
continue
if(iter_part.brutestate || iter_part.burnstate)
damage_overlay ||= mutable_appearance('icons/mob/effects/dam_mob.dmi', "blank", -DAMAGE_LAYER, appearance_flags = KEEP_TOGETHER)
if(iter_part.brutestate)
damage_overlay.add_overlay("[iter_part.dmg_overlay_type]_[iter_part.body_zone]_[iter_part.brutestate]0") //we're adding icon_states of the base image as overlays
damage_overlay.color = iter_part.damage_color
if(iter_part.burnstate)
damage_overlay.add_overlay("[iter_part.dmg_overlay_type]_[iter_part.body_zone]_0[iter_part.burnstate]")
if(!digi_filter && damage_overlay && (iter_part.bodytype & BODYTYPE_DIGITIGRADE))
iter_part.apply_digitigrade_filters(damage_overlay, src)
digi_filter = TRUE

damage_overlay ||= mutable_appearance(layer = -DAMAGE_LAYER)
damage_overlay.overlays += part_overlays

if(isnull(damage_overlay))
return
Expand Down
28 changes: 16 additions & 12 deletions code/modules/mob/living/carbon/human/examine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,27 @@

var/list/missing = list(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
var/list/disabled = list()
for(var/X in bodyparts)
var/obj/item/bodypart/body_part = X
var/adjacent = user.Adjacent(src)
for(var/obj/item/bodypart/body_part as anything in bodyparts)
if(body_part.bodypart_disabled)
disabled += body_part
missing -= body_part.body_zone
for(var/obj/item/I in body_part.embedded_objects)
if(I.isEmbedHarmless())
msg += "<B>[t_He] [t_has] [icon2html(I, user)] \a [I] stuck to [t_his] [body_part.plaintext_zone]!</B>\n"
else
msg += "<B>[t_He] [t_has] [icon2html(I, user)] \a [I] embedded in [t_his] [body_part.plaintext_zone]!</B>\n"

for(var/i in body_part.wounds)
var/datum/wound/iter_wound = i
for(var/obj/item/leftover in body_part.embedded_objects)
var/stuck_or_embedded = "embedded in"
if(leftover.isEmbedHarmless())
stuck_or_embedded = "stuck to"
msg += "<b>[t_He] [t_has] [icon2html(leftover, user)] \a [leftover] [stuck_or_embedded] [t_his] [body_part.plaintext_zone]!</b>\n"

if(body_part.current_gauze)
var/gauze_href = body_part.current_gauze.name
if(adjacent && isliving(user)) // only shows the href if we're adjacent
gauze_href = "<a href='?src=[REF(src)];gauze_limb=[REF(body_part)]'>[gauze_href]</a>"
msg += span_notice("There is some [icon2html(body_part.current_gauze, user)] [gauze_href] wrapped around [t_his] [body_part.plaintext_zone].\n")

for(var/datum/wound/iter_wound as anything in body_part.wounds)
msg += "[iter_wound.get_examine_description(user)]\n"

for(var/X in disabled)
var/obj/item/bodypart/body_part = X
for(var/obj/item/bodypart/body_part as anything in disabled)
var/damage_text
if(HAS_TRAIT(body_part, TRAIT_DISABLED_BY_WOUND))
continue // skip if it's disabled by a wound (cuz we'll be able to see the bone sticking out!)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/human_update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ generate/load female uniform sprites matching all previously decided variables

return appearance

/obj/item/proc/apply_digitigrade_filters(mutable_appearance/appearance, mob/living/carbon/human/wearer = loc)
/obj/item/proc/apply_digitigrade_filters(mutable_appearance/appearance, mob/living/carbon/wearer = loc)
if(!istype(wearer) || !(wearer.bodytype & BODYTYPE_DIGITIGRADE) || wearer.is_digitigrade_squished())
return

Expand Down
Loading

0 comments on commit 42913f9

Please sign in to comment.