traitor runtime and gc fixes (#19616)

This commit is contained in:
SteelSlayer
2022-11-11 14:20:59 +01:00
committed by GitHub
parent cd864c8a14
commit abec5338de
2 changed files with 11 additions and 5 deletions
+10 -4
View File
@@ -76,7 +76,7 @@
/datum/mind/Destroy()
SSticker.minds -= src
QDEL_LIST(antag_datums)
remove_all_antag_datums()
current = null
return ..()
@@ -1541,14 +1541,20 @@
*/
/datum/mind/proc/remove_antag_datum(datum_type)
var/datum/antagonist/A = has_antag_datum(datum_type)
LAZYREMOVE(antag_datums, A)
qdel(A)
/**
* Removes all antag datums from the src mind.
*
* Use this over doing `QDEL_LIST(antag_datums)`.
*/
/datum/mind/proc/remove_all_antag_datums() //For the Lazy amongst us.
QDEL_LIST(antag_datums)
/datum/mind/proc/remove_all_antag_datums()
// This is not `QDEL_LIST(antag_datums)`because it's possible for the `antag_datums` list to be set to null during deletion of an antag datum.
// Then `QDEL_LIST` would runtime because it would be doing `null.Cut()`.
for(var/datum/antagonist/A as anything in antag_datums)
qdel(A)
antag_datums?.Cut()
antag_datums = null
/// This proc sets the hijack speed for a mob. If greater than zero, they can hijack. Outputs in seconds.
/datum/mind/proc/get_hijack_speed()