diff --git a/code/game/objects/items/bio_chips/bio_chip_case.dm b/code/game/objects/items/bio_chips/bio_chip_case.dm index 39c4640a609..a3606e9d3ae 100644 --- a/code/game/objects/items/bio_chips/bio_chip_case.dm +++ b/code/game/objects/items/bio_chips/bio_chip_case.dm @@ -8,7 +8,7 @@ origin_tech = "materials=1;biotech=2" container_type = OPENCONTAINER | INJECTABLE | DRAWABLE materials = list(MAT_GLASS = 500) - + new_attack_chain = TRUE var/obj/item/bio_chip/imp var/obj/item/bio_chip/implant_type @@ -41,27 +41,42 @@ var/image/implant_overlay = image('icons/obj/bio_chips.dmi', imp.implant_state) . += implant_overlay -/obj/item/bio_chip_case/attackby__legacy__attackchain(obj/item/W, mob/user) - ..() +/obj/item/bio_chip_case/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(!is_pen(used) && !istype(used, /obj/item/bio_chip_implanter)) + return ..() - if(is_pen(W)) - rename_interactive(user, W) - else if(istype(W, /obj/item/bio_chip_implanter)) - var/obj/item/bio_chip_implanter/I = W - if(I.imp) - if(imp || I.imp.implanted) - return - I.imp.forceMove(src) - imp = I.imp - I.imp = null + if(is_pen(used)) + rename_interactive(user, used) + return ITEM_INTERACT_COMPLETE + + var/obj/item/bio_chip_implanter/implanter = used + if(implanter.imp) + if(imp) + to_chat(user, SPAN_WARNING("There's already an implant in [src]!")) + return ITEM_INTERACT_COMPLETE + + if(implanter.imp.implanted) + to_chat(user, SPAN_WARNING("[imp] is currently inside someone, which is likely a bug if you're getting this message.")) + return ITEM_INTERACT_COMPLETE + + implanter.imp.forceMove(src) + imp = implanter.imp + implanter.imp = null + update_state() + + to_chat(user, SPAN_NOTICE("You move [imp] from [implanter] to [src].")) + else + if(imp) + if(implanter.imp) + to_chat(user, SPAN_WARNING("[implanter] already has an implant inside!")) + return ITEM_INTERACT_COMPLETE + imp.forceMove(implanter) + implanter.imp = imp + imp = null update_state() - I.update_icon(UPDATE_ICON_STATE) - else - if(imp) - if(I.imp) - return - imp.loc = I - I.imp = imp - imp = null - update_state() - I.update_icon(UPDATE_ICON_STATE) + to_chat(user, SPAN_NOTICE("You move [implanter.imp] from [src] to [implanter].")) + + add_fingerprint(user) + implanter.add_fingerprint(user) + implanter.update_icon(UPDATE_ICON_STATE) + return ITEM_INTERACT_COMPLETE diff --git a/code/game/objects/items/bio_chips/bio_chipper.dm b/code/game/objects/items/bio_chips/bio_chipper.dm index f8c1499e4eb..9e0c6713559 100644 --- a/code/game/objects/items/bio_chips/bio_chipper.dm +++ b/code/game/objects/items/bio_chips/bio_chipper.dm @@ -9,6 +9,7 @@ w_class = WEIGHT_CLASS_SMALL origin_tech = "materials=2;biotech=3" materials = list(MAT_METAL = 600, MAT_GLASS = 200) + new_attack_chain = TRUE var/obj/item/bio_chip/imp var/obj/item/bio_chip/implant_type @@ -20,28 +21,41 @@ icon_state = "implanter0" origin_tech = initial(origin_tech) -/obj/item/bio_chip_implanter/attack__legacy__attackchain(mob/living/carbon/M, mob/user) - if(!iscarbon(M)) - return - if(user && imp) - if(M != user) - M.visible_message(SPAN_WARNING("[user] is attempting to bio-chip [M].")) +/obj/item/bio_chip_implanter/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(!iscarbon(target)) + return NONE - var/turf/T = get_turf(M) - if(T && (M == user || do_after(user, 50 * toolspeed, target = M))) - if(user && M && (get_turf(M) == T) && src && imp) - if(imp.implant(M, user)) - if(M == user) - to_chat(user, SPAN_NOTICE("You bio-chip yourself.")) - else - M.visible_message("[user] has implanted [M].", SPAN_NOTICE("[user] bio-chips you.")) - imp = null - update_icon(UPDATE_ICON_STATE) + if(!imp) + to_chat(user, SPAN_WARNING("There's no implant inside [src]!")) + return ITEM_INTERACT_COMPLETE -/obj/item/bio_chip_implanter/attackby__legacy__attackchain(obj/item/W, mob/user, params) - ..() - if(is_pen(W)) - rename_interactive(user, W) + if(target != user) + target.visible_message(SPAN_WARNING("[user] is attempting to bio-chip [target].")) + + var/turf/T = get_turf(target) + if(!(T && (target == user || do_after_once(user, 50 * toolspeed, target = target)))) + return ITEM_INTERACT_COMPLETE + + if(QDELETED(user) || !imp) + return ITEM_INTERACT_COMPLETE + + if(!imp.implant(target, user)) + to_chat(user, SPAN_WARNING("You fail to insert the bio-chip.")) + return ITEM_INTERACT_COMPLETE + + if(target == user) + to_chat(user, SPAN_NOTICE("You bio-chip yourself.")) + else + target.visible_message("[user] has implanted [target].", SPAN_NOTICE("[user] bio-chips you.")) + imp = null + update_icon(UPDATE_ICON_STATE) + add_fingerprint(user) + return ITEM_INTERACT_COMPLETE + +/obj/item/bio_chip_implanter/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(is_pen(used)) + rename_interactive(user, used) + return ITEM_INTERACT_COMPLETE /obj/item/bio_chip_implanter/Initialize(mapload) . = ..()