Files
Bubberstation/code/datums/components/storm_hating.dm
SkyratBot 6a4323c872 [MIRROR] [no gbp] Goliaths make less mess [MDB IGNORE] (#22725)
* [no gbp] Goliaths make less mess (#77141)

## About The Pull Request

In an earlier PR I made Goliaths dig when they are bored. I still like
this behaviour as an ambient thing for them to do, but the consequence
is that after 30 minutes there were huge piles of sand all over
lavaland.
While convenient for actually having miners bring glass back to the
station, it was an eyesore and too much.

To resolve this I have made two changes:
- Goliaths dig 1/3 as often as they did before.
- Sand (and snow) which are left outside during a storm gets blown away
if it's not inside someone's inventory.

Together these prevent the accumulation of hundreds of piles of sand.

## Why It's Good For The Game

Fixes an unintended consequence of my actions.

## Changelog

🆑
add: Uncollected sand and snow will be blown away by the wind when
storms happen (but don't worry, storms also allow those turfs to be
freshly dug up again).
/🆑

* [no gbp] Goliaths make less mess

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
2023-07-27 16:24:48 -04:00

48 lines
1.6 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))
/datum/component/storm_hating/UnregisterFromParent()
. = ..()
on_area_exited(parent, get_area(parent))
UnregisterSignal(parent, COMSIG_ENTER_AREA)
RegisterSignal(parent, COMSIG_EXIT_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.AddElement(/datum/element/temporary_atom, life_time = 3 SECONDS, fade_time = 2 SECONDS)
qdel(src)