Weather Warnings (#19934)

* Atmospheric probes will now relay changes in weather when deployed.
Analog radios can be tuned into the weather broadcast and receive it,
provided they're in the same sector / connected z-levels.
* Fixed weather transitions to rainy / icy weather not working.
* Changed rainy / icy weather to have a blue color, reducing eye strain.


![image](https://github.com/user-attachments/assets/b8439595-25ff-4df0-8f5d-b2d27d147b70)

![image-1](https://github.com/user-attachments/assets/cf0018c2-c6c7-4cf6-8069-543ad98cd597)

![image](https://github.com/user-attachments/assets/5e4d87e2-33c8-494a-9b8f-8a62f12c496a)
This commit is contained in:
Geeves
2024-12-24 16:04:51 +00:00
committed by GitHub
parent 5c2c77a4b3
commit 67360a9bea
20 changed files with 225 additions and 49 deletions
+38 -19
View File
@@ -1,3 +1,5 @@
#define WEATHER_RADIO_CHANNEL "Shortband Weather Broadcast"
/obj/item/lore_radio
name = "analog radio"
desc = "A portable radio capable of receiving radio waves from nearby space systems."
@@ -11,8 +13,9 @@
/obj/item/lore_radio/Initialize()
. = ..()
if(!current_station && SSatlas.current_sector?.lore_radio_stations)
current_station = pick(SSatlas.current_sector.lore_radio_stations)
if(!current_station)
var/list/possible_stations = get_possible_stations()
current_station = pick(possible_stations)
if(starts_on)
toggle_receiving()
RegisterSignal(SSdcs, COMSIG_GLOB_LORE_RADIO_BROADCAST, PROC_REF(relay_lore_radio))
@@ -24,27 +27,33 @@
to_chat(user, SPAN_NOTICE("\The [src] is listening to \the [current_station] radio station."))
/obj/item/lore_radio/attack_self(var/mob/user)
if(SSatlas.current_sector?.lore_radio_stations)
var/picked_station = tgui_input_list(user, "Select the radio frequency:", "Radio Station Selection", SSatlas.current_sector.lore_radio_stations, current_station)
if(picked_station)
current_station = picked_station
if(!receiving)
toggle_receiving(user)
else
audible_message("<b>[src]</b> only emits white noise...")
var/list/possible_stations = get_possible_stations()
var/picked_station = tgui_input_list(user, "Select the radio frequency:", "Radio Station Selection", possible_stations, current_station)
if(picked_station)
current_station = picked_station
if(!receiving)
toggle_receiving(user)
/obj/item/lore_radio/AltClick(var/mob/user)
toggle_receiving(user)
/obj/item/lore_radio/proc/get_possible_stations()
var/list/possible_stations = list(WEATHER_RADIO_CHANNEL)
if(SSatlas.current_sector?.lore_radio_stations)
possible_stations += SSatlas.current_sector.lore_radio_stations
return possible_stations
/obj/item/lore_radio/proc/toggle_receiving(var/mob/user)
if(!receiving)
receiving = TRUE
if(user)
user.visible_message("<b>[user]</b> flicks \the [src] on.", SPAN_NOTICE("You flick \the [src] on."), range = 3)
RegisterSignal(SSdcs, COMSIG_GLOB_Z_WEATHER_BROADCAST, PROC_REF(relay_weather_broadcast))
else
receiving = FALSE
if(user)
user.visible_message("<b>[user]</b> flicks \the [src] off.", SPAN_NOTICE("You flick \the [src] off."), range = 3)
UnregisterSignal(SSdcs, COMSIG_GLOB_Z_WEATHER_BROADCAST, PROC_REF(relay_weather_broadcast))
/obj/item/lore_radio/proc/relay_lore_radio(var/datum/source, var/radio_station, var/radio_message)
SIGNAL_HANDLER
@@ -52,13 +61,23 @@
if(!receiving || radio_station != current_station)
return
var/displayed_message = radio_message ? "\The <b>[src.name]</b> transmits, \"[radio_message]\"" : "\The <b>[src]</b> only emits white noise..."
audible_message(displayed_message)
if(radio_message)
var/list/hearers = get_hearers_in_view(7, src)
var/list/clients_in_hearers = list()
for(var/mob/mob in hearers)
if(mob.client)
clients_in_hearers += mob.client
if(length(clients_in_hearers))
INVOKE_ASYNC(src, TYPE_PROC_REF(/atom/movable, animate_chat), radio_message, null, FALSE, clients_in_hearers, 2 SECONDS)
output_spoken_message(radio_message)
else
audible_message("The [SPAN_BOLD("[name]")] only emits white noise...") // using name instead of src so it doesn't add a bolded The or whatever, better control of what displays
/// Listens to when a weather change on this Z-level is broadcasted from a configured weather reader (survey probe), and reads it aloud
/obj/item/lore_radio/proc/relay_weather_broadcast(var/datum/source, var/z_level, var/singleton/state_transition/weather/weather_transition, var/time_to_transition, var/broadcast_message)
SIGNAL_HANDLER
if(!receiving || current_station != WEATHER_RADIO_CHANNEL)
return
var/turf/current_turf = get_turf(src)
var/list/connected_z_levels = GetConnectedZlevels(current_turf.z)
if(!(z_level in connected_z_levels))
return
output_spoken_message(broadcast_message)
#undef WEATHER_RADIO_CHANNEL