From dde153d3455dd99aee8fc4aa468fe62a40e60be1 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 12 Jul 2021 22:59:13 +0200 Subject: [PATCH] [MIRROR] Cleans up and DMdoc's implanter.dm (#6878) * Cleans up and DMdoc's implanter.dm * Update implanter.dm Co-authored-by: interestingusernam3 <51925758+interestingusernam3@users.noreply.github.com> Co-authored-by: Gandalf --- code/game/objects/items/implants/implanter.dm | 70 ++++++++++--------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/code/game/objects/items/implants/implanter.dm b/code/game/objects/items/implants/implanter.dm index 5f9aad7fda1..1fdbf2ecde4 100644 --- a/code/game/objects/items/implants/implanter.dm +++ b/code/game/objects/items/implants/implanter.dm @@ -1,3 +1,6 @@ +/** + * Players can use this item to put obj/item/implant's in living mobs. Can be renamed with a pen. + */ /obj/item/implanter//SKYRAT EDIT - ICON OVERRIDEN BY AESTHETICS - SEE MODULE name = "implanter" desc = "A sterile automatic implant injector." @@ -10,51 +13,54 @@ throw_range = 5 w_class = WEIGHT_CLASS_SMALL custom_materials = list(/datum/material/iron=600, /datum/material/glass=200) + ///The implant in our implanter var/obj/item/implant/imp = null + ///Type of implant this will spawn as imp upon being spawned var/imp_type = null - /obj/item/implanter/update_icon_state() icon_state = "implanter[imp ? 1 : 0]" return ..() - -/obj/item/implanter/attack(mob/living/M, mob/user) - if(!istype(M)) +/obj/item/implanter/attack(mob/living/target, mob/user) + if(!(istype(target) && user && imp)) return - if(user && imp) - if(M != user) - M.visible_message(span_warning("[user] is attempting to implant [M].")) - var/turf/T = get_turf(M) - if(T && (M == user || do_mob(user, M, 50))) - if(src && imp) - if(imp.implant(M, user)) - if (M == user) - to_chat(user, span_notice("You implant yourself.")) - else - M.visible_message(span_notice("[user] implants [M]."), span_notice("[user] implants you.")) - imp = null - update_appearance() - else - to_chat(user, span_warning("[src] fails to implant [M].")) + if(target != user) + target.visible_message(span_warning("[user] is attempting to implant [target].")) -/obj/item/implanter/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/pen)) - if(!user.is_literate()) - to_chat(user, span_notice("You prod at [src] with [W]!")) - return - var/t = stripped_input(user, "What would you like the label to be?", name, null) - if(user.get_active_held_item() != W) - return - if(!user.canUseTopic(src, BE_CLOSE)) - return - if(t) - name = "implanter ([t])" + var/turf/target_on = get_turf(target) + if(!(target_on && (target == user || do_mob(user, target, 5 SECONDS)))) + return + if(!(src && imp)) + return + + if(imp.implant(target, user)) + if (target == user) + to_chat(user, span_notice("You implant yourself.")) else - name = "implanter" + target.visible_message(span_notice("[user] implants [target]."), span_notice("[user] implants you.")) + imp = null + update_appearance() else + to_chat(user, span_warning("[src] fails to implant [target].")) + +/obj/item/implanter/attackby(obj/item/I, mob/living/user, params) + if(!istype(I, /obj/item/pen)) return ..() + if(!user.is_literate()) + to_chat(user, span_notice("You prod at [src] with [I]!")) + return + + var/new_name = stripped_input(user, "What would you like the label to be?", name, null) + if(user.get_active_held_item() != I) + return + if(!user.canUseTopic(src, BE_CLOSE)) + return + if(new_name) + name = "implanter ([new_name])" + else + name = "implanter" /obj/item/implanter/Initialize(mapload) . = ..()