Files
Bubberstation/code/datums/elements/death_explosion.dm
SkyratBot 102748fc27 [MIRROR] Cosmic Ascension Balance Patch [MDB IGNORE] (#20808)
* Cosmic Ascension Balance Patch

* conflict

---------

Co-authored-by: Comxy <tijntensen@gmail.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
2023-04-29 09:59:15 +01:00

38 lines
1.1 KiB
Plaintext

/**
* ## death explosion element!
*
* Bespoke element that generates an explosion when a mob is killed.
*/
/datum/element/death_explosion
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 3
///The range at which devastating impact happens
var/devastation
///The range at which heavy impact happens
var/heavy_impact
///The range at which light impact happens
var/light_impact
/datum/element/death_explosion/Attach(datum/target, devastation = -1, heavy_impact = -1, light_impact = -1)
. = ..()
if(!isliving(target))
return ELEMENT_INCOMPATIBLE
src.devastation = devastation
src.heavy_impact = heavy_impact
src.light_impact = light_impact
RegisterSignal(target, COMSIG_LIVING_DEATH, PROC_REF(on_death))
/datum/element/death_explosion/Detach(datum/target)
. = ..()
UnregisterSignal(target, COMSIG_LIVING_DEATH)
/// Triggered when target dies, make an explosion.
/datum/element/death_explosion/proc/on_death(mob/living/target, gibbed)
SIGNAL_HANDLER
explosion(
get_turf(target),
devastation_range = devastation,
heavy_impact_range = heavy_impact,
light_impact_range = light_impact,
explosion_cause = target)