Files
kiwistation/code/game/objects/items/weapons/implants/implant.dm
T
phil235 0ec876d9fe Refactored the item's action system. Items can now hold multiple actions.
The "set internals" button of tank items now turn green when it's used as internals.
Removed research scanner from drones (since cyborgs don't have it, it's more consistent)
Removed the ignore_madkadjust mask var.
The sechailer mask now has an adjust mask action button, so I removed the adjust verb that it was using.
The item's action are now created on item/New() instead of trying to create it every time someone picks the item up.
I split hud/action.dm, the datum/action stuff is now in the datum folder (/datum/action.dm), whereas the code for action buttons is kept in the hud folder under action_button.dm. Also I moved some /datum/action code that was in some files back into datum/action.dm where it belongs.
2016-02-23 19:37:42 +01:00

85 lines
2.1 KiB
Plaintext

/obj/item/weapon/implant
name = "implant"
icon = 'icons/obj/implants.dmi'
icon_state = "generic" //Shows up as the action button icon
origin_tech = "materials=2;biotech=3;programming=2"
actions_types = list(/datum/action/item_action/hands_free/activate)
var/activated = 1 //1 for implant types that can be activated, 0 for ones that are "always on" like loyalty implants
var/implanted = null
var/mob/living/imp_in = null
item_color = "b"
var/allow_multiple = 0
var/uses = -1
/obj/item/weapon/implant/proc/trigger(emote, mob/source)
return
/obj/item/weapon/implant/proc/activate()
return
/obj/item/weapon/implant/ui_action_click()
activate("action_button")
//What does the implant do upon injection?
//return 1 if the implant injects
//return -1 if the implant fails to inject
//return 0 if there is no room for implant
/obj/item/weapon/implant/proc/implant(var/mob/source, var/mob/user)
var/obj/item/weapon/implant/imp_e = locate(src.type) in source
if(!allow_multiple && imp_e && imp_e != src)
if(imp_e.uses < initial(imp_e.uses)*2)
if(uses == -1)
imp_e.uses = -1
else
imp_e.uses = min(imp_e.uses + uses, initial(imp_e.uses)*2)
qdel(src)
return 1
else
return 0
src.loc = source
imp_in = source
implanted = 1
if(activated)
for(var/X in actions)
var/datum/action/A = X
A.Grant(source)
if(istype(source, /mob/living/carbon/human))
var/mob/living/carbon/human/H = source
H.sec_hud_set_implants()
if(user)
add_logs(user, source, "implanted", object="[name]")
return 1
/obj/item/weapon/implant/proc/removed(var/mob/source)
src.loc = null
imp_in = null
implanted = 0
for(var/X in actions)
var/datum/action/A = X
A.Grant(source)
if(istype(source, /mob/living/carbon/human))
var/mob/living/carbon/human/H = source
H.sec_hud_set_implants()
return 1
/obj/item/weapon/implant/Destroy()
if(imp_in)
removed(imp_in)
return ..()
/obj/item/weapon/implant/proc/get_data()
return "No information available"
/obj/item/weapon/implant/dropped(mob/user)
..()
. = 1
qdel(src)