mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-25 04:57:12 +01:00
This, hopefully, gives overheal to nanopaste or at least can be a staging point. This is my fisr time coding so advice and impute is aprecated.
This commit is contained in:
@@ -36,3 +36,39 @@
|
||||
to_chat(user, "<span class='notice'>Nothing to fix here.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] won't work on that.</span>")
|
||||
|
||||
/obj/item/stack/nanopaste/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 damage on [H]'s [affecting.name].</span>", \
|
||||
"<span class='green'>You [healverb] the damage 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
|
||||
if(!isnull(affecting.children))
|
||||
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(LAZYLEN(achildlist))
|
||||
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) // Ignores organic 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 damage on [H]'s [E.name] with the remaining paste.</span>", \
|
||||
"<span class='green'>You [healverb] the damage on [H]'s [E.name] with the remaining paste.</span>" )
|
||||
Reference in New Issue
Block a user