Persistent Bandages (#20268)

* Bandages now do not disappear as damage heals, instead, a special
Remove Bandages verb must be used to remove bandages. This cannot be
used to re-open wounds for now, and can only be used if the bandage
would've downgraded / disappeared at that point.
* Taking damage on a bandaged limb now removes the bandages.
This commit is contained in:
Geeves
2024-12-24 12:43:44 +00:00
committed by GitHub
parent 143ffe29ee
commit 1bd4f7e020
9 changed files with 133 additions and 20 deletions
@@ -514,3 +514,71 @@
if(wrists.clean_blood())
update_inv_wrists(0)
clean_blood(washshoes)
/// Handles removing bandages from specific limbs or all of them at once, added conditionally based on whether the limb has any bandages on in the first place
/mob/living/carbon/human/proc/remove_bandages()
set name = "Remove Bandages"
set category = "IC"
set src in view(1)
// to make this all easier, i'm restricting the verb actioner to humans only
var/mob/living/carbon/human/remover = usr
if(!istype(remover))
to_chat(SPAN_WARNING("You cannot remove bandages!"))
return
// get all the body parts covered by thick clothing, so you cant strip bandages from underneath someone's armour / voidsuit
var/covered_body_parts = get_covered_body_parts(TRUE)
var/list/possible_limbs = list()
for(var/obj/item/organ/external/limb in organs)
if(covered_body_parts & limb.body_part)
continue
if(limb.is_stump())
continue
// check if it even has bandages
var/bandage_level = limb.bandage_level
if(!bandage_level)
continue
// if it has bandages, check whether it's possible to remove some
var/possible_bandage_level = limb.possible_bandage_level()
if(possible_bandage_level >= bandage_level)
continue
possible_limbs[capitalize_first_letters(limb.name)] = limb
if(!length(possible_limbs))
to_chat(remover, SPAN_WARNING("\The [src] has no bandages you can remove!"))
return
possible_limbs["All"] = TRUE
var/selected_limb = tgui_input_list(remover, "Which limb would you like to remove the bandages from?", "Bandage Removal", possible_limbs, "All")
if(!selected_limb)
return
if(!remover.Adjacent(src))
to_chat(remover, SPAN_WARNING("You need to stay next to \the [src]!"))
return
if(selected_limb == "All")
remover.visible_message(SPAN_NOTICE("\The [remover] begins removing bandages from all of \the [src]'s damaged limbs..."), SPAN_NOTICE("You begin removing bandages from all of \the [src]'s damaged limbs..."))
if(!do_after(remover, 3 SECONDS, src))
return
possible_limbs -= "All"
for(var/limb_name in possible_limbs)
var/obj/item/organ/external/limb = possible_limbs[limb_name]
limb.bandage_level = limb.possible_bandage_level()
update_bandages()
remover.visible_message(SPAN_NOTICE("\The [remover] removed the bandages from all of \the [src]'s damaged limbs!"), SPAN_NOTICE("You removed the bandages from all of \the [src]'s damaged limbs!"))
else
var/obj/item/organ/external/limb = possible_limbs[selected_limb]
remover.visible_message(SPAN_NOTICE("\The [remover] begins removing bandages from \the [src]'s [limb.name]..."), SPAN_NOTICE("You begin removing bandages \the [src]'s [limb.name]..."))
if(!do_after(remover, 1 SECOND, src))
return
limb.bandage_level = limb.possible_bandage_level()
update_bandages()
remover.visible_message(SPAN_NOTICE("\The [remover] removed the bandages from \the [src]'s [limb.name]!"), SPAN_NOTICE("You removed the bandages \the [src]'s [limb.name]!"))
+1 -1
View File
@@ -951,7 +951,7 @@
var/bandage_icon = species.bandages_icon
if(!bandage_icon)
continue
var/bandage_level = O.bandage_level()
var/bandage_level = O.bandage_level
if(bandage_level)
health_images += image(bandage_icon, "[O.icon_name][bandage_level]")
@@ -246,19 +246,32 @@ There are several things that need to be remembered:
if(update_icons)
update_icon()
/// Handles displaying bandages on the mob icon, and whether the mob should have the add/remove bandages verb attached to it
/mob/living/carbon/human/proc/update_bandages(var/update_icons = TRUE)
var/bandage_icon = species.bandages_icon
if(!bandage_icon)
return
var/list/ovr
if(overlays_raw[MOB_DAMAGE_LAYER])
for(var/obj/item/organ/external/O in organs)
if(O.is_stump())
continue
var/bandage_level = O.bandage_level()
if(bandage_level)
LAZYADD(ovr, image(bandage_icon, "[O.icon_name][bandage_level]"))
for(var/obj/item/organ/external/O in organs)
if(O.is_stump())
continue
var/bandage_level = O.bandage_level
if(bandage_level)
LAZYADD(ovr, image(bandage_icon, "[O.icon_name][bandage_level]"))
// this next part handles whether the mob should have the Remove Bandages verb available
// obviously this is a little hacky, since this is the icon update function, but it's also the best place we loop through
// the various organs and calculate their bandage level
var/had_bandages = LAZYLEN(overlays_raw[BANDAGE_LAYER])
var/has_bandages = LAZYLEN(ovr)
// gained bandages
if(!had_bandages && has_bandages)
add_verb(src, /mob/living/carbon/human/proc/remove_bandages)
// lost bandages
else if(had_bandages && !has_bandages)
remove_verb(src, /mob/living/carbon/human/proc/remove_bandages)
overlays_raw[BANDAGE_LAYER] = ovr
if(update_icons)
@@ -268,7 +281,6 @@ There are several things that need to be remembered:
//eg: ammo counters, primed grenade flashing, etc.
//"icon_file" is used automatically for inhands etc. to make sure it gets the correct inhand file
/obj/item/proc/worn_overlays(icon_file)
. = null
. = list()
var/mutable_appearance/M = null
if(build_from_parts)