Files
Geeves 67360a9bea 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)
2024-12-24 16:04:51 +00:00

24 lines
1.3 KiB
Plaintext

/datum/state_machine/weather
expected_type = /obj/abstract/weather_system
/datum/state_machine/weather/choose_transition(list/valid_transitions)
var/list/transitions = list()
for(var/singleton/state_transition/weather/state_transition in valid_transitions)
transitions[state_transition] = state_transition.likelihood_weighting
if(length(transitions))
return pick(transitions) //pickweight(transitions)
return ..()
/datum/state_machine/weather/handle_next_transition(var/obj/abstract/weather_system/holder_instance, var/singleton/state_transition/chosen_transition)
holder_instance.transitioning_weather = TRUE
var/time_to_transition = (rand(1, 3) MINUTES) + (rand(-30, 30) SECONDS)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_Z_WEATHER_CHANGE, holder_instance.z, chosen_transition, time_to_transition)
addtimer(CALLBACK(src, PROC_REF(finalize_weather_transition), holder_instance, chosen_transition), time_to_transition)
/// Exits the old weather state, enters the new one, and finishes transitioning
/datum/state_machine/weather/proc/finalize_weather_transition(var/obj/abstract/weather_system/holder_instance, var/singleton/state_transition/chosen_transition)
current_state.exited_state(holder_instance)
current_state = chosen_transition.target
current_state.entered_state(holder_instance)
holder_instance.transitioning_weather = FALSE