From 3d7d89117146baa2a9f2e5a8ea2e1a34ce6202ba Mon Sep 17 00:00:00 2001 From: GenericDM <34109002+GenericDM@users.noreply.github.com> Date: Tue, 21 Nov 2023 18:59:10 -0800 Subject: [PATCH 1/8] checkout files from tgstation --- code/datums/components/weatherannouncer.dm | 175 ++++++++++++++++++ code/game/machinery/mining_weather_monitor.dm | 26 +++ code/modules/mining/equipment/miningradio.dm | 24 +++ icons/obj/miningradio.dmi | Bin 0 -> 3542 bytes 4 files changed, 225 insertions(+) create mode 100644 code/datums/components/weatherannouncer.dm create mode 100644 code/game/machinery/mining_weather_monitor.dm create mode 100644 code/modules/mining/equipment/miningradio.dm create mode 100644 icons/obj/miningradio.dmi diff --git a/code/datums/components/weatherannouncer.dm b/code/datums/components/weatherannouncer.dm new file mode 100644 index 000000000000..fec31ccf9d3c --- /dev/null +++ b/code/datums/components/weatherannouncer.dm @@ -0,0 +1,175 @@ +#define WEATHER_ALERT_CLEAR 0 +#define WEATHER_ALERT_INCOMING 1 +#define WEATHER_ALERT_IMMINENT_OR_ACTIVE 2 + +/// Component which makes you yell about what the weather is +/datum/component/weather_announcer + /// Currently displayed warning level + var/warning_level = WEATHER_ALERT_CLEAR + /// Whether the incoming weather is actually going to harm you + var/is_weather_dangerous = TRUE + /// Are we actually turned on right now? + var/enabled = TRUE + /// Overlay added when things are alright + var/state_normal + /// Overlay added when you should start looking for shelter + var/state_warning + /// Overlay added when you are in danger + var/state_danger + +/datum/component/weather_announcer/Initialize( + state_normal, + state_warning, + state_danger, +) + . = ..() + if (!ismovable(parent)) + return COMPONENT_INCOMPATIBLE + + START_PROCESSING(SSprocessing, src) + RegisterSignal(parent, COMSIG_ATOM_UPDATE_OVERLAYS, PROC_REF(on_update_overlays)) + RegisterSignal(parent, COMSIG_MACHINERY_POWER_RESTORED, PROC_REF(on_powered)) + RegisterSignal(parent, COMSIG_MACHINERY_POWER_LOST, PROC_REF(on_power_lost)) + + src.state_normal = state_normal + src.state_warning = state_warning + src.state_danger = state_danger + var/atom/speaker = parent + speaker.update_appearance(UPDATE_ICON) + update_light_color() + +/datum/component/weather_announcer/Destroy(force, silent) + STOP_PROCESSING(SSprocessing, src) + return ..() + +/// Add appropriate overlays +/datum/component/weather_announcer/proc/on_update_overlays(atom/parent_atom, list/overlays) + SIGNAL_HANDLER + if (!enabled || !state_normal || !state_warning || !state_danger) + return + + switch (warning_level) + if(WEATHER_ALERT_CLEAR) + overlays += state_normal + if(WEATHER_ALERT_INCOMING) + overlays += state_warning + if(WEATHER_ALERT_IMMINENT_OR_ACTIVE) + overlays += (is_weather_dangerous) ? state_danger : state_warning + +/// If powered, receive updates +/datum/component/weather_announcer/proc/on_powered() + SIGNAL_HANDLER + enabled = TRUE + var/atom/speaker = parent + speaker.update_appearance(UPDATE_ICON) + +/// If no power, don't receive updates +/datum/component/weather_announcer/proc/on_power_lost() + SIGNAL_HANDLER + enabled = FALSE + var/atom/speaker = parent + speaker.update_appearance(UPDATE_ICON) + +/datum/component/weather_announcer/process(seconds_per_tick) + if (!enabled) + return + + var/previous_level = warning_level + var/previous_danger = is_weather_dangerous + set_current_alert_level() + if(previous_level == warning_level && previous_danger == is_weather_dangerous) + return // No change + var/atom/movable/speaker = parent + speaker.say(get_warning_message()) + speaker.update_appearance(UPDATE_ICON) + update_light_color() + +/datum/component/weather_announcer/proc/update_light_color() + var/atom/movable/light = parent + switch(warning_level) + if(WEATHER_ALERT_CLEAR) + light.set_light_color(LIGHT_COLOR_GREEN) + if(WEATHER_ALERT_INCOMING) + light.set_light_color(LIGHT_COLOR_DIM_YELLOW) + if(WEATHER_ALERT_IMMINENT_OR_ACTIVE) + light.set_light_color(LIGHT_COLOR_INTENSE_RED) + light.update_light() + +/// Returns a string we should display to communicate what you should be doing +/datum/component/weather_announcer/proc/get_warning_message() + if (!is_weather_dangerous) + return "No risk expected from incoming weather front." + switch(warning_level) + if(WEATHER_ALERT_CLEAR) + return "All clear, no weather alerts to report." + if(WEATHER_ALERT_INCOMING) + return "Weather front incoming, begin to seek shelter." + if(WEATHER_ALERT_IMMINENT_OR_ACTIVE) + return "Weather front imminent, find shelter immediately." + 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 + + + for(var/datum/weather/check_weather as anything in SSweather.processing) + 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 + + 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 + return time_until_next + +/// Polls existing weather for what kind of warnings we should be displaying. +/datum/component/weather_announcer/proc/set_current_alert_level() + var/time_until_next = time_till_storm() + if(isnull(time_until_next)) + return // No problems if there are no mining z levels + if(time_until_next >= 2 MINUTES) + warning_level = WEATHER_ALERT_CLEAR + return + + if(time_until_next >= 30 SECONDS) + warning_level = WEATHER_ALERT_INCOMING + return + + // 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) + 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 + +/datum/component/weather_announcer/proc/on_examine(atom/radio, mob/examiner, list/examine_texts) + var/time_until_next = time_till_storm() + if(isnull(time_until_next)) + return + if (time_until_next == 0) + examine_texts += span_warning ("A storm is currently active, please seek shelter.") + else + 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)) + +/datum/component/weather_announcer/UnregisterFromParent() + .=..() + UnregisterSignal(parent, COMSIG_ATOM_EXAMINE) + +#undef WEATHER_ALERT_CLEAR +#undef WEATHER_ALERT_INCOMING +#undef WEATHER_ALERT_IMMINENT_OR_ACTIVE diff --git a/code/game/machinery/mining_weather_monitor.dm b/code/game/machinery/mining_weather_monitor.dm new file mode 100644 index 000000000000..d05d8820751a --- /dev/null +++ b/code/game/machinery/mining_weather_monitor.dm @@ -0,0 +1,26 @@ +/// Wall mounted mining weather tracker +/obj/machinery/mining_weather_monitor + name = "barometric monitor" + desc = "A machine monitoring atmospheric data from mining environments. Provides warnings about incoming weather fronts." + icon = 'icons/obj/miningradio.dmi' + icon_state = "wallmount" + luminosity = 1 + light_power = 1 + light_range = 1.6 + +/obj/machinery/mining_weather_monitor/Initialize(mapload, ndir, nbuild) + . = ..() + AddComponent( \ + /datum/component/weather_announcer, \ + state_normal = "wallgreen", \ + state_warning = "wallyellow", \ + state_danger = "wallred", \ + ) + +/obj/machinery/mining_weather_monitor/update_overlays() + . = ..() + if((machine_stat & BROKEN) || !powered()) + return + . += emissive_appearance(icon, "emissive", src) + +MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/mining_weather_monitor, 28) diff --git a/code/modules/mining/equipment/miningradio.dm b/code/modules/mining/equipment/miningradio.dm new file mode 100644 index 000000000000..559740599dbe --- /dev/null +++ b/code/modules/mining/equipment/miningradio.dm @@ -0,0 +1,24 @@ +/// Portable mining radio purchasable by miners +/obj/item/radio/weather_monitor + icon = 'icons/obj/miningradio.dmi' + 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 + luminosity = 1 + light_power = 1 + light_range = 1.6 + +/obj/item/radio/weather_monitor/update_overlays() + . = ..() + . += emissive_appearance(icon, "small_emissive", src, alpha = src.alpha) + +/obj/item/radio/weather_monitor/Initialize(mapload) + . = ..() + AddComponent( \ + /datum/component/weather_announcer, \ + state_normal = "weatherwarning", \ + state_warning = "urgentwarning", \ + state_danger = "direwarning", \ + ) + set_frequency(FREQ_SUPPLY) diff --git a/icons/obj/miningradio.dmi b/icons/obj/miningradio.dmi new file mode 100644 index 0000000000000000000000000000000000000000..e3d10f3b6d62e4c276ff32938328489366d1a5d1 GIT binary patch literal 3542 zcmai0XH-+!8ckpZ-YDSUh&WQB5pfg{QHpfbAR zeLo*h^Hw_=H1OXoLN~IoY^CuveP7@v{*2g56XdKQsb3kn`FB%d(@`f>0r++SL zaWzhfb>MZ=&fNmX>p9}5zU+|cCX4aWQ7=-no0^nEX6C+A!^#z_T8M}~aH8Ie4cZU{ z9_|)3KbIswHq9+?$}n($ZNj-7t~^LAE-<}5$2!LG392coAy=&u)aZd$bnUg=R@-hB z@0Y3-BIKtV*A3e0voInBnj{bE!^uZOKiCqcVhmdAj=6Vim;I5v?`09o&SYg9*)dNI zoC*neW{B9@^YHucjH$yux*(9mQ*+okhX}&bSa6~vGgth}L`^wZFnYb{x74c@a+Z91 z%8<(aU5A53H2Uwg&-5Qw@850lsQ&KpnYi8O=N6Q&?RsA77StjUGw>olPFpj1&8b`J zxqp1ctBV7Fl+SAS{hpF#xc#R46r(RYY;|0BW1Pdq@Cad~?PzQgXF9T%u#f~K;LqWK z4=zFJb!^Ln^g8a{u&UUU>pBAUoa93MT0qA&i@_6{qq5S{tb#HuUhAld^UbYY5idnf z)e$R1NeV-F7)-TsE25btS7elum{_I)e@osuYOe+Ts8i7Uf(Uu)ha8YVB0O%g` zu$IkI;;o3lvE3x#JywU-W>KeONiRK$Kh?z7TH4zZE32dF0J@PG@V$Zm*jBKaAW25D zZGR~|dZKI^vcsC9?RpBb)0(7}#{4{;S<<$d@7luL_#*@zgBsibhoG~ano46rP9QUO zo=v&1U*~Rig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-n(ZE)1n&9{CsZx_bmSEhRV z?Y%;ujS{?csC2B_P`7Xdk6a^*8Pt%~t=(%g3aifR16c)?fBs!q!$%fDPjkG5&C9V; zHvsB01*axc8qF?t*e9qd67P1ETwL6)&i-38Us;%GO(H!0B)QC|JaG7r`WR1P0Pf^i zZh(Dr>xVa{I)wL-=72#@J)9QZ(gS`#g*XTAl@3J)qCXw26IOtb5#Jhz9=xX&Ly}E9 zIwfpsNtd8$EjA2%vV>rI9n4fEaqKxuRe#-aw1-PED@_Tz%iQ*eS=IY5$k< zjd-hh?yT<0wG>@G^;Z{}_DW1XbOVp&MRTwaW0V2Z^G}!H_CB7_%U%}k)vMjc0PPnh vRfu(dZ_Ddz4d$?x&z1aa^{fAhv7%fco@|#X&p&#pPq=PwY7Hwn?{V*6P{FI1 literal 0 HcmV?d00001 From bc75374abbbad045bb73de681170f3a49f8f9e04 Mon Sep 17 00:00:00 2001 From: GenericDM <34109002+GenericDM@users.noreply.github.com> Date: Tue, 21 Nov 2023 19:02:43 -0800 Subject: [PATCH 2/8] update the dme too, that'd be important --- shiptest.dme | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shiptest.dme b/shiptest.dme index e1b52aaaac6b..2579534c3c52 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -530,6 +530,7 @@ #include "code\datums\components\udder.dm" #include "code\datums\components\uplink.dm" #include "code\datums\components\wearertargeting.dm" +#include "code\datums\components\weatherannouncer.dm" #include "code\datums\components\wet_floor.dm" #include "code\datums\components\crafting\crafting.dm" #include "code\datums\components\crafting\guncrafting.dm" @@ -874,6 +875,7 @@ #include "code\game\machinery\mass_driver.dm" #include "code\game\machinery\medical_kiosk.dm" #include "code\game\machinery\medipen_refiller.dm" +#include "code\game\machinery\mining_weather_monitor.dm" #include "code\game\machinery\navbeacon.dm" #include "code\game\machinery\newscaster.dm" #include "code\game\machinery\PDApainter.dm" @@ -2367,6 +2369,7 @@ #include "code\modules\mining\equipment\marker_beacons.dm" #include "code\modules\mining\equipment\mineral_scanner.dm" #include "code\modules\mining\equipment\mining_tools.dm" +#include "code\modules\mining\equipment\miningradio.dm" #include "code\modules\mining\equipment\regenerative_core.dm" #include "code\modules\mining\equipment\resonator.dm" #include "code\modules\mining\equipment\survival_pod.dm" From 8c5c97649077c8bcd5acbaa646adf0f69e1fac7e Mon Sep 17 00:00:00 2001 From: GenericDM <34109002+GenericDM@users.noreply.github.com> Date: Tue, 21 Nov 2023 23:29:34 -0800 Subject: [PATCH 3/8] fix errors slowly a few at a time --- code/__DEFINES/colors.dm | 2 ++ code/datums/components/weatherannouncer.dm | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/code/__DEFINES/colors.dm b/code/__DEFINES/colors.dm index 5814f8f27a1f..c428e1e7dd53 100644 --- a/code/__DEFINES/colors.dm +++ b/code/__DEFINES/colors.dm @@ -164,6 +164,8 @@ #define LIGHT_COLOR_LAVA "#C48A18" /// Bright, non-saturated red. Leaning slightly towards pink for visibility. rgb(250, 100, 75) #define LIGHT_COLOR_FLARE "#FA644B" +/// Vivid red. Leans a bit darker to accentuate red colors and leave other channels a bit dry. rgb(200, 25, 25) +#define LIGHT_COLOR_INTENSE_RED "#C81919" /// Weird color, between yellow and green, very slimy. rgb(175, 200, 75) #define LIGHT_COLOR_SLIME_LAMP "#AFC84B" /// Extremely diluted yellow, close to skin color (for some reason). rgb(250, 225, 175) diff --git a/code/datums/components/weatherannouncer.dm b/code/datums/components/weatherannouncer.dm index fec31ccf9d3c..83164f34b811 100644 --- a/code/datums/components/weatherannouncer.dm +++ b/code/datums/components/weatherannouncer.dm @@ -90,7 +90,7 @@ if(WEATHER_ALERT_CLEAR) light.set_light_color(LIGHT_COLOR_GREEN) if(WEATHER_ALERT_INCOMING) - light.set_light_color(LIGHT_COLOR_DIM_YELLOW) + light.set_light_color(LIGHT_COLOR_YELLOW) if(WEATHER_ALERT_IMMINENT_OR_ACTIVE) light.set_light_color(LIGHT_COLOR_INTENSE_RED) light.update_light() @@ -109,12 +109,14 @@ 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/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 - for(var/datum/weather/check_weather as anything in SSweather.processing) + 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) From 49eb4cc0f0ef302ae748ef30642f5948ed42aa24 Mon Sep 17 00:00:00 2001 From: GenericDM <34109002+GenericDM@users.noreply.github.com> Date: Wed, 22 Nov 2023 16:02:14 -0800 Subject: [PATCH 4/8] it compiles now, hooray --- code/datums/components/weatherannouncer.dm | 34 +++++++------------- code/modules/mining/equipment/miningradio.dm | 4 +-- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/code/datums/components/weatherannouncer.dm b/code/datums/components/weatherannouncer.dm index 83164f34b811..077f39370f6c 100644 --- a/code/datums/components/weatherannouncer.dm +++ b/code/datums/components/weatherannouncer.dm @@ -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. @@ -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() @@ -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 diff --git a/code/modules/mining/equipment/miningradio.dm b/code/modules/mining/equipment/miningradio.dm index 559740599dbe..973eaf5172b4 100644 --- a/code/modules/mining/equipment/miningradio.dm +++ b/code/modules/mining/equipment/miningradio.dm @@ -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 @@ -21,4 +21,4 @@ state_warning = "urgentwarning", \ state_danger = "direwarning", \ ) - set_frequency(FREQ_SUPPLY) + set_frequency(FREQ_COMMON) From e0f33e333a1faa2bb6e860b6921da0531f86efe1 Mon Sep 17 00:00:00 2001 From: GenericDM <34109002+GenericDM@users.noreply.github.com> Date: Wed, 22 Nov 2023 17:03:09 -0800 Subject: [PATCH 5/8] fix runtime error and odd output when in a location that does not have weather --- code/datums/components/weatherannouncer.dm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/datums/components/weatherannouncer.dm b/code/datums/components/weatherannouncer.dm index 077f39370f6c..3821f9a1b559 100644 --- a/code/datums/components/weatherannouncer.dm +++ b/code/datums/components/weatherannouncer.dm @@ -110,8 +110,10 @@ /datum/component/weather_announcer/proc/time_till_storm() 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(!local_weather_controller.next_weather) + return null + for(var/type_index in local_weather_controller.current_weathers) + var/datum/weather/check_weather = local_weather_controller.current_weathers[type_index] if(!check_weather.barometer_predictable || check_weather.stage == WIND_DOWN_STAGE || check_weather.stage == END_STAGE) continue warning_level = WEATHER_ALERT_IMMINENT_OR_ACTIVE @@ -140,7 +142,8 @@ warning_level = WEATHER_ALERT_IMMINENT_OR_ACTIVE 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) + for(var/type_index in local_weather_controller.current_weathers) + var/datum/weather/check_weather = local_weather_controller.current_weathers[type_index] if(!check_weather.barometer_predictable || check_weather.stage == WIND_DOWN_STAGE || check_weather.stage == END_STAGE) continue is_weather_dangerous = !check_weather.aesthetic From 6b175213f5a19cc3ca1aac45cb0a3fa2e0d782fd Mon Sep 17 00:00:00 2001 From: GenericDM <34109002+GenericDM@users.noreply.github.com> Date: Fri, 24 Nov 2023 16:15:33 -0800 Subject: [PATCH 6/8] make the radio more friendly to use --- code/modules/mining/equipment/miningradio.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/modules/mining/equipment/miningradio.dm b/code/modules/mining/equipment/miningradio.dm index 973eaf5172b4..a0bef397d8ca 100644 --- a/code/modules/mining/equipment/miningradio.dm +++ b/code/modules/mining/equipment/miningradio.dm @@ -3,8 +3,7 @@ icon = 'icons/obj/miningradio.dmi' 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 = TRUE + desc = "A weather radio designed for use in inhospitable environments. Gives audible warnings when storms approach." luminosity = 1 light_power = 1 light_range = 1.6 From 6434583566b2a9d6201f71c6edf03e01e4a42def Mon Sep 17 00:00:00 2001 From: GenericDM <34109002+GenericDM@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:44:13 -0800 Subject: [PATCH 7/8] add it to the game --- code/modules/jobs/job_types/shaft_miner.dm | 3 ++- code/modules/research/designs/mining_designs.dm | 10 ++++++++++ code/modules/research/techweb/all_nodes.dm | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/code/modules/jobs/job_types/shaft_miner.dm b/code/modules/jobs/job_types/shaft_miner.dm index 6a3f13da7c78..cc5ec142932e 100644 --- a/code/modules/jobs/job_types/shaft_miner.dm +++ b/code/modules/jobs/job_types/shaft_miner.dm @@ -27,7 +27,8 @@ backpack_contents = list( /obj/item/flashlight/seclite=1,\ /obj/item/kitchen/knife/combat/survival=1,\ - /obj/item/stack/marker_beacon/ten=1) + /obj/item/stack/marker_beacon/ten=1,\ + /obj/item/radio/weather_monitor=1) backpack = /obj/item/storage/backpack/explorer satchel = /obj/item/storage/backpack/satchel/explorer diff --git a/code/modules/research/designs/mining_designs.dm b/code/modules/research/designs/mining_designs.dm index cf4ba7b9fa41..2cddc5043c3f 100644 --- a/code/modules/research/designs/mining_designs.dm +++ b/code/modules/research/designs/mining_designs.dm @@ -120,3 +120,13 @@ build_path = /obj/item/borg/upgrade/modkit/aoe/turfs category = list("Mining Designs", "Cyborg Upgrade Modules") departmental_flags = DEPARTMENTAL_FLAG_CARGO + +/datum/design/weather_monitor + name = "Weather Radio" + desc = "A weather radio designed for use in inhospitable environments. Gives audible warnings when storms approach." + id = "weatherradio" + build_type = PROTOLATHE + materials = list(/datum/material/iron=75, /datum/material/glass=25) + build_path = /obj/item/radio/weather_monitor + category = list("Mining Designs") + departmental_flags = DEPARTMENTAL_FLAG_CARGO diff --git a/code/modules/research/techweb/all_nodes.dm b/code/modules/research/techweb/all_nodes.dm index 02f51a1af9db..8d7b8fadd71c 100644 --- a/code/modules/research/techweb/all_nodes.dm +++ b/code/modules/research/techweb/all_nodes.dm @@ -559,7 +559,7 @@ display_name = "Mining Technology" description = "Better than Efficiency V." prereq_ids = list("engineering", "basic_plasma") - design_ids = list("drill", "superresonator", "triggermod", "damagemod", "cooldownmod", "rangemod", "ore_redemption", "mining_equipment_vendor", "cargoexpress", "plasmacutter", "mecha_kineticgun")//e a r l y g a m e) + design_ids = list("drill", "superresonator", "triggermod", "damagemod", "cooldownmod", "rangemod", "ore_redemption", "mining_equipment_vendor", "cargoexpress", "plasmacutter", "mecha_kineticgun", "weatherradio")//e a r l y g a m e) research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500) export_price = 5000 From c66d224a5f54f6a62163d311aea0200ce7e23af6 Mon Sep 17 00:00:00 2001 From: GenericDM <34109002+GenericDM@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:49:15 -0800 Subject: [PATCH 8/8] zap the wallmount --- code/game/machinery/mining_weather_monitor.dm | 26 ------------------ icons/obj/miningradio.dmi | Bin 3542 -> 1668 bytes shiptest.dme | 1 - 3 files changed, 27 deletions(-) delete mode 100644 code/game/machinery/mining_weather_monitor.dm diff --git a/code/game/machinery/mining_weather_monitor.dm b/code/game/machinery/mining_weather_monitor.dm deleted file mode 100644 index d05d8820751a..000000000000 --- a/code/game/machinery/mining_weather_monitor.dm +++ /dev/null @@ -1,26 +0,0 @@ -/// Wall mounted mining weather tracker -/obj/machinery/mining_weather_monitor - name = "barometric monitor" - desc = "A machine monitoring atmospheric data from mining environments. Provides warnings about incoming weather fronts." - icon = 'icons/obj/miningradio.dmi' - icon_state = "wallmount" - luminosity = 1 - light_power = 1 - light_range = 1.6 - -/obj/machinery/mining_weather_monitor/Initialize(mapload, ndir, nbuild) - . = ..() - AddComponent( \ - /datum/component/weather_announcer, \ - state_normal = "wallgreen", \ - state_warning = "wallyellow", \ - state_danger = "wallred", \ - ) - -/obj/machinery/mining_weather_monitor/update_overlays() - . = ..() - if((machine_stat & BROKEN) || !powered()) - return - . += emissive_appearance(icon, "emissive", src) - -MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/mining_weather_monitor, 28) diff --git a/icons/obj/miningradio.dmi b/icons/obj/miningradio.dmi index e3d10f3b6d62e4c276ff32938328489366d1a5d1..08b6052e91a0c204b5653b5027c4509b53bd86de 100644 GIT binary patch literal 1668 zcmaJ>eKga182^nLcVTxo-J$N3UZ_=6Zb}TbLSc^O-K@65#!TcT47qjOCgi0T@ALVb&-Xc>^G$Mgveks?!2kfz zw70{$000CmA%Hp*Ogla487!VR3a3L4~qVhOzp2Du0Xh4UszCp{w(`wL%-6gZ{NwMVZYwOs4k!F|llqLXJA8wDeIUAKXJv5YjHbO^j*4EP?j6>hHom*(I zcgXRVK@S&Z@VYbV*dU|&vPAU>xO)Ap0dw__tsV_~SdU6`eNzgrXwx%Ex|}=5(YKvR zdl(0>76gd~<6#hvktcjz&@CSK?8*t_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--git a/shiptest.dme b/shiptest.dme index 2579534c3c52..fd0106fafce3 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -875,7 +875,6 @@ #include "code\game\machinery\mass_driver.dm" #include "code\game\machinery\medical_kiosk.dm" #include "code\game\machinery\medipen_refiller.dm" -#include "code\game\machinery\mining_weather_monitor.dm" #include "code\game\machinery\navbeacon.dm" #include "code\game\machinery\newscaster.dm" #include "code\game\machinery\PDApainter.dm"