Migrate bio chip cases and implanters to the new attack chain. (#32427)

This commit is contained in:
Alan
2026-08-24 09:52:36 +00:00
committed by GitHub
parent 0db299d8c1
commit b297c1e296
2 changed files with 72 additions and 43 deletions
@@ -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
@@ -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)
. = ..()