mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-12 18:51:53 +00:00
## About The Pull Request About what it says on the tin. Corpses from spawner legions (e.g. vent legions, tendril legions) have the storm-hating component, which means that when a storm starts the body is deleted. Also makes it so that the `storm_hating` component clears itself when the atom it's attached to is logged into, so skeletons you do decide to brainswap into/bodyjack/etc. won't Thanos snap and turn into dust if you get stormed on. ## Why It's Good For The Game Ashes to ashes, dust to dust. Prevents corpses from piling up that badly. I swear this was a feature but I don't know whatever happened to it. ## Changelog 🆑 qol: The skeletal corpses left from spawner legions (e.g. from ore vent defenses and legion necropolis tendrils) now disappear during ash storms. This does not apply if the body gets brainswapped into. /🆑 --------- Co-authored-by: Hatterhat <Hatterhat@users.noreply.github.com>
54 lines
1.8 KiB
Plaintext
54 lines
1.8 KiB
Plaintext
/**
|
|
* The parent of this component will be destroyed if it's on the ground during a storm
|
|
*/
|
|
/datum/component/storm_hating
|
|
/// Types of weather which trigger the effect
|
|
var/static/list/stormy_weather = list(
|
|
/datum/weather/ash_storm,
|
|
/datum/weather/snow_storm,
|
|
/datum/weather/void_storm,
|
|
)
|
|
|
|
/datum/component/storm_hating/Initialize()
|
|
. = ..()
|
|
if (!isatom(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
on_area_entered(parent, get_area(parent))
|
|
|
|
/datum/component/storm_hating/RegisterWithParent()
|
|
. = ..()
|
|
RegisterSignal(parent, COMSIG_ENTER_AREA, PROC_REF(on_area_entered))
|
|
RegisterSignal(parent, COMSIG_EXIT_AREA, PROC_REF(on_area_exited))
|
|
RegisterSignal(parent, COMSIG_MOB_LOGIN, PROC_REF(on_login))
|
|
|
|
/datum/component/storm_hating/UnregisterFromParent()
|
|
. = ..()
|
|
UnregisterSignal(parent, list(COMSIG_ENTER_AREA, COMSIG_EXIT_AREA))
|
|
var/area/old_area = get_area(parent)
|
|
if(old_area)
|
|
on_area_exited(parent, old_area)
|
|
|
|
/datum/component/storm_hating/proc/on_area_entered(atom/source, area/new_area)
|
|
SIGNAL_HANDLER
|
|
for (var/weather in stormy_weather)
|
|
RegisterSignal(new_area, COMSIG_WEATHER_BEGAN_IN_AREA(weather), PROC_REF(on_storm_event))
|
|
RegisterSignal(new_area, COMSIG_WEATHER_ENDED_IN_AREA(weather), PROC_REF(on_storm_event))
|
|
|
|
/datum/component/storm_hating/proc/on_area_exited(atom/source, area/old_area)
|
|
SIGNAL_HANDLER
|
|
for (var/weather in stormy_weather)
|
|
UnregisterSignal(old_area, COMSIG_WEATHER_BEGAN_IN_AREA(weather))
|
|
UnregisterSignal(old_area, COMSIG_WEATHER_ENDED_IN_AREA(weather))
|
|
|
|
/datum/component/storm_hating/proc/on_storm_event()
|
|
SIGNAL_HANDLER
|
|
var/atom/parent_atom = parent
|
|
if (!isturf(parent_atom.loc))
|
|
return
|
|
parent_atom.fade_into_nothing(life_time = 3 SECONDS, fade_time = 2 SECONDS)
|
|
qdel(src)
|
|
|
|
/datum/component/storm_hating/proc/on_login(datum/source)
|
|
SIGNAL_HANDLER
|
|
qdel(src)
|