Files
Paradise/code/game/objects/items/weapons/implants/implant.dm
Tigercat2000 56a09db739 Action Button Update
- Refactors action button backend
   - Action buttons are no longer checked on Life(), items are responsible
     for adding/removing/updating them.
   - Item action buttons are no longer a static action_button_name define,
     items define actions_types, which is a list of paths.
   - Items can now have multiple action buttons.
     - This is handled by new arguments to ui_action_click, the first
       parameter is the user, the second is the path of the action datum
       that was invoked.
 - Refactored how internals function
   - You may now directly switch internals without breaking anything.
   - The internals icon has been updated to be more consistent.
 - Added action buttons for jetpacks
 - Added action buttons for oxygen tanks
 - Uses-based implants now qdel() themselves when they run out of uses.
   This is somewhat a buff to traitor implants, but it's such a minor
   change. The actual reasoning is so that the action buttons are properly
   removed.
 - Fixed a bug with the "Boo" spell which resulted in IsAvailable failing
   for certain ghosts.
 - You can now shift-click on movable HUD elements to reset them to the
   proper position (thank fucking christ)
2016-07-18 13:23:01 -07:00

88 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 mindshield 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(source, user, "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)