Files
Bubberstation/code/datums/status_effects/grouped_effect.dm
SkyratBot 6e8299cdf3 [MIRROR] Auto-docs + code improvements + splits up status_effect.dm [MDB IGNORE] (#12983)
* Auto-docs + code improvements + splits up status_effect.dm (#66362)

* Code improvements for status effects in general

* Does this for now

* Throws in a qdeleted check

* A return

* comment tweak

* Missed some ref()s

* Wrong var

* Comment clarifications

* Some more comment clarifications

* Auto-docs + code improvements + splits up status_effect.dm

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
2022-04-22 00:03:52 +01:00

21 lines
740 B
Plaintext

/// Status effect from multiple sources, when all sources are removed, so is the effect
/datum/status_effect/grouped
// Grouped effects adds itself to [var/sources] and destroys itself if one exists already, there are never actually multiple
status_type = STATUS_EFFECT_MULTIPLE
/// A list of all sources applying this status effect. Sources are a list of keys
var/list/sources = list()
/datum/status_effect/grouped/on_creation(mob/living/new_owner, source)
var/datum/status_effect/grouped/existing = new_owner.has_status_effect(type)
if(existing)
existing.sources |= source
qdel(src)
return FALSE
sources |= source
return ..()
/datum/status_effect/grouped/before_remove(source)
sources -= source
return !length(sources)