From 68171a044252548aa3f143698b388f92ec288b63 Mon Sep 17 00:00:00 2001 From: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> Date: Fri, 22 Aug 2025 11:01:44 -0400 Subject: [PATCH] Makes basic mobs work with lazarus injectors (#30134) * Makes basic mobs work with lazarus injectors * Update code/modules/mining/equipment/lazarus_injector.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> --------- Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> --- .../mining/equipment/lazarus_injector.dm | 60 +++++++++---------- code/modules/mob/living/living.dm | 9 +++ 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/code/modules/mining/equipment/lazarus_injector.dm b/code/modules/mining/equipment/lazarus_injector.dm index 89efc818957..84646692e28 100644 --- a/code/modules/mining/equipment/lazarus_injector.dm +++ b/code/modules/mining/equipment/lazarus_injector.dm @@ -18,42 +18,42 @@ if(!loaded) return ITEM_INTERACT_COMPLETE if(isliving(target)) + var/mob/living/L = target + if(L.stat != DEAD) + to_chat(user, "[src] is only effective on the dead.") + return ITEM_INTERACT_COMPLETE + if(!isanimal_or_basicmob(target)) + to_chat(user, "[src] is only effective on lesser beings.") + return ITEM_INTERACT_COMPLETE if(isanimal(target)) var/mob/living/simple_animal/M = target if(M.sentience_type != revive_type) to_chat(user, "[src] does not work on this sort of creature.") return ITEM_INTERACT_COMPLETE - if(M.stat == DEAD) - M.faction = list("neutral") - M.revive() - M.AddElement(/datum/element/wears_collar) - if(ishostile(target)) - var/mob/living/simple_animal/hostile/H = M - if(isretaliate(target)) - // Clear the enemies list so we don't break windows - // to get to people we no longer hate. - var/mob/living/simple_animal/hostile/retaliate/R = H - R.enemies.Cut() - - if(malfunctioning) - H.faction |= list("lazarus", "\ref[user]") - H.robust_searching = TRUE - H.friends += user - H.attack_same = TRUE - log_game("[user] has revived hostile mob [target] with a malfunctioning lazarus injector") - else - H.attack_same = FALSE - loaded = 0 - user.visible_message("[user] injects [M] with [src], reviving it.") - playsound(src,'sound/effects/refill.ogg',50,1) - icon_state = "lazarus_empty" + M.lazarus_revive(user, malfunctioning) + if(ishostile(target)) // Handling for simple mobs to make them not angry anymore + var/mob/living/simple_animal/hostile/H = M + if(isretaliate(target)) + // Clear the enemies list so we don't break windows + // to get to people we no longer hate. + var/mob/living/simple_animal/hostile/retaliate/R = H + R.enemies.Cut() + if(malfunctioning) + H.robust_searching = TRUE + H.attack_same = TRUE + else + H.attack_same = FALSE + if(isbasicmob(target)) + var/mob/living/basic/M = target + if(M.sentience_type != revive_type) + to_chat(user, "[src] does not work on this sort of creature.") return ITEM_INTERACT_COMPLETE - else - to_chat(user, "[src] is only effective on the dead.") - return ITEM_INTERACT_COMPLETE - else - to_chat(user, "[src] is only effective on lesser beings.") - return ITEM_INTERACT_COMPLETE + M.lazarus_revive(user, malfunctioning) + loaded = 0 + user.visible_message("[user] injects [target] with [src], reviving it.") + playsound(src,'sound/effects/refill.ogg', 50, TRUE) + icon_state = "lazarus_empty" + return ITEM_INTERACT_COMPLETE /obj/item/lazarus_injector/emag_act(mob/user) if(!malfunctioning) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index d13909c7e3c..110227eafb1 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1342,6 +1342,15 @@ /mob/living/proc/sec_hud_set_ID() return +/// Proc called when TARGETED by a lazarus injector +/mob/living/proc/lazarus_revive(mob/living/reviver, malfunctioning) + revive() + befriend(reviver) + AddElement(/datum/element/wears_collar) + faction = (malfunctioning) ? list("lazarus", "\ref[reviver]") : list("neutral") + if(malfunctioning) + log_game("[reviver] has revived hostile mob [src] with a malfunctioning lazarus injector") + /// Proc for giving a mob a new 'friend', generally used for AI control and /// targeting. Returns false if already friends or null if qdeleted. /mob/living/proc/befriend(mob/living/new_friend)