mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 08:37:43 +01:00
[MIRROR] Cleans up and dmdoc's implant.dm (#6959)
* Cleans up and dmdoc's implant.dm (#60179) Mostly variable names and dmdoc. Behavior unchanged. Co-authored-by: Your mother <mothmilk666666666666@ tfwno.gf> Co-authored-by: coiax <yellowbounder@ gmail.com> * Cleans up and dmdoc's implant.dm Co-authored-by: interestingusernam3 <51925758+interestingusernam3@users.noreply.github.com> Co-authored-by: Your mother <mothmilk666666666666@ tfwno.gf> Co-authored-by: coiax <yellowbounder@ gmail.com>
This commit is contained in:
co-authored by
Your mother
coiax
interestingusernam3
parent
56f7c55e8c
commit
7fa8c7e87c
@@ -1,12 +1,20 @@
|
||||
/**
|
||||
* Parent class for all implants
|
||||
*/
|
||||
/obj/item/implant
|
||||
name = "implant"
|
||||
icon = 'icons/obj/implants.dmi'
|
||||
icon_state = "generic" //Shows up as the action button icon
|
||||
actions_types = list(/datum/action/item_action/hands_free/activate)
|
||||
var/activated = TRUE //1 for implant types that can be activated, 0 for ones that are "always on" like mindshield implants
|
||||
///true for implant types that can be activated, false for ones that are "always on" like mindshield implants
|
||||
var/activated = TRUE
|
||||
///the mob that's implanted with this
|
||||
var/mob/living/imp_in = null
|
||||
///implant color, used for selecting either the "b" version or the "r" version of the implant case sprite when the implant is in a case.
|
||||
var/implant_color = "b"
|
||||
///if false, upon implantation of a duplicate implant, an attempt to combine the new implant's uses with the old one's uses will be made, deleting the new implant if successful or stopping the implantation if not
|
||||
var/allow_multiple = FALSE
|
||||
///how many times this can do something, only relevant for implants with limited uses
|
||||
var/uses = -1
|
||||
item_flags = DROPDEL
|
||||
|
||||
@@ -34,51 +42,61 @@
|
||||
|
||||
return TRUE
|
||||
|
||||
//What does the implant do upon injection?
|
||||
//return 1 if the implant injects
|
||||
//return 0 if there is no room for implant / it fails
|
||||
/**
|
||||
* What does the implant do upon injection?
|
||||
*
|
||||
* return true if the implant injects
|
||||
* return false if there is no room for implant / it fails
|
||||
* Arguments:
|
||||
* * mob/living/target - mob being implanted
|
||||
* * mob/user - mob doing the implanting
|
||||
* * silent - unused here
|
||||
* * force - if true, implantation will not fail if can_be_implanted_in returns false
|
||||
*/
|
||||
/obj/item/implant/proc/implant(mob/living/target, mob/user, silent = FALSE, force = FALSE)
|
||||
if(SEND_SIGNAL(src, COMSIG_IMPLANT_IMPLANTING, args) & COMPONENT_STOP_IMPLANTING)
|
||||
return
|
||||
LAZYINITLIST(target.implants)
|
||||
if(!force && !can_be_implanted_in(target))
|
||||
return FALSE
|
||||
|
||||
for(var/X in target.implants)
|
||||
var/obj/item/implant/imp_e = X
|
||||
var/flags = SEND_SIGNAL(imp_e, COMSIG_IMPLANT_OTHER, args, src)
|
||||
var/obj/item/implant/other_implant = X
|
||||
var/flags = SEND_SIGNAL(other_implant, COMSIG_IMPLANT_OTHER, args, src)
|
||||
if(flags & COMPONENT_STOP_IMPLANTING)
|
||||
UNSETEMPTY(target.implants)
|
||||
return FALSE
|
||||
if(flags & COMPONENT_DELETE_NEW_IMPLANT)
|
||||
UNSETEMPTY(target.implants)
|
||||
qdel(src)
|
||||
return TRUE
|
||||
if(flags & COMPONENT_DELETE_OLD_IMPLANT)
|
||||
qdel(imp_e)
|
||||
qdel(other_implant)
|
||||
continue
|
||||
if(flags & COMPONENT_STOP_IMPLANTING)
|
||||
UNSETEMPTY(target.implants)
|
||||
return FALSE
|
||||
|
||||
if(istype(imp_e, type))
|
||||
if(!allow_multiple)
|
||||
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 TRUE
|
||||
else
|
||||
return FALSE
|
||||
if(!istype(other_implant, type) || allow_multiple)
|
||||
continue
|
||||
|
||||
if(other_implant.uses < initial(other_implant.uses)*2)
|
||||
if(uses == -1)
|
||||
other_implant.uses = -1
|
||||
else
|
||||
other_implant.uses = min(other_implant.uses + uses, initial(other_implant.uses)*2)
|
||||
qdel(src)
|
||||
return TRUE
|
||||
else
|
||||
return FALSE
|
||||
|
||||
forceMove(target)
|
||||
imp_in = target
|
||||
target.implants += src
|
||||
if(activated)
|
||||
for(var/X in actions)
|
||||
var/datum/action/A = X
|
||||
A.Grant(target)
|
||||
var/datum/action/implant_action = X
|
||||
implant_action.Grant(target)
|
||||
if(ishuman(target))
|
||||
var/mob/living/carbon/human/H = target
|
||||
H.sec_hud_set_implants()
|
||||
var/mob/living/carbon/human/target_human = target
|
||||
target_human.sec_hud_set_implants()
|
||||
|
||||
if(user)
|
||||
log_combat(user, target, "implanted", "\a [name]")
|
||||
@@ -86,16 +104,25 @@
|
||||
SEND_SIGNAL(src, COMSIG_IMPLANT_IMPLANTED, target, user, silent, force)
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* Remove implant from mob.
|
||||
*
|
||||
* This removes the effects of the implant and moves it out of the mob and into nullspace.
|
||||
* Arguments:
|
||||
* * mob/living/source - What the implant is being removed from
|
||||
* * silent - unused here
|
||||
* * special - unused here
|
||||
*/
|
||||
/obj/item/implant/proc/removed(mob/living/source, silent = FALSE, special = 0)
|
||||
moveToNullspace()
|
||||
imp_in = null
|
||||
source.implants -= src
|
||||
for(var/X in actions)
|
||||
var/datum/action/A = X
|
||||
A.Grant(source)
|
||||
var/datum/action/implant_action = X
|
||||
implant_action.Grant(source)
|
||||
if(ishuman(source))
|
||||
var/mob/living/carbon/human/H = source
|
||||
H.sec_hud_set_implants()
|
||||
var/mob/living/carbon/human/human_source = source
|
||||
human_source.sec_hud_set_implants()
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_IMPLANT_REMOVED, source, silent, special)
|
||||
return TRUE
|
||||
@@ -104,10 +131,12 @@
|
||||
if(imp_in)
|
||||
removed(imp_in)
|
||||
return ..()
|
||||
|
||||
/**
|
||||
* Gets implant specifications for the implant pad
|
||||
*/
|
||||
/obj/item/implant/proc/get_data()
|
||||
return "No information available"
|
||||
|
||||
/obj/item/implant/dropped(mob/user)
|
||||
. = 1
|
||||
. = TRUE
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user