Implants work on /living mobs (#22392)

This commit is contained in:
AnturK
2016-12-24 19:44:34 +01:00
committed by KorPhaeron
parent 35362048c0
commit 85669e6746
17 changed files with 63 additions and 53 deletions

View File

@@ -36,7 +36,7 @@
Tr = get_turf(C) Tr = get_turf(C)
if((Tr) && (Tr.z != src.z)) if((Tr) && (Tr.z != src.z))
continue//Out of range continue//Out of range
if(!C.implanted) if(!C.imp_in)
continue continue
dat += "ID: [C.imp_in.name] | Remaining Units: [C.reagents.total_volume] <BR>" dat += "ID: [C.imp_in.name] | Remaining Units: [C.reagents.total_volume] <BR>"
dat += "| Inject: " dat += "| Inject: "
@@ -48,8 +48,6 @@
for(var/obj/item/weapon/implant/tracking/T in tracked_implants) for(var/obj/item/weapon/implant/tracking/T in tracked_implants)
if(!iscarbon(T.imp_in)) if(!iscarbon(T.imp_in))
continue continue
if(!T.implanted)
continue
Tr = get_turf(T) Tr = get_turf(T)
if((Tr) && (Tr.z != src.z)) if((Tr) && (Tr.z != src.z))
continue//Out of range continue//Out of range

View File

@@ -180,7 +180,7 @@
L[tmpname] = R L[tmpname] = R
for (var/obj/item/weapon/implant/tracking/I in tracked_implants) for (var/obj/item/weapon/implant/tracking/I in tracked_implants)
if (!I.implanted || !ismob(I.loc)) if (!I.imp_in || !ismob(I.loc))
continue continue
else else
var/mob/M = I.loc var/mob/M = I.loc

View File

@@ -12,7 +12,7 @@
/obj/item/stack/telecrystal/attack(mob/target, mob/user) /obj/item/stack/telecrystal/attack(mob/target, mob/user)
if(target == user) //You can't go around smacking people with crystals to find out if they have an uplink or not. if(target == user) //You can't go around smacking people with crystals to find out if they have an uplink or not.
for(var/obj/item/weapon/implant/uplink/I in target) for(var/obj/item/weapon/implant/uplink/I in target)
if(I && I.implanted) if(I && I.imp_in)
I.hidden_uplink.telecrystals += 1 I.hidden_uplink.telecrystals += 1
use(1) use(1)
user << "<span class='notice'>You press [src] onto yourself and charge your hidden uplink.</span>" user << "<span class='notice'>You press [src] onto yourself and charge your hidden uplink.</span>"

View File

@@ -5,10 +5,9 @@
origin_tech = "materials=2;biotech=3;programming=2" origin_tech = "materials=2;biotech=3;programming=2"
actions_types = list(/datum/action/item_action/hands_free/activate) 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/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
var/mob/living/carbon/imp_in = null
item_color = "b" item_color = "b"
var/allow_multiple = 0 var/allow_multiple = FALSE
var/uses = -1 var/uses = -1
flags = DROPDEL flags = DROPDEL
@@ -22,13 +21,29 @@
/obj/item/weapon/implant/ui_action_click() /obj/item/weapon/implant/ui_action_click()
activate("action_button") activate("action_button")
/obj/item/weapon/implant/proc/can_be_implanted_in(mob/living/target) // for human-only and other special requirements
return TRUE
/mob/living/proc/can_be_implanted()
return TRUE
/mob/living/silicon/can_be_implanted()
return FALSE
/mob/living/simple_animal/can_be_implanted()
return healable //Applies to robots and most non-organics, exceptions can override.
//What does the implant do upon injection? //What does the implant do upon injection?
//return 1 if the implant injects //return 1 if the implant injects
//return -1 if the implant fails to inject //return -1 if the implant fails to inject
//return 0 if there is no room for implant //return 0 if there is no room for implant
/obj/item/weapon/implant/proc/implant(mob/living/carbon/source, mob/user, silent = 0) /obj/item/weapon/implant/proc/implant(mob/living/target, mob/user, silent = 0)
for(var/X in source.implants) LAZYINITLIST(target.implants)
if(!target.can_be_implanted() || !can_be_implanted_in(target))
return -1
for(var/X in target.implants)
if(istype(X, type)) if(istype(X, type))
var/obj/item/weapon/implant/imp_e = X var/obj/item/weapon/implant/imp_e = X
if(!allow_multiple) if(!allow_multiple)
@@ -42,27 +57,25 @@
else else
return 0 return 0
src.loc = source src.loc = target
imp_in = source imp_in = target
source.implants += src target.implants += src
implanted = 1
if(activated) if(activated)
for(var/X in actions) for(var/X in actions)
var/datum/action/A = X var/datum/action/A = X
A.Grant(source) A.Grant(target)
if(ishuman(source)) if(ishuman(target))
var/mob/living/carbon/human/H = source var/mob/living/carbon/human/H = target
H.sec_hud_set_implants() H.sec_hud_set_implants()
if(user) if(user)
add_logs(user, source, "implanted", object="[name]") add_logs(user, target, "implanted", object="[name]")
return 1 return 1
/obj/item/weapon/implant/proc/removed(mob/living/carbon/source, silent = 0, special = 0) /obj/item/weapon/implant/proc/removed(mob/living/source, silent = 0, special = 0)
src.loc = null src.loc = null
imp_in = null imp_in = null
implanted = 0
source.implants -= src source.implants -= src
for(var/X in actions) for(var/X in actions)
var/datum/action/A = X var/datum/action/A = X

View File

@@ -23,11 +23,11 @@
if(cooldown == initial(cooldown)) if(cooldown == initial(cooldown))
STOP_PROCESSING(SSobj, src) STOP_PROCESSING(SSobj, src)
/obj/item/weapon/implant/abductor/implant(var/mob/source, var/mob/user) /obj/item/weapon/implant/abductor/implant(mob/living/target, mob/user)
if(..()) if(..())
var/obj/machinery/abductor/console/console var/obj/machinery/abductor/console/console
if(ishuman(source)) if(ishuman(target))
var/mob/living/carbon/human/H = source var/mob/living/carbon/human/H = target
if(H.dna.species.id == "abductor") if(H.dna.species.id == "abductor")
var/datum/species/abductor/S = H.dna.species var/datum/species/abductor/S = H.dna.species
console = get_team_console(S.team) console = get_team_console(S.team)

View File

@@ -45,8 +45,8 @@
return return
timed_explosion() timed_explosion()
/obj/item/weapon/implant/explosive/implant(mob/living/carbon/source) /obj/item/weapon/implant/explosive/implant(mob/living/target)
for(var/X in source.implants) for(var/X in target.implants)
if(istype(X, type)) if(istype(X, type))
var/obj/item/weapon/implant/explosive/imp_e = X var/obj/item/weapon/implant/explosive/imp_e = X
imp_e.heavy += heavy imp_e.heavy += heavy
@@ -86,12 +86,12 @@
heavy = 4 heavy = 4
delay = 70 delay = 70
/obj/item/weapon/implant/explosive/macro/implant(mob/living/carbon/source) /obj/item/weapon/implant/explosive/macro/implant(mob/living/target)
for(var/X in source.implants) for(var/X in target.implants)
if(istype(X, type)) if(istype(X, type))
return 0 return 0
for(var/Y in source.implants) for(var/Y in target.implants)
if(istype(Y, /obj/item/weapon/implant/explosive)) if(istype(Y, /obj/item/weapon/implant/explosive))
var/obj/item/weapon/implant/explosive/imp_e = Y var/obj/item/weapon/implant/explosive/imp_e = Y
heavy += imp_e.heavy heavy += imp_e.heavy

View File

@@ -22,7 +22,7 @@
<b>Integrity:</b> Implant's EMP function will destroy itself in the process."} <b>Integrity:</b> Implant's EMP function will destroy itself in the process."}
return dat return dat
/obj/item/weapon/implant/gang/implant(mob/living/carbon/target, mob/user, silent = 0) /obj/item/weapon/implant/gang/implant(mob/living/target, mob/user, silent = 0)
if(..()) if(..())
for(var/obj/item/weapon/implant/I in target.implants) for(var/obj/item/weapon/implant/I in target.implants)
if(I != src) if(I != src)

View File

@@ -17,7 +17,7 @@
return dat return dat
/obj/item/weapon/implant/mindshield/implant(mob/living/carbon/target, mob/user, silent = 0) /obj/item/weapon/implant/mindshield/implant(mob/living/target, mob/user, silent = 0)
if(..()) if(..())
if((target.mind in (ticker.mode.head_revolutionaries | ticker.mode.get_gang_bosses()))) if((target.mind in (ticker.mode.head_revolutionaries | ticker.mode.get_gang_bosses())))
if(!silent) if(!silent)

View File

@@ -71,11 +71,11 @@
var/healthstring = "" var/healthstring = ""
/obj/item/weapon/implant/health/proc/sensehealth() /obj/item/weapon/implant/health/proc/sensehealth()
if (!implanted) if (!imp_in)
return "ERROR" return "ERROR"
else else
if(isliving(implanted)) if(isliving(imp_in))
var/mob/living/L = implanted var/mob/living/L = imp_in
healthstring = "<small>Oxygen Deprivation Damage => [round(L.getOxyLoss())]<br />Fire Damage => [round(L.getFireLoss())]<br />Toxin Damage => [round(L.getToxLoss())]<br />Brute Force Damage => [round(L.getBruteLoss())]</small>" healthstring = "<small>Oxygen Deprivation Damage => [round(L.getOxyLoss())]<br />Fire Damage => [round(L.getFireLoss())]<br />Toxin Damage => [round(L.getToxLoss())]<br />Brute Force Damage => [round(L.getBruteLoss())]</small>"
if (!healthstring) if (!healthstring)
healthstring = "ERROR" healthstring = "ERROR"

View File

@@ -29,8 +29,8 @@
storage.remove_from_storage(I, get_turf(source)) storage.remove_from_storage(I, get_turf(source))
return 1 return 1
/obj/item/weapon/implant/storage/implant(mob/living/carbon/source, mob/user, silent = 0) /obj/item/weapon/implant/storage/implant(mob/living/target, mob/user, silent = 0)
for(var/X in source.implants) for(var/X in target.implants)
if(istype(X, type)) if(istype(X, type))
var/obj/item/weapon/implant/storage/imp_e = X var/obj/item/weapon/implant/storage/imp_e = X
imp_e.storage.storage_slots += storage.storage_slots imp_e.storage.storage_slots += storage.storage_slots
@@ -38,7 +38,7 @@
imp_e.storage.contents += storage.contents imp_e.storage.contents += storage.contents
storage.close_all() storage.close_all()
storage.show_to(source) storage.show_to(target)
qdel(src) qdel(src)
return 1 return 1

View File

@@ -37,7 +37,7 @@
else if(istype(W, /obj/item/weapon/implanter)) else if(istype(W, /obj/item/weapon/implanter))
var/obj/item/weapon/implanter/I = W var/obj/item/weapon/implanter/I = W
if(I.imp) if(I.imp)
if(imp || I.imp.implanted) if(imp || I.imp.imp_in)
return return
I.imp.loc = src I.imp.loc = src
imp = I.imp imp = I.imp

View File

@@ -68,7 +68,7 @@
implant(occupant,usr) implant(occupant,usr)
. = TRUE . = TRUE
/obj/machinery/implantchair/proc/implant(mob/living/carbon/M,mob/user) /obj/machinery/implantchair/proc/implant(mob/living/M,mob/user)
if (!istype(M)) if (!istype(M))
return return
if(!ready_implants || !ready) if(!ready_implants || !ready)
@@ -85,7 +85,7 @@
playsound(get_turf(src), 'sound/machines/buzz-sigh.ogg', 25, 1) playsound(get_turf(src), 'sound/machines/buzz-sigh.ogg', 25, 1)
update_icon() update_icon()
/obj/machinery/implantchair/proc/implant_action(mob/living/carbon/M) /obj/machinery/implantchair/proc/implant_action(mob/living/M)
var/obj/item/weapon/implant/I = new implant_type var/obj/item/weapon/implant/I = new implant_type
if(I.implant(M)) if(I.implant(M))
visible_message("<span class='warning'>[M] has been implanted by the [name].</span>") visible_message("<span class='warning'>[M] has been implanted by the [name].</span>")
@@ -133,11 +133,11 @@
container_resist(user) container_resist(user)
/obj/machinery/implantchair/MouseDrop_T(mob/target, mob/user) /obj/machinery/implantchair/MouseDrop_T(mob/target, mob/user)
if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser()) if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !isliving(target) || !user.IsAdvancedToolUser())
return return
close_machine(target) close_machine(target)
/obj/machinery/implantchair/close_machine(mob/user) /obj/machinery/implantchair/close_machine(mob/living/user)
if((isnull(user) || istype(user)) && state_open) if((isnull(user) || istype(user)) && state_open)
..(user) ..(user)
if(auto_inject && ready && ready_implants > 0) if(auto_inject && ready && ready_implants > 0)
@@ -171,8 +171,8 @@
var/objective = "Obey the law. Praise Nanotrasen." var/objective = "Obey the law. Praise Nanotrasen."
var/custom = FALSE var/custom = FALSE
/obj/machinery/implantchair/brainwash/implant_action(mob/living/carbon/C,mob/user) /obj/machinery/implantchair/brainwash/implant_action(mob/living/C,mob/user)
if(!istype(C) || !C.mind) if(!istype(C) || !C.mind) // I don't know how this makes any sense for silicons but laws trump objectives anyway.
return 0 return 0
if(custom) if(custom)
if(!user || !user.Adjacent(src)) if(!user || !user.Adjacent(src))

View File

@@ -21,8 +21,8 @@
origin_tech = initial(origin_tech) origin_tech = initial(origin_tech)
/obj/item/weapon/implanter/attack(mob/living/carbon/M, mob/user) /obj/item/weapon/implanter/attack(mob/living/M, mob/user)
if(!iscarbon(M)) if(!istype(M))
return return
if(user && imp) if(user && imp)
if(M != user) if(M != user)
@@ -55,8 +55,7 @@
/obj/item/weapon/implanter/New() /obj/item/weapon/implanter/New()
..() ..()
spawn(1) update_icon()
update_icon()

View File

@@ -10,8 +10,8 @@
hidden_uplink.telecrystals = 10 hidden_uplink.telecrystals = 10
..() ..()
/obj/item/weapon/implant/uplink/implant(mob/living/carbon/source, mob/user, silent = 0) /obj/item/weapon/implant/uplink/implant(mob/living/target, mob/user, silent = 0)
for(var/X in source.implants) for(var/X in target.implants)
if(istype(X, type)) if(istype(X, type))
var/obj/item/weapon/implant/imp_e = X var/obj/item/weapon/implant/imp_e = X
imp_e.hidden_uplink.telecrystals += hidden_uplink.telecrystals imp_e.hidden_uplink.telecrystals += hidden_uplink.telecrystals

View File

@@ -79,7 +79,7 @@ Frequency:
src.temp += "<B>Extranneous Signals:</B><BR>" src.temp += "<B>Extranneous Signals:</B><BR>"
for (var/obj/item/weapon/implant/tracking/W in tracked_implants) for (var/obj/item/weapon/implant/tracking/W in tracked_implants)
if (!W.implanted || !ismob(W.loc)) if (!W.imp_in || !ismob(W.loc))
continue continue
else else
var/mob/M = W.loc var/mob/M = W.loc

View File

@@ -5,8 +5,6 @@
var/list/internal_organs = list() //List of /obj/item/organ in the mob. They don't go in the contents for some reason I don't want to know. var/list/internal_organs = list() //List of /obj/item/organ in the mob. They don't go in the contents for some reason I don't want to know.
var/list/internal_organs_slot = list() //Same as above, but stores "slot ID" - "organ" pairs for easy access. var/list/internal_organs_slot = list() //Same as above, but stores "slot ID" - "organ" pairs for easy access.
var/list/implants = list()
var/silent = 0 //Can't talk. Value goes down every life proc. //NOTE TO FUTURE CODERS: DO NOT INITIALIZE NUMERICAL VARS AS NULL OR I WILL MURDER YOU. var/silent = 0 //Can't talk. Value goes down every life proc. //NOTE TO FUTURE CODERS: DO NOT INITIALIZE NUMERICAL VARS AS NULL OR I WILL MURDER YOU.
var/obj/item/handcuffed = null //Whether or not the mob is handcuffed var/obj/item/handcuffed = null //Whether or not the mob is handcuffed

View File

@@ -74,4 +74,6 @@
var/list/status_effects //a list of all status effects the mob has var/list/status_effects //a list of all status effects the mob has
var/slipping = FALSE var/slipping = FALSE
var/list/implants = null