Fixes slightly more harddels (#58935)

This commit is contained in:
LemonInTheDark
2021-05-08 04:48:59 -07:00
committed by GitHub
parent 98a13c9376
commit a7b06341db
3 changed files with 20 additions and 9 deletions
+2 -2
View File
@@ -96,8 +96,8 @@
/datum/mind/Destroy()
SSticker.minds -= src
if(islist(antag_datums))
QDEL_LIST(antag_datums)
QDEL_LIST(antag_datums)
QDEL_NULL(language_holder)
current = null
return ..()
+2 -3
View File
@@ -80,7 +80,7 @@
/// What kind of scars this wound will create description wise once healed
var/scar_keyword = "generic"
/// If we've already tried scarring while removing (since remove_wound calls qdel, and qdel calls remove wound, .....) TODO: make this cleaner
/// If we've already tried scarring while removing (remove_wound can be called twice in a del chain, let's be nice to our code yeah?) TODO: make this cleaner
var/already_scarred = FALSE
/// If we forced this wound through badmin smite, we won't count it towards the round totals
var/from_smite
@@ -91,8 +91,7 @@
/datum/wound/Destroy()
if(attached_surgery)
QDEL_NULL(attached_surgery)
if(limb?.wounds && (src in limb.wounds)) // destroy can call remove_wound() and remove_wound() calls qdel, so we check to make sure there's anything to remove first
remove_wound()
remove_wound()
set_limb(null)
victim = null
return ..()
+16 -4
View File
@@ -35,12 +35,24 @@
if(old_wound)
blood_flow = max(old_wound.blood_flow, initial_flow)
if(old_wound.severity > severity && old_wound.highest_scar)
highest_scar = old_wound.highest_scar
old_wound.highest_scar = null
set_highest_scar(old_wound.highest_scar)
old_wound.clear_highest_scar()
if(!highest_scar)
highest_scar = new
highest_scar.generate(limb, src, add_to_scars=FALSE)
var/datum/scar/new_scar = new
set_highest_scar(new_scar)
new_scar.generate(limb, src, add_to_scars=FALSE)
/datum/wound/slash/proc/set_highest_scar(datum/scar/new_scar)
if(highest_scar)
UnregisterSignal(highest_scar, COMSIG_PARENT_QDELETING)
if(new_scar)
RegisterSignal(new_scar, COMSIG_PARENT_QDELETING, .proc/clear_highest_scar)
highest_scar = new_scar
/datum/wound/slash/proc/clear_highest_scar(datum/source)
SIGNAL_HANDLER
set_highest_scar(null)
/datum/wound/slash/remove_wound(ignore_limb, replaced)
if(!replaced && highest_scar)