[MIRROR] (Partially) Fixes Out Of Memory crashes (#10092)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-02-07 08:36:42 -07:00
committed by GitHub
parent 133f37de97
commit ec71611656
31 changed files with 124 additions and 67 deletions

View File

@@ -12,19 +12,21 @@
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/dnalockingchip/Destroy(force, ...)
. = ..()
/obj/item/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))
if(attached_lock.stored_dna && (M.dna.unique_enzymes in attached_lock.stored_dna))
to_chat(M, span_warning("\The [src] buzzes and displays a symbol showing the gun already contains your DNA."))
return 0
else
attached_lock.stored_dna += M.dna
attached_lock.stored_dna += M.dna.unique_enzymes
to_chat(M, span_notice("\The [src] pings and a needle flicks out from the grip, taking a DNA sample from you."))
if(!attached_lock.controller_dna)
attached_lock.controller_dna = M.dna
attached_lock.controller_dna = M.dna.unique_enzymes
to_chat(M, span_notice("\The [src] processes the dna sample and pings, acknowledging you as the primary controller."))
return 1
else
@@ -44,10 +46,9 @@
to_chat(M, span_warning("\The [src] buzzes and displays an invalid user symbol."))
return 0
else
attached_lock.stored_dna -= user.dna
attached_lock.stored_dna -= user.dna.unique_enzymes
to_chat(M, span_notice("\The [src] beeps and clears the DNA it has stored."))
if(M.dna == attached_lock.controller_dna)
attached_lock.controller_dna = null
if(M.dna.unique_enzymes == attached_lock.controller_dna)
to_chat(M, span_notice("\The [src] beeps and removes you as the primary controller."))
if(attached_lock.controller_lock)
attached_lock.controller_lock = 0
@@ -64,7 +65,7 @@
/obj/item/gun/proc/toggledna(mob/user)
var/mob/living/M = user
if(authorized_user(M) && user.dna == attached_lock.controller_dna)
if(authorized_user(M) && user.dna.unique_enzymes == attached_lock.controller_dna)
if(!attached_lock.controller_lock)
attached_lock.controller_lock = 1
to_chat(M, span_notice("\The [src] beeps and displays a locked symbol, informing you it will no longer allow DNA samples."))
@@ -83,6 +84,6 @@
/obj/item/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))
if(!(user.dna.unique_enzymes in attached_lock.stored_dna))
return 0
return 1