Files
Bubberstation/code/datums/elements/soft_landing.dm
tralezab 4cbd6039ff Beds, Sofas, Slimes, And Jellypeople now provide a soft landing (#65918)
* soft landing initial commit

* better doc, now correctly checks isatom for the signal

* Update code/datums/elements/soft_landing.dm

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>

* moves sofa init back, style changes

* Apply suggestions from code review

Co-authored-by: Seth Scherer <supernovaa41@gmx.com>

* Apply suggestions from code review

Co-authored-by: Fikou <23585223+Fikou@users.noreply.github.com>

* i'm not feeling so good

* adds missing . operator, and renames single letter var

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Seth Scherer <supernovaa41@gmx.com>
Co-authored-by: Fikou <23585223+Fikou@users.noreply.github.com>
2022-04-05 21:10:07 -04:00

26 lines
858 B
Plaintext

/**
* ## soft landing element!
*
* Non bespoke element (1 in existence) that makes objs provide a soft landing when you fall on them!
*/
/datum/element/soft_landing
element_flags = ELEMENT_DETACH
/datum/element/soft_landing/Attach(datum/target)
. = ..()
if(!isatom(target))
return ELEMENT_INCOMPATIBLE
RegisterSignal(target, COMSIG_ATOM_INTERCEPT_Z_FALL, .proc/intercept_z_fall)
/datum/element/soft_landing/Detach(datum/target)
. = ..()
UnregisterSignal(target, COMSIG_ATOM_INTERCEPT_Z_FALL)
///signal called by the stat of the target changing
/datum/element/soft_landing/proc/intercept_z_fall(obj/soft_object, falling_movables, levels)
SIGNAL_HANDLER
for (var/mob/living/falling_victim in falling_movables)
to_chat(falling_victim, span_notice("[soft_object] provides a soft landing for you!"))
return FALL_INTERCEPTED | FALL_NO_MESSAGE