Files
CHOMPStation2/code/game/objects/items/weapons/implants/implanter.dm
CHOMPStation2StaffMirrorBot 1b8f394a14 [MIRROR] Makes uses of do_after sane (#11582)
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
2025-09-07 23:02:27 -04:00

161 lines
4.0 KiB
Plaintext

/obj/item/implanter
name = "implanter"
icon = 'icons/obj/items.dmi'
icon_state = "implanter0_1"
item_state = "syringe_0"
throw_speed = 1
throw_range = 5
w_class = ITEMSIZE_SMALL
matter = list(MAT_STEEL = 1000, MAT_GLASS = 1000)
var/obj/item/implant/imp = null
var/active = 1
/obj/item/implanter/attack_self(var/mob/user)
active = !active
to_chat(user, span_notice("You [active ? "" : "de"]activate \the [src]."))
update()
/obj/item/implanter/verb/remove_implant()
set category = "Object"
set name = "Remove Implant"
set src in usr
if(!imp)
return
if(istype(usr, /mob))
var/mob/M = usr
imp.loc = get_turf(src)
if(M.get_active_hand() == null)
M.put_in_hands(imp)
to_chat(M, span_notice("You remove \the [imp] from \the [src]."))
name = "implanter"
imp = null
update()
return
/obj/item/implanter/proc/update()
if (src.imp)
src.icon_state = "implanter1"
else
src.icon_state = "implanter0"
src.icon_state += "_[active]"
return
/obj/item/implanter/attack(mob/M as mob, mob/user as mob)
if (!istype(M, /mob/living/carbon))
return
if(active)
if (imp)
M.visible_message(span_warning("[user] is attempting to implant [M]."))
user.setClickCooldown(DEFAULT_QUICK_COOLDOWN)
user.do_attack_animation(M)
var/turf/T1 = get_turf(M)
if (T1 && ((M == user) || do_after(user, 5 SECONDS, target = M)))
if(user && M && (get_turf(M) == T1) && src && src.imp)
M.visible_message(span_warning("[M] has been implanted by [user]."))
add_attack_logs(user,M,"Implanted with [imp.name] using [name]")
if(imp.handle_implant(M))
imp.post_implant(M)
if(ishuman(M))
var/mob/living/carbon/human/H = M
BITSET(H.hud_updateflag, IMPLOYAL_HUD)
BITSET(H.hud_updateflag, BACKUP_HUD) //VOREStation Add - Backup HUD updates
src.imp = null
update()
else
to_chat(user, span_warning("You need to activate \the [src.name] first."))
return
/obj/item/implanter/loyalty
name = "implanter-loyalty"
/obj/item/implanter/loyalty/Initialize(mapload)
. = ..()
imp = new /obj/item/implant/loyalty(src)
update()
/obj/item/implanter/explosive
name = "implanter (E)"
/obj/item/implanter/explosive/Initialize(mapload)
. = ..()
imp = new /obj/item/implant/explosive(src)
update()
/obj/item/implanter/adrenalin
name = "implanter-adrenalin"
/obj/item/implanter/adrenalin/Initialize(mapload)
. = ..()
imp = new /obj/item/implant/adrenalin(src)
update()
/obj/item/implanter/compressed
name = "implanter (C)"
icon_state = "cimplanter1"
/obj/item/implanter/compressed/Initialize(mapload)
. = ..()
imp = new /obj/item/implant/compressed(src)
update()
/obj/item/implanter/compressed/update()
if (imp)
var/obj/item/implant/compressed/c = imp
if(!c.scanned)
icon_state = "cimplanter1"
else
icon_state = "cimplanter2"
else
icon_state = "cimplanter0"
return
/obj/item/implanter/compressed/attack(mob/M as mob, mob/user as mob)
var/obj/item/implant/compressed/c = imp
if (!c) return
if (c.scanned == null)
to_chat(user, "Please scan an object with the implanter first.")
return
..()
/obj/item/implanter/compressed/afterattack(atom/A, mob/user as mob, proximity)
if(!proximity)
return
if(!active)
to_chat(user, span_warning("Activate \the [src.name] first."))
return
if(istype(A,/obj/item) && imp)
var/obj/item/implant/compressed/c = imp
if (c.scanned)
to_chat(user, span_warning("Something is already scanned inside the implant!"))
return
c.scanned = A
if(istype(A, /obj/item/storage))
to_chat(user, span_warning("You can't store \the [A.name] in this!"))
c.scanned = null
return
if(ishuman(A.loc))
var/mob/living/carbon/human/H = A.loc
H.remove_from_mob(A)
else if(istype(A.loc,/obj/item/storage))
var/obj/item/storage/S = A.loc
S.remove_from_storage(A)
A.loc.contents.Remove(A)
update()
/obj/item/implanter/restrainingbolt
name = "implanter (bolt)"
/obj/item/implanter/restrainingbolt/Initialize(mapload)
. = ..()
imp = new /obj/item/implant/restrainingbolt(src)
update()