Files
Bubberstation/code/modules/admin/verbs/adminweather.dm
Tim 36788ee05f Weather DLC - Make it Rain Anything! (#89550)
## About The Pull Request
##### Disclaimer - Some of the code/icons/sounds were ported from TMGC. 

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

---

#### Attribution
- 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.

## Why It's Good For The Game
More weather customization!

## Changelog
🆑
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>
2025-04-07 18:46:28 +02:00

94 lines
3.8 KiB
Plaintext

ADMIN_VERB(run_weather, R_ADMIN|R_FUN, "Run Weather", "Triggers specific weather on the z-level you choose.", ADMIN_CATEGORY_EVENTS)
var/list/weather_choices = list()
if(!length(weather_choices))
for(var/datum/weather/weather_type as anything in subtypesof(/datum/weather))
weather_choices[initial(weather_type.type)] = weather_type
var/datum/weather/weather_choice = tgui_input_list(user, "Choose a weather to run", "Weather", weather_choices)
if(!weather_choice)
return
weather_choice = weather_choices[weather_choice]
var/turf/current_turf = get_turf(user.mob)
var/z_level = tgui_input_number(user, "Z-Level to target", "Z-Level", min_value = 1, max_value = world.maxz, default = current_turf?.z)
if(!isnum(z_level))
return
var/static/list/custom_options = list("Default", "Custom", "Cancel")
var/custom_choice = tgui_alert(user, "How would you like to run the weather settings?", "Custom Weather", custom_options)
switch(custom_choice)
if("Default")
SSweather.run_weather(weather_choice, z_level) // default settings
message_admins("[key_name_admin(user)] started weather of type [weather_choice] on the z-level [z_level].")
log_admin("[key_name(user)] started weather of type [weather_choice] on the z-level [z_level].")
BLACKBOX_LOG_ADMIN_VERB("Run Weather")
return
if("Cancel")
return
var/list/area_choices = list()
if(!length(area_choices))
for(var/area/area_type as anything in typesof(/area))
area_choices[initial(area_type.type)] = area_type
var/area/area_choice = tgui_input_list(user, "Select an area for weather to target", "Target Area", area_choices)
if(!area_choice)
return
area_choice = area_choices[area_choice]
var/weather_bitflags = input_bitfield(
user,
"Weather flags - Select the flags for your weather event",
"weather_flags",
weather_choice::weather_flags,
)
var/datum/reagent/reagent_choice
if((weather_bitflags & (WEATHER_TURFS|WEATHER_MOBS)))
var/static/list/reagent_options = list("Yes", "No", "Cancel")
var/reagent_option = tgui_alert(user, "Would you like to make the weather use a custom reagent?", "Weather Reagent", reagent_options)
switch(reagent_option)
if("Cancel")
return
if("Yes")
var/static/list/reagent_choices = list()
if(!length(reagent_choices))
for(var/datum/reagent/reagent_type as anything in subtypesof(/datum/reagent))
reagent_choices[initial(reagent_type.type)] = reagent_type
reagent_choice = tgui_input_list(user, "Select a reagent for the rain", "Rain Reagent", reagent_choices)
if(!reagent_choice)
return
reagent_choice = reagent_choices[reagent_choice]
var/thunder_value
if(weather_bitflags & (WEATHER_THUNDER))
var/static/list/thunder_choices = GLOB.thunder_chance_options
var/thunder_choice = tgui_input_list(user, "How much thunder would you like", "Thunder", thunder_choices)
if(!thunder_choice)
return
thunder_value = GLOB.thunder_chance_options[thunder_choice]
var/list/weather_data = list(
area = area_choice,
weather_flags = weather_bitflags,
thunder_chance = thunder_value,
reagent = reagent_choice,
)
SSweather.run_weather(weather_choice, z_level, weather_data)
message_admins("[key_name_admin(user)] started weather of type [weather_choice] on the z-level [z_level].")
log_admin("[key_name(user)] started weather of type [weather_choice] on the z-level [z_level].")
BLACKBOX_LOG_ADMIN_VERB("Run Weather")
ADMIN_VERB(stop_weather, R_ADMIN|R_DEBUG, "Stop All Active Weather", "Stop all currently active weather.", ADMIN_CATEGORY_EVENTS)
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")