Adds a bunch of owner.current nullchecks to antag code (#91524)

This could cause runtimes preventing antag datum removal in case your
body got destroyed. Ideally we'd unit test for this, but I can't get it
to work sanely without touching some dynamic code (due to some antag
datums requiring a bunch of snowflaky setups), so the unit test will
come after its refactored.

🆑
fix: Fixed some edge cases where antagonist datums would "stick" and not
get removed if your body got destroyed.
/🆑

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
SmArtKar
2025-06-21 22:20:11 -04:00
committed by Roxy
co-authored by Ghom
parent a14a83b2c7
commit 33da2f07ea
19 changed files with 48 additions and 37 deletions
+4 -2
View File
@@ -34,14 +34,14 @@
var/datum/antagonist/A = has_antag_datum(datum_type)
if(A)
A.on_removal()
current.log_message("has lost antag datum [A.name]([A.type]).", LOG_GAME)
current?.log_message("has lost antag datum [A.name]([A.type]).", LOG_GAME)
return TRUE
/datum/mind/proc/remove_all_antag_datums() //For the Lazy amongst us.
for(var/a in antag_datums)
var/datum/antagonist/A = a
A.on_removal()
current.log_message("has lost all antag datums.", LOG_GAME)
current?.log_message("has lost all antag datums.", LOG_GAME)
/datum/mind/proc/has_antag_datum(datum_type, check_subtypes = TRUE)
if(!datum_type)
@@ -93,6 +93,8 @@
/datum/mind/proc/remove_antag_equip()
if(!current)
return
var/list/Mob_Contents = current.get_contents()
for(var/obj/item/I in Mob_Contents)
var/datum/component/uplink/O = I.GetComponent(/datum/component/uplink) //Todo make this reset signal