Files
Aurora.3/code/game/objects/items/weapons/implants/implanter.dm
T
Lohikar 61b5203d24 Runtime Map Loading (#3597)
changes:

Maps are no longer compiled in, instead loaded directly from the DMMs at runtime.
Z level defines have been moved from the config to map datums.
Unit tests now use typecaches.
DMMS now actually works.
DMMS has been updated slightly.
DMMS is now capable of loading simple lists of non-text types.
DMMS is now faster when loading many types without mapped in attributes and when loading area instances.
Asteroid generation is now defined on the map datum instead of being hard-coded in SSasteroid.
Holodeck presets are now defined on the map datum.
Atmos machinery now uses Initialize().
2017-10-18 23:07:34 +03:00

203 lines
5.9 KiB
Plaintext

/obj/item/weapon/implanter
name = "implanter"
icon = 'icons/obj/items.dmi'
icon_state = "implanter0"
item_state = "syringe_0"
throw_speed = 1
throw_range = 5
w_class = 2.0
var/obj/item/weapon/implant/imp = null
/obj/item/weapon/implanter/attack_self(var/mob/user)
if(!imp)
return ..()
imp.loc = get_turf(src)
user.put_in_hands(imp)
user << "<span class='notice'>You remove \the [imp] from \the [src].</span>"
name = "implanter"
imp = null
update()
return
/obj/item/weapon/implanter/proc/update()
if (src.imp)
src.icon_state = "implanter1"
else
src.icon_state = "implanter0"
return
/obj/item/weapon/implanter/attack(mob/M as mob, mob/user as mob, var/target_zone)
if (!istype(M, /mob/living/carbon))
return
if (user && src.imp)
M.visible_message("<span class='warning'>[user] is attemping to implant [M].</span>")
user.setClickCooldown(DEFAULT_QUICK_COOLDOWN)
user.do_attack_animation(M)
var/turf/T1 = get_turf(M)
if (T1 && ((M == user) || do_after(user, 50)))
if(user && M && (get_turf(M) == T1) && src && src.imp)
M.visible_message("<span class='warning'>[M] has been implanted by [user].</span>")
admin_attack_log(user, M, "Implanted using \the [src.name] ([src.imp.name])", "Implanted with \the [src.name] ([src.imp.name])", "used an implanter, [src.name] ([src.imp.name]), on")
if(src.imp.implanted(M))
src.imp.loc = M
src.imp.imp_in = M
src.imp.implanted = 1
if (ishuman(M))
var/mob/living/carbon/human/H = M
var/obj/item/organ/external/affected = H.get_organ(target_zone)
affected.implants += src.imp
imp.part = affected
BITSET(H.hud_updateflag, IMPLOYAL_HUD)
if(istype(src.imp, /obj/item/weapon/implanter/loyalty))
M << "<span class ='notice'You feel a sudden surge of loyalty to [current_map.company_name]!</span>"
src.imp = null
update()
return
/obj/item/weapon/implanter/loyalty
name = "implanter-loyalty"
/obj/item/weapon/implanter/loyalty/New()
src.imp = new /obj/item/weapon/implant/loyalty( src )
..()
update()
return
/obj/item/weapon/implanter/explosive
name = "implanter (E)"
/obj/item/weapon/implanter/explosive/New()
src.imp = new /obj/item/weapon/implant/explosive( src )
..()
update()
return
/obj/item/weapon/implanter/adrenalin
name = "implanter-adrenalin"
/obj/item/weapon/implanter/adrenalin/New()
src.imp = new /obj/item/weapon/implant/adrenalin(src)
..()
update()
return
/obj/item/weapon/implanter/compressed
name = "implanter (C)"
icon_state = "cimplanter1"
/obj/item/weapon/implanter/compressed/New()
imp = new /obj/item/weapon/implant/compressed( src )
..()
update()
return
/obj/item/weapon/implanter/compressed/update()
if (imp)
var/obj/item/weapon/implant/compressed/c = imp
if(!c.scanned)
icon_state = "cimplanter1"
else
icon_state = "cimplanter2"
else
icon_state = "cimplanter0"
return
/obj/item/weapon/implanter/compressed/attack(mob/M as mob, mob/user as mob)
var/obj/item/weapon/implant/compressed/c = imp
if (!c) return
if (c.scanned == null)
user << "Please scan an object with the implanter first."
return
..()
/obj/item/weapon/implanter/compressed/afterattack(atom/A, mob/user as mob, proximity)
if(!proximity)
return
if(istype(A,/obj/item) && imp)
var/obj/item/weapon/implant/compressed/c = imp
if (c.scanned)
user << "<span class='warning'>Something is already scanned inside the implant!</span>"
return
c.scanned = A
if(istype(A.loc,/mob/living/carbon/human))
var/mob/living/carbon/human/H = A.loc
H.remove_from_mob(A)
else if(istype(A.loc,/obj/item/weapon/storage))
var/obj/item/weapon/storage/S = A.loc
S.remove_from_storage(A)
A.loc.contents.Remove(A)
update()
/obj/item/weapon/implanter/ipc_tag
name = "IPC/Shell tag implanter"
desc = "A special implanter used for implanting synthetics with a special tag."
var/obj/item/organ/ipc_tag/ipc_tag = null
/obj/item/weapon/implanter/ipc_tag/New()
ipc_tag = new(src)
..()
update()
/obj/item/weapon/implanter/ipc_tag/update()
if (ipc_tag)
icon_state = "cimplanter1"
else
icon_state = "cimplanter0"
return
/obj/item/weapon/implanter/ipc_tag/attack(mob/M as mob, mob/user as mob)
if (!ishuman(M))
return
if (!ipc_tag)
user << "<span class ='warning'>[src] is empty!</span>"
return
var/mob/living/carbon/human/H = M
if (!H.species || !isipc(H) || !H.organs_by_name["groin"])
user << "<span class = 'warning'>You cannot use this on a non-synthetic organism!</span>"
return
if (H.internal_organs_by_name["ipc tag"])
user << "<span class = 'warning'>[H] is already tagged!</span>"
return
for (var/mob/O in viewers(M, null))
O.show_message("<span class = 'warning'>[M] has been implanted by [user].</span>", 1)
M.attack_log += text("\[[time_stamp()]\] <font color='orange'> Implanted with [src.name] ([src.ipc_tag.name]) by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Used the [src.name] ([src.ipc_tag.name]) to implant [M.name] ([M.ckey])</font>")
msg_admin_attack("[key_name_admin(user)] implanted [key_name_admin(M)] with [src.name] (INTENT: [uppertext(user.a_intent)]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)",ckey=key_name(user),ckey_target=key_name(M))
user.show_message("<span class = 'warning'>You implanted the implant into [M].</span>")
ipc_tag.replaced(H, H.organs_by_name["groin"])
qdel(ipc_tag)
update()
var/datum/species/machine/machine = H.species
machine.update_tag(H, H.client)
/obj/item/weapon/implanter/ipc_tag/attackby(var/obj/item/organ/ipc_tag/new_tag, mob/user as mob)
..()
if (!istype(new_tag))
return
if (ipc_tag)
return
ipc_tag = new_tag
user.drop_item()
new_tag.loc = src
update()