ID cards now store a weakref to their mob instead of a hard ref. (#13271)

This commit is contained in:
mikomyazaki
2022-02-25 18:33:16 +01:00
committed by GitHub
parent a68d38b970
commit db7eb023bb
4 changed files with 33 additions and 27 deletions
+4 -5
View File
@@ -95,7 +95,7 @@ var/const/NO_EMAG_ACT = -50
var/list/access = list()
var/registered_name = "Unknown" // The name registered_name on the card
var/mob/living/carbon/human/mob
var/datum/weakref/mob_id
slot_flags = SLOT_ID
var/age = "\[UNSET\]"
@@ -125,7 +125,6 @@ var/const/NO_EMAG_ACT = -50
var/iff_faction = IFF_DEFAULT
/obj/item/card/id/Destroy()
mob = null
return ..()
/obj/item/card/id/examine(mob/user)
@@ -173,7 +172,7 @@ var/const/NO_EMAG_ACT = -50
id_card.age = age
id_card.citizenship = citizenship
id_card.religion = SSrecords.get_religion_record_name(religion)
id_card.mob = src
id_card.mob_id = WEAKREF(src)
id_card.employer_faction = employer_faction
/obj/item/card/id/proc/dat()
@@ -203,7 +202,7 @@ var/const/NO_EMAG_ACT = -50
to_chat(user, "<span class='warning'>You cannot imprint [src] while wearing \the [H.gloves].</span>")
return
else
mob = H
mob_id = WEAKREF(H)
blood_type = H.dna.b_type
dna_hash = H.dna.unique_enzymes
fingerprint_hash = md5(H.dna.uni_identity)
@@ -266,7 +265,7 @@ var/const/NO_EMAG_ACT = -50
to_chat(user, "<span class='warning'>They don't have any hands.</span>")
return 1
user.visible_message("[user] imprints [src] with \the [H]'s biometrics.")
mob = H
mob_id = WEAKREF(H)
blood_type = H.dna.b_type
dna_hash = H.dna.unique_enzymes
fingerprint_hash = md5(H.dna.uni_identity)