mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
A lot of new defines are now in inventory_sizes.dm, which contains; All the size identifiers (the thing that tells the game if something is bulky, or w/e). Storage costs for all the sizes, which are exponents of two, as previously. A few constants for inventory size. Also changes all storage item's capacity definitions by basing it off of how many 'normal slots' exist for it. This allows one to change the definition for all of the defines in the file, and everything will follow along without needing to change 500 files. In testing, I made all ITEMSIZE_COST_* defines doubled, and nothing had broke. The benefit of doing all of this is that it makes adding new weight classes in the future much simpler, and makes knowing how much space a container has easier, as seeing ITEMSIZE_COST_NORMAL * 7 means it can hold seven normal items.
88 lines
3.6 KiB
Plaintext
88 lines
3.6 KiB
Plaintext
/obj/item/dnalockingchip
|
|
name = "DNA Chip Lock"
|
|
icon = 'icons/obj/ammo.dmi'
|
|
icon_state = "dnalockchip"
|
|
desc = "A state of the art technological chip that can be installed in a firearm. It allows the user to store their DNA and lock the gun's use from unwanted users."
|
|
w_class = ITEMSIZE_TINY
|
|
origin_tech = list(TECH_COMBAT = 4, TECH_DATA = 4, TECH_BIO = 4)
|
|
|
|
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
|
|
var/controller_lock = 0 //whether or not the gun is locked by the primar controller, 0 or 1, at 1 it is locked and does not allow
|
|
var/exploding = 0
|
|
|
|
|
|
/obj/item/weapon/gun/proc/get_dna(mob/user)
|
|
var/mob/living/M = user
|
|
if(!attached_lock.controller_lock)
|
|
|
|
if(!attached_lock.stored_dna && !(M.dna in attached_lock.stored_dna))
|
|
M << "<span class='warning'>\The [src] buzzes and displays a symbol showing the gun already contains your DNA.</span>"
|
|
return 0
|
|
else
|
|
attached_lock.stored_dna += M.dna
|
|
M << "<span class='notice'>\The [src] pings and a needle flicks out from the grip, taking a DNA sample from you.</span>"
|
|
if(!attached_lock.controller_dna)
|
|
attached_lock.controller_dna = M.dna
|
|
M << "<span class='notice'>\The [src] processes the dna sample and pings, acknowledging you as the primary controller.</span>"
|
|
return 1
|
|
else
|
|
M << "<span class='warning'>\The [src] buzzes and displays a locked symbol. It is not allowing DNA samples at this time.</span>"
|
|
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(!attached_lock.controller_lock)
|
|
if(!authorized_user(M))
|
|
M << "<span class='warning'>\The [src] buzzes and displays an invalid user symbol.</span>"
|
|
return 0
|
|
else
|
|
attached_lock.stored_dna -= user.dna
|
|
M << "<span class='notice'>\The [src] beeps and clears the DNA it has stored.</span>"
|
|
if(M.dna == attached_lock.controller_dna)
|
|
attached_lock.controller_dna = null
|
|
M << "<span class='notice'>\The [src] beeps and removes you as the primary controller.</span>"
|
|
if(attached_lock.controller_lock)
|
|
attached_lock.controller_lock = 0
|
|
return 1
|
|
else
|
|
M << "<span class='warning'>\The [src] buzzes and displays a locked symbol. It is not allowing DNA modifcation at this time.</span>"
|
|
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 == attached_lock.controller_dna)
|
|
if(!attached_lock.controller_lock)
|
|
attached_lock.controller_lock = 1
|
|
M << "<span class='notice'>\The [src] beeps and displays a locked symbol, informing you it will no longer allow DNA samples.</span>"
|
|
else
|
|
attached_lock.controller_lock = 0
|
|
M << "<span class='notice'>\The [src] beeps and displays an unlocked symbol, informing you it will now allow DNA samples.</span>"
|
|
else
|
|
M << "<span class='warning'>\The [src] buzzes and displays an invalid user symbol.</span>"
|
|
|
|
/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(!attached_lock.stored_dna || !attached_lock.stored_dna.len)
|
|
return 1
|
|
if(!(user.dna in attached_lock.stored_dna))
|
|
return 0
|
|
return 1 |