Merge pull request #654 from Citadel-Station-13/upstream-merge-26662
[MIRROR] Status effects are actually deleted/handled when the mob is deleted
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
var/tick_interval = 10 //How many deciseconds between ticks, approximately. Leave at 10 for every second.
|
||||
var/mob/living/owner //The mob affected by the status effect.
|
||||
var/status_type = STATUS_EFFECT_UNIQUE //How many of the effect can be on one mob, and what happens when you try to add another
|
||||
var/on_remove_on_mob_delete = FALSE //if we call on_remove() when the mob is deleted
|
||||
var/alert_type = /obj/screen/alert/status_effect //the alert thrown by the status effect, contains name and description
|
||||
|
||||
/datum/status_effect/New(mob/living/new_owner)
|
||||
@@ -21,8 +22,9 @@
|
||||
STOP_PROCESSING(SSfastprocess, src)
|
||||
if(owner)
|
||||
owner.clear_alert(id)
|
||||
on_remove()
|
||||
LAZYREMOVE(owner.status_effects, src)
|
||||
on_remove()
|
||||
owner = null
|
||||
return ..()
|
||||
|
||||
/datum/status_effect/proc/start_ticking()
|
||||
@@ -52,8 +54,8 @@
|
||||
|
||||
/datum/status_effect/proc/on_apply() //Called whenever the buff is applied.
|
||||
/datum/status_effect/proc/tick() //Called every tick.
|
||||
/datum/status_effect/proc/on_remove() //Called whenever the buff expires or is removed.
|
||||
/datum/status_effect/proc/be_replaced() //Called instead of on_remove when a status effect is replaced by itself
|
||||
/datum/status_effect/proc/on_remove() //Called whenever the buff expires or is removed; do note that at the point this is called, it is out of the owner's status_effects but owner is not yet null
|
||||
/datum/status_effect/proc/be_replaced() //Called instead of on_remove when a status effect is replaced by itself or when a status effect with on_remove_on_mob_delete = FALSE has its mob deleted
|
||||
owner.clear_alert(id)
|
||||
LAZYREMOVE(owner.status_effects, src)
|
||||
owner = null
|
||||
|
||||
@@ -29,6 +29,13 @@
|
||||
med_hud_set_status()
|
||||
|
||||
/mob/living/Destroy()
|
||||
if(LAZYLEN(status_effects))
|
||||
for(var/s in status_effects)
|
||||
var/datum/status_effect/S = s
|
||||
if(S.on_remove_on_mob_delete) //the status effect calls on_remove when its mob is deleted
|
||||
qdel(S)
|
||||
else
|
||||
S.be_replaced()
|
||||
if(ranged_ability)
|
||||
ranged_ability.remove_ranged_ability(src)
|
||||
if(buckled)
|
||||
|
||||
Reference in New Issue
Block a user