Attempting to make bandages work on animals.

This commit is contained in:
MistakeNot4892
2022-08-16 23:03:08 +10:00
parent f69e463f79
commit 174a6f75a5
6 changed files with 67 additions and 29 deletions
+30 -14
View File
@@ -57,20 +57,36 @@
// When somoene clicks us with an item in hand
/mob/living/simple_mob/attackby(var/obj/item/O, var/mob/user)
if(istype(O, /obj/item/stack/medical))
if(stat != DEAD)
// This could be done better.
var/obj/item/stack/medical/MED = O
if(health < getMaxHealth())
if(MED.amount >= 1)
adjustBruteLoss(-MED.heal_brute)
MED.amount -= 1
if(MED.amount <= 0)
qdel(MED)
visible_message("<span class='notice'>\The [user] applies the [MED] on [src].</span>")
else
var/datum/gender/T = gender_datums[src.get_visible_gender()]
to_chat(user, "<span class='notice'>\The [src] is dead, medical items won't bring [T.him] back to life.</span>") // the gender lookup is somewhat overkill, but it functions identically to the obsolete gender macros and future-proofs this code
if(istype(O, /obj/item/stack/medical) && (mob_class & (MOB_CLASS_HUMANOID|MOB_CLASS_ANIMAL)))
var/datum/gender/T = gender_datums[get_visible_gender()]
if(stat == DEAD)
to_chat(user, SPAN_WARNING("\The [src] is dead, medical items won't bring [T.him] back to life."))
return
var/obj/item/stack/medical/MED = O
if(health >= getMaxHealth())
to_chat(user, SPAN_WARNING("\The [src] does not need medical treatment."))
return
if(!((MED.heal_burn && getFireLoss()) || (MED.heal_brute && getBruteLoss())))
to_chat(user, SPAN_WARNING("\The [MED] does not seem appropriate to treat \the [src]."))
return
if(MED.get_amount() < 1)
to_chat(user, SPAN_WARNING("You do not have enough of \the [MED] to treat \the [src]."))
return
if(length(MED.apply_sounds))
playsound(user, pick(MED.apply_sounds), 25)
if(do_mob(user, src, 1 SECOND) && MED.get_amount() >= 1 && health < getMaxHealth())
heal_organ_damage(MED.heal_brute * 5, MED.heal_burn * 5)
visible_message(SPAN_NOTICE("\The [user] applies \the [MED] to \the [src]."))
MED.use(1)
return
if(can_butcher(user, O)) //if the animal can be butchered, do so and return. It's likely to be gibbed.
harvest(user, O)
return
@@ -17,7 +17,7 @@
/mob/living/simple_mob/examine(mob/user)
. = ..()
if(user && (get_dist(user, src) <= 3))
if(user && (isobserver(user) || get_dist(user, src) <= 3))
var/datum/gender/G = gender_datums[get_visible_gender()]
if(stat == DEAD)
@@ -32,16 +32,35 @@
else
. += SPAN_NOTICE("It can be [harvest_verb] now.")
var/percent_health = health / maxHealth
if(percent_health >= 1)
. += SPAN_NOTICE("[G.He] [G.is] uninjured.")
else if(percent_health >= 0.7)
. += SPAN_WARNING("[G.He] [G.is] mildly injured.")
else if(percent_health >= 0.4)
. += SPAN_WARNING("[G.He] [G.is] moderately injured.")
else
. += SPAN_DANGER("[G.He] [G.is] badly injured.")
var/damage_strings = list()
var/percent_brute = getBruteLoss() / getMaxHealth()
if(percent_brute > 0.6)
damage_strings += SPAN_DANGER("maimed bloody")
else if(percent_brute > 0.3)
damage_strings += SPAN_WARNING("cut and bruised")
else if(percent_brute > 0)
damage_strings += "lightly bruised"
var/percent_burn = getFireLoss() / getMaxHealth()
if(percent_burn > 0.6)
damage_strings += SPAN_DANGER("severely burned")
else if(percent_burn > 0.3)
damage_strings += SPAN_WARNING("covered in burns")
else if(percent_burn > 0)
damage_strings += "mildly burned"
if(!length(damage_strings))
var/percent_health = health / getMaxHealth()
if(percent_health >= 1)
. += SPAN_NOTICE("uninjured")
else if(percent_health >= 0.7)
. += "mildly injured"
else if(percent_health >= 0.4)
. += SPAN_WARNING("moderately injured")
else
. += SPAN_DANGER("badly injured")
. += "[G.He] [G.is] [english_list(damage_strings)]."
/mob/living/simple_mob/proc/livestock_harvest(var/obj/item/tool, var/mob/living/user)
if(!LAZYLEN(harvest_results)) // Might be a unique interaction of an object using the proc to do something weird, or just someone's a donk.
@@ -254,7 +254,7 @@
/mob/living/simple_mob/Stat()
..()
if(statpanel("Status") && show_stat_health)
stat(null, "Health: [round((health / getMaxHealth()) * 100)]%")
stat("Health:", "[round((health / getMaxHealth()) * 100)]%")
/mob/living/simple_mob/lay_down()
..()
@@ -11,7 +11,7 @@
// Healing threshold for grafadreka healing spit effect.
var/sap_heal_threshold = 1
var/const/scarification_period = 0.15
var/const/scarification_period = 0.25
/mob/living/simple_mob/animal/sif/Stat()
. = ..()