Files
MrMelbert e9339f4f7e You can't use null as a grouped status effect source (#93782)
## About The Pull Request

Fixes https://github.com/tgstation/tgstation/issues/88311

1. Grouped status effects will throw a stack trace if trying to pass
null as a source
2. Fishing hooks will not proceed to hook if they fail to hook (lol)
3. Replaced cursed slot machine "grouped effect" with a normal effect
(since it didn't use the group aspect at all)

## Changelog

🆑 Melbert
fix: Fishing hooks will no longer hook even though the hook failed
/🆑
2025-11-07 03:08:43 +01:00

53 lines
1.6 KiB
Plaintext

/// Status effect from multiple sources, when all sources are removed, so is the effect
/datum/status_effect/grouped
id = STATUS_EFFECT_ID_ABSTRACT
alert_type = null
// 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, ...)
//Get our supplied arguments, without new_owner
var/list/new_source_args = args.Copy(2)
if(isnull(source))
stack_trace("Grouped status effect applied without a source")
qdel(src)
return FALSE
var/datum/status_effect/grouped/existing = new_owner.has_status_effect(type)
if(existing)
existing.sources |= source
existing.source_added(arglist(new_source_args))
qdel(src)
return FALSE
/* We are the original */
. = ..()
if(.)
sources |= source
source_added(arglist(new_source_args))
/**
* Called after a source is added to the status effect,
* this includes the first source added after creation.
*/
/datum/status_effect/grouped/proc/source_added(source, ...)
return
/**
* Called after a source is removed from the status effect. \
* `removing` will be TRUE if this is the last source, which means
* the effect will be deleted.
*/
/datum/status_effect/grouped/proc/source_removed(source, removing)
return
/datum/status_effect/grouped/before_remove(source)
sources -= source
var/was_last_source = !length(sources)
source_removed(source, was_last_source)
return was_last_source