Weather DLC - Make it Rain Anything! (#89550)

Introducing more weather types! And yes, you can now have rain be
reagent based!

<details>
<summary>Regular Rain</summary>

![dreamseeker_9S1WzdBW8Z](https://github.com/user-attachments/assets/83aaa1fe-9105-4e15-8455-0337c5c592ef)

</details>

<details>
<summary>Blood Rain</summary>

![dreamseeker_SZufAoXDFt](https://github.com/user-attachments/assets/209404dc-34dd-4381-9bab-9b84eaec2658)

</details>

<details>
<summary>Acid Rain</summary>

![dreamseeker_ngiOqdB5n2](https://github.com/user-attachments/assets/0ab953c6-a215-444a-bdbd-addfc2b1ddbb)

</details>

You can even make it rain ants, plasma, or drugs. All of their effects
get applied to turfs, objects, and mobs depending on the weather options
you select.

Did I mention... there is thunder?

<details>
<summary>Thunder Strikes</summary>

![Untitled video - Made with
Clipchamp](https://github.com/user-attachments/assets/7c5c5930-6e0a-4706-a41b-3cbcc277bfd5)

</details>

<details>
<summary>Sand Storms</summary>

![dreamseeker_ZEFUS73dSA](https://github.com/user-attachments/assets/4a754f2d-c4e5-4b2f-9add-4742628cfa74)

</details>

Despite all this new stuff, none of it has been directly added to the
game but the code can be used in the future for:
- Wizard event - Similar to lava on floor, but this time make the
reagent random or picked from a list and give wizard immunity
- Chaplain ability - Maybe make this a benefit or ability once enough
favor has been obtained
- Admin events - I have added a BUNCH of admin tooling to run customized
weather events that let you control a lot of options
- New station maps/biomes for downstreams (Jungle Station, etc.)
- Change Ion storms to use the new weather system that triggers
EMP/thunder effects across the station
- IceBox could get plasma rain
- Lavaland could get thunder effects applied to ash storms

Relevant PRs that removed/added some of the weather stuff I used:
- #60303
- #25222

---

- Rain sprites were added via [novaepee](https://github.com/novaepee) in
https://github.com/tgstation/TerraGov-Marine-Corps/pull/9675
- Sand sprites were added via [TiviPlus](https://github.com/TiviPlus)
(who commissioned them from bimmer) in
https://github.com/tgstation/TerraGov-Marine-Corps/pull/4645
- Rain sounds [already existed on
tg](https://github.com/tgstation/tgstation/pull/25222#discussion_r106794579)
and were provided by provided by Cuboos, using Royalty Free sounds,
presumed under default tg sound license - Creative Commons 3.0 BY-SA
- Siren sound is from siren.wav by IFartInUrGeneralDirection --
[Freesound](https://freesound.org/s/46092/) -- License: Attribution 4.0

The original `siren.ogg` sound used on a lot of SS13 servers doesn't
seem to have any attribution that I could locate. The sound was added
about 15 years ago. So I just looked for a somewhat similar sounding
siren noise on Freesound.

More weather customization!

🆑
add: Added new weather types for rain and sandstorms. Rain now uses a
reagent that gets exposed to the turfs, mobs, and objects. There is also
a thunder strike setting you can apply to any weather.
add: Hydro trays and soil will now add reagents to their trays when
exposed to a chemical reaction. (weather, shower, chem spills, foam
grenades, etc.)
add: Weather temperature now affects weather reagents and mobs body
temperature.
bal: Snowstorm temperature calculations were tweaked to allow universal
weather temperature effects.
sound: Added weather sounds from TGMC for rain and sirens (attributed to
Cuboos and IFartInUrGeneralDirection )
image: Added weather images from TGMC for rain and sand storms
(attributed to Novaepee and Bimmer)
refactor: Refactored a lot of the weather code to be more robust
admin: Admins can now control more weather related options when running
weather events. The weather admin verbs have been moved to their own
"Weather" category under the Admin tab.
/🆑

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
Tim
2025-04-29 17:44:46 -06:00
committed by Shadow-Quill
co-authored by LemonInTheDark Ghom
parent 92ac59a8dd
commit 1f855eb9ff
34 changed files with 701 additions and 121 deletions
+52 -21
View File
@@ -11,24 +11,62 @@ SUBSYSTEM_DEF(weather)
var/list/eligible_zlevels = list()
var/list/next_hit_by_zlevel = list() //Used by barometers to know when the next storm is coming
/datum/controller/subsystem/weather/fire()
/datum/controller/subsystem/weather/fire(resumed = FALSE)
// process active weather
for(var/V in processing)
var/datum/weather/our_event = V
if(our_event.aesthetic || our_event.stage != MAIN_STAGE)
for(var/datum/weather/weather_event as anything in processing)
if(!length(weather_event.subsystem_tasks) || weather_event.stage != MAIN_STAGE)
continue
for(var/mob/act_on as anything in GLOB.mob_living_list)
if(our_event.can_weather_act(act_on))
our_event.weather_act(act_on)
if(weather_event.currentpart == SSWEATHER_MOBS)
if(!resumed)
weather_event.current_mobs = GLOB.mob_living_list.Copy()
var/list/current_mobs_cache = weather_event.current_mobs // cache for performance
while(current_mobs_cache.len)
var/mob/living/target = current_mobs_cache[current_mobs_cache.len]
current_mobs_cache.len--
if(QDELETED(target))
continue
if(weather_event.can_weather_act_mob(target))
weather_event.weather_act_mob(target)
if(MC_TICK_CHECK)
return
resumed = FALSE
weather_event.currentpart = weather_event.subsystem_tasks[WRAP_UP(weather_event.currentpart, weather_event.subsystem_tasks.len)]
if(weather_event.currentpart == SSWEATHER_TURFS)
if(!resumed)
weather_event.turf_iteration = ROUND_PROB(weather_event.weather_turfs_per_tick)
while(weather_event.turf_iteration)
weather_event.turf_iteration--
var/turf/selected_turf = weather_event.pick_turf()
if(selected_turf && weather_event.can_weather_act_turf(selected_turf))
weather_event.weather_act_turf(selected_turf)
if(MC_TICK_CHECK)
return
resumed = FALSE
weather_event.currentpart = weather_event.subsystem_tasks[WRAP_UP(weather_event.currentpart, weather_event.subsystem_tasks.len)]
if(weather_event.currentpart == SSWEATHER_THUNDER)
if(!resumed)
weather_event.thunder_iteration = ROUND_PROB(weather_event.thunder_turfs_per_tick)
while(weather_event.thunder_iteration)
weather_event.thunder_iteration--
var/turf/selected_turf = weather_event.pick_turf()
if(selected_turf && weather_event.can_weather_act_turf(selected_turf))
weather_event.thunder_act_turf(selected_turf)
if(MC_TICK_CHECK)
return
resumed = FALSE
weather_event.currentpart = weather_event.subsystem_tasks[WRAP_UP(weather_event.currentpart, weather_event.subsystem_tasks.len)]
// start random weather on relevant levels
for(var/z in eligible_zlevels)
var/possible_weather = eligible_zlevels[z]
var/datum/weather/our_event = pick_weight(possible_weather)
run_weather(our_event, list(text2num(z)))
var/datum/weather/weather_event = pick_weight(possible_weather)
run_weather(weather_event, list(text2num(z)))
eligible_zlevels -= z
var/randTime = rand(3000, 6000)
next_hit_by_zlevel["[z]"] = addtimer(CALLBACK(src, PROC_REF(make_eligible), z, possible_weather), randTime + initial(our_event.weather_duration_upper), TIMER_UNIQUE|TIMER_STOPPABLE) //Around 5-10 minutes between weathers
var/randTime = rand(5 MINUTES, 10 MINUTES)
next_hit_by_zlevel["[z]"] = addtimer(CALLBACK(src, PROC_REF(make_eligible), z, possible_weather), randTime + initial(weather_event.weather_duration_upper), TIMER_UNIQUE|TIMER_STOPPABLE)
/datum/controller/subsystem/weather/Initialize()
for(var/V in subtypesof(/datum/weather))
@@ -52,7 +90,7 @@ SUBSYSTEM_DEF(weather)
LAZYINITLIST(eligible_zlevels["[z]"])
eligible_zlevels["[z]"][weather] = probability
/datum/controller/subsystem/weather/proc/run_weather(datum/weather/weather_datum_type, z_levels)
/datum/controller/subsystem/weather/proc/run_weather(datum/weather/weather_datum_type, z_levels, list/weather_data)
if (istext(weather_datum_type))
for (var/V in subtypesof(/datum/weather))
var/datum/weather/W = V
@@ -69,7 +107,8 @@ SUBSYSTEM_DEF(weather)
else if (!islist(z_levels))
CRASH("run_weather called with invalid z_levels: [z_levels || "null"]")
var/datum/weather/W = new weather_datum_type(z_levels)
var/datum/weather/W = new weather_datum_type(z_levels, weather_data)
W.telegraph()
/datum/controller/subsystem/weather/proc/make_eligible(z, possible_weather)
@@ -88,11 +127,3 @@ SUBSYSTEM_DEF(weather)
///Returns an active storm by its type
/datum/controller/subsystem/weather/proc/get_weather_by_type(type)
return locate(type) in processing
ADMIN_VERB(stop_weather, R_DEBUG|R_ADMIN, "Stop All Active Weather", "Stop all currently active weather.", ADMIN_CATEGORY_DEBUG)
log_admin("[key_name(user)] stopped all currently active weather.")
message_admins("[key_name_admin(user)] stopped all currently active weather.")
for(var/datum/weather/current_weather as anything in SSweather.processing)
if(current_weather in SSweather.processing)
current_weather.end()
BLACKBOX_LOG_ADMIN_VERB("Stop All Active Weather")