-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathdeath_explosion.dm
36 lines (33 loc) · 1.09 KB
/
death_explosion.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* ## 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)