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
@@ -1,10 +1,17 @@
/obj/abstract/weather_marker
name = "Weather Marker"
icon = 'icons/effects/map_effects.dmi'
icon_state = "weather_marker"
/// The weather type we want. This needs to be a weather singleton type, such as /singleton/state/weather/rain/storm.
/// These should be used for forcing weather in an away site or an event map.
var/weather_type
icon = 'icons/effects/map_effects.dmi'
icon_state = "weather_marker"
/// Whether this weather system supports having watery weather
var/has_water_weather = FALSE
/// Whether this weather system supports having icy weather
var/has_icy_weather = FALSE
/obj/abstract/weather_marker/Initialize()
..()
@@ -15,4 +22,6 @@
if(!ispath(weather_type))
log_debug("Invalid weather type mapped in at [x] [y] [z]!")
return INITIALIZE_HINT_QDEL
SSweather.setup_weather_system(z, weather_type)
var/obj/abstract/weather_system/new_weather_system = SSweather.setup_weather_system(z, weather_type)
new_weather_system.has_water_weather = has_water_weather
new_weather_system.has_icy_weather = has_icy_weather
@@ -42,6 +42,7 @@
surface_color = COLOR_BLUE_GRAY
scanimage = "asteroid.png"
possible_themes = list(/datum/exoplanet_theme/barren/asteroid/ice)
has_icy_weather = TRUE
rock_colors = list(COLOR_ASH)
planetary_area = /area/exoplanet/barren/asteroid
ruin_planet_type = PLANET_ASTEROID
@@ -12,6 +12,7 @@
rock_colors = list(COLOR_ASTEROID_ROCK, COLOR_GRAY80, COLOR_BROWN)
plant_colors = list("#3c772e","#27614b","#3f8d35","#185f18","#799628", "RANDOM")
possible_themes = list(/datum/exoplanet_theme/grass)
has_water_weather = TRUE
ruin_planet_type = PLANET_GRASS
ruin_allowed_tags = RUIN_LOWPOP|RUIN_SCIENCE|RUIN_HOSTILE|RUIN_WRECK|RUIN_NATURAL
soil_data = list("Low density organic matter layer", "Rich microbiome layer", "Moderate water layer", "Large rock particle layer", "Iron oxide layer")
@@ -11,6 +11,7 @@
has_trees = TRUE
possible_themes = list(/datum/exoplanet_theme/jungle)
initial_weather_state = /singleton/state/weather/rain/storm/jungle_planet
has_water_weather = TRUE
ruin_planet_type = PLANET_GROVE
ruin_allowed_tags = RUIN_LOWPOP|RUIN_SCIENCE|RUIN_HOSTILE|RUIN_WRECK|RUIN_NATURAL
@@ -8,6 +8,7 @@
color = "#68e968"
planetary_area = /area/exoplanet/grass/konyang
initial_weather_state = /singleton/state/weather/rain/storm/jungle_planet
has_water_weather = TRUE
scanimage = "konyang.png"
massvolume = "0.89/0.99"
surfacegravity = "0.93"
@@ -135,6 +135,7 @@
color = "#b5dfeb"
planetary_area = /area/exoplanet/adhomai
initial_weather_state = /singleton/state/weather/calm/snow_planet
has_icy_weather = TRUE
scanimage = "adhomai.png"
massvolume = "0.86/0.98"
surfacegravity = "0.80"
@@ -136,6 +136,7 @@
flora_diversity = 0
has_trees = FALSE
initial_weather_state = /singleton/state/weather/calm/jungle_planet
has_water_weather = TRUE
small_flora_types = list(/datum/seed/xuizi, /datum/seed/gukhe, /datum/seed/sarezhi, /datum/seed/flower/serkiflower, /datum/seed/sthberry)
surface_color = "#e8faff"
generated_name = FALSE
@@ -280,6 +281,7 @@
generated_name = FALSE
ruin_planet_type = PLANET_LORE
initial_weather_state = /singleton/state/weather/calm/jungle_planet
has_water_weather = TRUE
ruin_type_whitelist = list(
/datum/map_template/ruin/exoplanet/ouerea_heph_mining,
/datum/map_template/ruin/exoplanet/ouerea_village,
@@ -7,6 +7,7 @@
weather = "Global full-atmosphere hydrological weather system. Barely-habitable ambient low temperatures. Frequently dangerous, unpredictable meteorological upsets"
surfacewater = "Majority frozen, 70% surface water"
initial_weather_state = /singleton/state/weather/calm/snow_planet
has_icy_weather = TRUE
planetary_area = /area/exoplanet/snow
flora_diversity = 4
has_trees = TRUE
+10 -2
View File
@@ -61,9 +61,15 @@
var/list/possible_themes = list(/datum/exoplanet_theme)
var/datum/exoplanet_theme/theme
///What weather state to use for this planet initially. If null, will not initialize any weather system. Must be a typepath rather than an instance.
/// What weather state to use for this planet initially. If null, will not initialize any weather system. Must be a typepath rather than an instance.
var/singleton/state/weather/initial_weather_state = /singleton/state/weather/calm
/// Whether the weather system supports having watery weather
var/has_water_weather = FALSE
/// Whether the weather system supports having icy weather
var/has_icy_weather = FALSE
var/features_budget = 4
var/list/possible_features = list()
var/list/spawned_features
@@ -553,7 +559,9 @@
/obj/effect/overmap/visitable/sector/exoplanet/proc/set_weather(var/singleton/state/weather/W)
initial_weather_state = W
//Tells all our levels exposed to the sky to force change the weather.
SSweather.setup_weather_system(map_z[length(map_z)], initial_weather_state)
var/obj/abstract/weather_system/new_weather_system = SSweather.setup_weather_system(map_z[length(map_z)], initial_weather_state)
new_weather_system.has_water_weather = has_water_weather
new_weather_system.has_icy_weather = has_icy_weather
///Setup the initial weather state for the planet. Doesn't apply it to our z levels however.
/obj/effect/overmap/visitable/sector/exoplanet/proc/generate_weather()
+38 -10
View File
@@ -30,21 +30,44 @@
invisibility = 0
appearance_flags = (RESET_COLOR | RESET_ALPHA | RESET_TRANSFORM)
var/water_material = null // Material to use for the properties of rain.
var/ice_material = null // Material to use for the properties of snow and hail.
var/list/affecting_zs // What z-levels are we affecting?
var/datum/state_machine/weather/weather_system // What is our internal state and how do we decide what state to use?
var/next_weather_transition = 0 // What world.time will we next evaluate our state?
// Temporarily removing these, we do not have the same material system as Nebula
var/obj/abstract/lightning_overlay/lightning_overlay // A visible atom used for animated lighting effects.
var/tmp/list/vis_contents_additions // Holder for a list used to add required atoms to turf vis_contents.
// /// Material to use for the properties of rain.
// var/water_material = null
// /// Material to use for the properties of snow and hail.
// var/ice_material = null
/// Whether this weather system supports having watery weather
var/has_water_weather = FALSE
/// Whether this weather system supports having icy weather
var/has_icy_weather = FALSE
/// What z-levels are we affecting?
var/list/affecting_zs
/// What is our internal state and how do we decide what state to use?
var/datum/state_machine/weather/weather_system
/// What world.time will we next evaluate our state?
var/next_weather_transition = 0
/// We've evaluated a new weather pattern and we're in the process of transitioning to it
var/transitioning_weather = FALSE
/// A visible atom used for animated lighting effects.
var/obj/abstract/lightning_overlay/lightning_overlay
/// Holder for a list used to add required atoms to turf vis_contents.
var/tmp/list/vis_contents_additions
// Main heartbeat proc, called by SSweather.
/obj/abstract/weather_system/proc/tick()
// Check if we should move to a new state.
if(world.time >= next_weather_transition)
if(world.time >= next_weather_transition && !transitioning_weather)
weather_system.evaluate()
// Change wind direction and speed.
@@ -82,10 +105,15 @@
// - TODO: track and check exoplanet temperature.
// - TODO: compare to a list of 'acceptable' states
if(istype(next_state))
// Temporarily removing these, we do not have the same material system as Nebula
// if(next_state.is_liquid)
// return !!water_material
// if(next_state.is_ice)
// return !!ice_material
if(next_state.is_liquid)
return !!water_material
return has_water_weather
if(next_state.is_ice)
return !!ice_material
return has_icy_weather
return TRUE
return FALSE
+13
View File
@@ -8,3 +8,16 @@
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
+12 -6
View File
@@ -29,12 +29,18 @@ ABSTRACT_TYPE(/singleton/state/weather)
weather.icon_state = icon_state
weather.alpha = alpha
if(is_liquid && weather.water_material)
var/material/mat = SSmaterials.get_material_by_name(weather.water_material)
weather.color = mat.icon_colour
else if(is_ice && weather.ice_material)
var/material/mat = SSmaterials.get_material_by_name(weather.ice_material)
weather.color = mat.icon_colour
// Temporarily removing the material checks, we do not have the same material system as Nebula
// if(is_liquid && weather.water_material)
// var/material/mat = SSmaterials.get_material_by_name(weather.water_material)
// weather.color = mat.icon_colour
// else if(is_ice && weather.ice_material)
// var/material/mat = SSmaterials.get_material_by_name(weather.ice_material)
// weather.color = mat.icon_colour
if(is_liquid)
weather.color = "#689dd4"
else if(is_ice)
weather.color = "#a9c8e8"
else
weather.color = COLOR_WHITE