diff --git a/code/modules/projectiles/dnalocking.dm b/code/modules/projectiles/dnalocking.dm new file mode 100644 index 00000000000..eb0ebab3e04 --- /dev/null +++ b/code/modules/projectiles/dnalocking.dm @@ -0,0 +1,83 @@ +/obj/item/dnalockingchip + name = "DNA Chip Lock" + icon = 'icons/obj/ammo.dmi' + icon_state = "dnalockchip" + w_class = 1 + var/safety_level = 0 + origin_tech = list(TECH_COMBAT = 4, TECH_DATA = 4, TECH_BIO = 4) + + + +/obj/item/weapon/gun/proc/get_dna(mob/user) + var/mob/living/M = user + if(!controller_lock) + + if(!stored_dna && !(M.dna in stored_dna)) + M << "\The [src] buzzes and displays a symbol showing the gun already contains your DNA." + return 0 + else + stored_dna += M.dna + M << "\The [src] pings and a needle flicks out from the grip, taking a DNA sample from you." + if(!controller_dna) + controller_dna = M.dna + M << "\The [src] processes the dna sample and pings, acknowledging you as the primary controller." + return 1 + else + M << "\The [src] buzzes and displays a locked symbol. It is not allowing DNA samples at this time." + return 0 + +/obj/item/weapon/gun/verb/give_dna() + set name = "Give DNA" + set category = "Object" + set src in usr + get_dna(usr) + +/obj/item/weapon/gun/proc/clear_dna(mob/user) + var/mob/living/M = user + if(!controller_lock) + if(!authorized_user(M)) + M << "\The [src] buzzes and displays an invalid user symbol." + return 0 + else + stored_dna -= user.dna + M << "\The [src] beeps and clears the DNA it has stored." + if(M.dna == controller_dna) + controller_dna = null + M << "\The [src] beeps and removes you as the primary controller." + if(controller_lock) + controller_lock = 0 + return 1 + else + M << "\The [src] buzzes and displays a locked symbol. It is not allowing DNA modifcation at this time." + return 0 + +/obj/item/weapon/gun/verb/remove_dna() + set name = "Remove DNA" + set category = "Object" + set src in usr + clear_dna(usr) + +/obj/item/weapon/gun/proc/toggledna(mob/user) + var/mob/living/M = user + if(authorized_user(M) && user.dna == controller_dna) + if(!controller_lock) + controller_lock = 1 + M << "\The [src] beeps and displays a locked symbol, informing you it will no longer allow DNA samples." + else + controller_lock = 0 + M << "\The [src] beeps and displays an unlocked symbol, informing you it will now allow DNA samples." + else + M << "\The [src] buzzes and displays an invalid user symbol." + +/obj/item/weapon/gun/verb/allow_dna() + set name = "Toggle DNA Samples Allowance" + set category = "Object" + set src in usr + toggledna(usr) + +/obj/item/weapon/gun/proc/authorized_user(mob/user) + if(!stored_dna || !stored_dna.len) + return 1 + if(!(user.dna in stored_dna)) + return 0 + return 1 \ No newline at end of file diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index e545242cdcd..38a6b10b2fa 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -83,7 +83,7 @@ var/tmp/lock_time = -100 var/dna_lock = 0 //whether or not the gun is locked to dna - var/attached_lock + var/obj/item/dnalockingchip/attached_lock var/list/stored_dna = list() //list of the dna stored in the gun, used to allow users to use it or not var/safety_level = 0 //either 0 or 1, at 0 the game buzzes and tells the user they can't use it, at 1 it self destructs after 10 seconds var/controller_dna = null //The dna of the person who is the primary controller of the gun @@ -98,6 +98,9 @@ if(isnull(scoped_accuracy)) scoped_accuracy = accuracy + if(dna_lock) + attached_lock = new /obj/item/dnalockingchip(src) + safety_level = attached_lock.safety_level if(!dna_lock) verbs -= /obj/item/weapon/gun/verb/remove_dna verbs -= /obj/item/weapon/gun/verb/give_dna @@ -198,7 +201,7 @@ attached_lock = A dna_lock = 1 var/obj/item/dnalockingchip/C = A - security_level = C.safety_level + safety_level = C.safety_level verbs += /obj/item/weapon/gun/verb/remove_dna verbs += /obj/item/weapon/gun/verb/give_dna verbs += /obj/item/weapon/gun/verb/allow_dna