Merge pull request #9045 from Anasari/AdvancedKit

Medical kit now uses overheal on eligible attached limbs
This commit is contained in:
Crazy Lemon
2018-07-13 21:52:36 -07:00
committed by GitHub
+41 -7
View File
@@ -12,6 +12,7 @@
var/self_delay = 20
var/unique_handling = 0 //some things give a special prompt, do we want to bypass some checks in parent?
var/stop_bleeding = 0
var/healverb = "bandage"
/obj/item/stack/medical/attack(mob/living/M, mob/user)
if(!iscarbon(M) && !isanimal(M))
@@ -77,6 +78,40 @@
"<span class='green'>You apply [src] on [M].</span>")
use(1)
/obj/item/stack/medical/proc/heal(mob/living/M, mob/user)
var/mob/living/carbon/human/H = M
var/obj/item/organ/external/affecting = H.get_organ(user.zone_sel.selecting)
user.visible_message("<span class='green'>[user] [healverb]s the wounds on [H]'s [affecting.name].</span>", \
"<span class='green'>You [healverb] the wounds on [H]'s [affecting.name].</span>" )
var/rembrute = max(0, heal_brute - affecting.brute_dam) // Maxed with 0 since heal_damage let you pass in a negative value
var/remburn = max(0, heal_burn - affecting.burn_dam) // And deduct it from their health (aka deal damage)
var/nrembrute = rembrute
var/nremburn = remburn
affecting.heal_damage(heal_brute, heal_burn)
var/list/achildlist = affecting.children.Copy()
var/parenthealed = FALSE
while(rembrute + remburn > 0) // Don't bother if there's not enough leftover heal
var/obj/item/organ/external/E
if(achildlist.len)
E = pick_n_take(achildlist) // Pick a random children and then remove it from the list
else if(affecting.parent && !parenthealed) // If there's a parent and no healing attempt was made on it
E = affecting.parent
parenthealed = TRUE
else
break // If the organ have no child left and no parent / parent healed, break
if(E.status & ORGAN_ROBOT || E.open) // Ignore robotic or open limb
continue
else if(!E.brute_dam && !E.burn_dam) // Ignore undamaged limb
continue
nrembrute = max(0, rembrute - E.brute_dam) // Deduct the healed damage from the remain
nremburn = max(0, remburn - E.burn_dam)
E.heal_damage(rembrute, remburn)
rembrute = nrembrute
remburn = nremburn
user.visible_message("<span class='green'>[user] [healverb]s the wounds on [H]'s [E.name] with the remaining medication.</span>", \
"<span class='green'>You [healverb] the wounds on [H]'s [E.name] with the remaining medication.</span>" )
//Bruise Packs//
/obj/item/stack/medical/bruise_pack
@@ -98,13 +133,12 @@
if(affecting.open == 0)
affecting.germ_level = 0
user.visible_message("<span class='green'>[user] bandages the wounds on [H]'s [affecting.name].</span>", \
"<span class='green'>You bandage the wounds on [H]'s [affecting.name].</span>" )
if(stop_bleeding)
if(!H.bleedsuppress) //so you can't stack bleed suppression
H.suppress_bloodloss(stop_bleeding)
affecting.heal_damage(heal_brute, heal_burn)
heal(H, user)
H.UpdateDamageIcon()
use(1)
else
@@ -131,6 +165,7 @@
singular_name = "ointment"
icon_state = "ointment"
origin_tech = "biotech=2"
healverb = "salve"
/obj/item/stack/medical/ointment/attack(mob/living/M, mob/user)
if(..())
@@ -143,9 +178,8 @@
if(affecting.open == 0)
affecting.germ_level = 0
user.visible_message("<span class='green'>[user] salves the wounds on [H]'s [affecting.name].</span>", \
"<span class='green'>You salve the wounds on [H]'s [affecting.name].</span>" )
affecting.heal_damage(heal_brute, heal_burn)
heal(H, user)
H.UpdateDamageIcon()
use(1)
else