Skip to content

Commit

Permalink
it compiles now, hooray
Browse files Browse the repository at this point in the history
  • Loading branch information
GenericDM committed Nov 23, 2023
1 parent 8c5c976 commit 49eb4cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
34 changes: 12 additions & 22 deletions code/datums/components/weatherannouncer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,26 +109,18 @@
return "Error in meteorological calculation. Please report this deviation to a trained programmer."

/datum/component/weather_announcer/proc/time_till_storm()
//var/list/mining_z_levels = SSmapping.levels_by_trait(ZTRAIT_MINING)
//if(!length(mining_z_levels))
// return // No problems if there are no mining z levels
var/turf/
var/datum/weather_controller/local_weather_controller = SSmapping.get_map_zone_weather_controller

var/datum/weather_controller/local_weather_controller = SSmapping.get_map_zone_weather_controller(parent)

for(var/datum/weather/check_weather as anything in local_weather_controller.current_weathers)
if(!check_weather.barometer_predictable || check_weather.stage == WIND_DOWN_STAGE || check_weather.stage == END_STAGE)
continue
for (var/mining_level in mining_z_levels)
if(mining_level in check_weather.impacted_z_levels)
warning_level = WEATHER_ALERT_IMMINENT_OR_ACTIVE
return 0
warning_level = WEATHER_ALERT_IMMINENT_OR_ACTIVE
return 0

var/time_until_next = INFINITY
for(var/mining_level in mining_z_levels)
var/next_time = timeleft(SSweather.next_hit_by_zlevel["[mining_level ]"]) || INFINITY
if (next_time && next_time < time_until_next)
time_until_next = next_time
var/next_time = local_weather_controller.next_weather - world.time || INFINITY
if (next_time && next_time < time_until_next)
time_until_next = next_time
return time_until_next

/// Polls existing weather for what kind of warnings we should be displaying.
Expand All @@ -147,14 +139,12 @@
// Weather is here, now we need to figure out if it is dangerous
warning_level = WEATHER_ALERT_IMMINENT_OR_ACTIVE

for(var/datum/weather/check_weather as anything in SSweather.processing)
var/datum/weather_controller/local_weather_controller = SSmapping.get_map_zone_weather_controller(parent)
for(var/datum/weather/check_weather as anything in local_weather_controller.current_weathers)
if(!check_weather.barometer_predictable || check_weather.stage == WIND_DOWN_STAGE || check_weather.stage == END_STAGE)
continue
var/list/mining_z_levels = SSmapping.levels_by_trait(ZTRAIT_MINING)
for(var/mining_level in mining_z_levels)
if(mining_level in check_weather.impacted_z_levels)
is_weather_dangerous = !check_weather.aesthetic
return
is_weather_dangerous = !check_weather.aesthetic
return

/datum/component/weather_announcer/proc/on_examine(atom/radio, mob/examiner, list/examine_texts)
var/time_until_next = time_till_storm()
Expand All @@ -166,11 +156,11 @@
examine_texts += span_notice("The next storm is inbound in [DisplayTimeText(time_until_next)].")

/datum/component/weather_announcer/RegisterWithParent()
RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, PROC_REF(on_examine))

/datum/component/weather_announcer/UnregisterFromParent()
.=..()
UnregisterSignal(parent, COMSIG_ATOM_EXAMINE)
UnregisterSignal(parent, COMSIG_PARENT_EXAMINE)

#undef WEATHER_ALERT_CLEAR
#undef WEATHER_ALERT_INCOMING
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mining/equipment/miningradio.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name = "mining weather radio"
icon_state = "miningradio"
desc = "A weather radio designed for use in inhospitable environments. Gives audible warnings when storms approach. Has access to cargo channel."
freqlock = RADIO_FREQENCY_LOCKED
freqlock = TRUE
luminosity = 1
light_power = 1
light_range = 1.6
Expand All @@ -21,4 +21,4 @@
state_warning = "urgentwarning", \
state_danger = "direwarning", \
)
set_frequency(FREQ_SUPPLY)
set_frequency(FREQ_COMMON)

0 comments on commit 49eb4cc

Please sign in to comment.