From 50dbd49530409b9cff9162acbed9a64fd34dd5d5 Mon Sep 17 00:00:00 2001 From: Darkmight9 <45213755+Darkmight9@users.noreply.github.com> Date: Wed, 21 Nov 2018 01:20:32 -0500 Subject: [PATCH 1/2] 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. --- code/game/objects/items/stacks/nanopaste.dm | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/code/game/objects/items/stacks/nanopaste.dm b/code/game/objects/items/stacks/nanopaste.dm index aaaa0dbc579..737732685eb 100644 --- a/code/game/objects/items/stacks/nanopaste.dm +++ b/code/game/objects/items/stacks/nanopaste.dm @@ -36,3 +36,39 @@ to_chat(user, "Nothing to fix here.") else to_chat(user, "[src] won't work on that.") + +/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("[user] [healverb]s the damage on [H]'s [affecting.name].", \ + "You [healverb] the damage on [H]'s [affecting.name]." ) + + 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("[user] [healverb]s the damage on [H]'s [E.name] with the remaining paste.", \ + "You [healverb] the damage on [H]'s [E.name] with the remaining paste." ) \ No newline at end of file From dd5c18a8b4bee9fa1323d4fd5d79b5b53d063c24 Mon Sep 17 00:00:00 2001 From: Darkmight9 <45213755+Darkmight9@users.noreply.github.com> Date: Mon, 3 Dec 2018 01:03:47 -0500 Subject: [PATCH 2/2] Gives nanopaste overheal --- code/game/objects/items/stacks/nanopaste.dm | 70 +++++++++------------ 1 file changed, 30 insertions(+), 40 deletions(-) diff --git a/code/game/objects/items/stacks/nanopaste.dm b/code/game/objects/items/stacks/nanopaste.dm index 737732685eb..08e871c66a4 100644 --- a/code/game/objects/items/stacks/nanopaste.dm +++ b/code/game/objects/items/stacks/nanopaste.dm @@ -22,53 +22,43 @@ else to_chat(user, "All [R]'s systems are nominal.") - if(istype(M,/mob/living/carbon/human)) //Repairing robolimbs + if(istype(M,/mob/living/carbon/human)) //Repairing robotic limbs and IPCs var/mob/living/carbon/human/H = M var/obj/item/organ/external/S = H.get_organ(user.zone_sel.selecting) if(S && S.is_robotic()) if(S.get_damage()) - S.heal_damage(15, 15, robo_repair = 1) use(1) - user.visible_message("\The [user] applies some nanite paste at[user != M ? " \the [M]'s" : " \the"][S.name] with \the [src].",\ - "You apply some nanite paste at [user == M ? "your" : "[M]'s"] [S.name].") + var/remheal = 15 + var/nremheal = 0 + S.heal_damage(robo_repair = 1) //should in, theory, heal the robotic organs in just the targeted area with it being S instead of E + var/childlist + if(!isnull(S.children)) + childlist = S.children.Copy() + var/parenthealed = FALSE + while(remheal > 0) + var/obj/item/organ/external/E + if(S.get_damage()) + E = S + else if(LAZYLEN(childlist)) + E = pick_n_take(childlist) + if(!E.get_damage() || !E.is_robotic()) + continue + else if(S.parent && !parenthealed) + E = S.parent + parenthealed = TRUE + if(!E.get_damage() || !E.is_robotic()) + break + else + break + nremheal = max(remheal - E.get_damage(), 0) + E.heal_damage(remheal, 0, 0, 1) //Healing Brute + E.heal_damage(0, remheal, 0, 1) //Healing Burn + remheal = nremheal + user.visible_message("\The [user] applies some nanite paste at \the [M]'s [E.name] with \the [src].") + if(H.bleed_rate && H.isSynthetic()) + H.bleed_rate = 0 else to_chat(user, "Nothing to fix here.") else to_chat(user, "[src] won't work on that.") - -/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("[user] [healverb]s the damage on [H]'s [affecting.name].", \ - "You [healverb] the damage on [H]'s [affecting.name]." ) - - 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("[user] [healverb]s the damage on [H]'s [E.name] with the remaining paste.", \ - "You [healverb] the damage on [H]'s [E.name] with the remaining paste." ) \ No newline at end of file