From d8d6a8efb8f2df036e199833f99ca6e3d6eea225 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Wed, 12 Feb 2020 02:15:56 -0700 Subject: [PATCH] lazy-be-gone --- .../subsystem/{ => processing}/weather.dm | 23 ++++++------------- code/datums/weather/weather.dm | 12 ++++++++-- tgstation.dme | 2 +- 3 files changed, 18 insertions(+), 19 deletions(-) rename code/controllers/subsystem/{ => processing}/weather.dm (77%) diff --git a/code/controllers/subsystem/weather.dm b/code/controllers/subsystem/processing/weather.dm similarity index 77% rename from code/controllers/subsystem/weather.dm rename to code/controllers/subsystem/processing/weather.dm index 5e44f2e4c3..0a1b4fc609 100644 --- a/code/controllers/subsystem/weather.dm +++ b/code/controllers/subsystem/processing/weather.dm @@ -4,25 +4,16 @@ #define END_STAGE 4 //Used for all kinds of weather, ex. lavaland ash storms. -SUBSYSTEM_DEF(weather) +PROCESSING_SUBSYSTEM_DEF(weather) name = "Weather" flags = SS_BACKGROUND wait = 10 runlevels = RUNLEVEL_GAME - var/list/processing = list() var/list/eligible_zlevels = list() var/list/next_hit_by_zlevel = list() //Used by barometers to know when the next storm is coming -/datum/controller/subsystem/weather/fire() - // process active weather - for(var/V in processing) - var/datum/weather/W = V - if(W.aesthetic || W.stage != MAIN_STAGE) - continue - for(var/i in GLOB.mob_living_list) - var/mob/living/L = i - if(W.can_weather_act(L)) - W.weather_act(L) +/datum/controller/subsystem/processing/weather/fire() + . = ..() //Active weather is handled by . = ..() processing subsystem base fire(). // start random weather on relevant levels for(var/z in eligible_zlevels) @@ -34,7 +25,7 @@ SUBSYSTEM_DEF(weather) addtimer(CALLBACK(src, .proc/make_eligible, z, possible_weather), randTime + initial(W.weather_duration_upper), TIMER_UNIQUE) //Around 5-10 minutes between weathers next_hit_by_zlevel["[z]"] = world.time + randTime + initial(W.telegraph_duration) -/datum/controller/subsystem/weather/Initialize(start_timeofday) +/datum/controller/subsystem/processing/weather/Initialize(start_timeofday) for(var/V in subtypesof(/datum/weather)) var/datum/weather/W = V var/probability = initial(W.probability) @@ -47,7 +38,7 @@ SUBSYSTEM_DEF(weather) eligible_zlevels["[z]"][W] = probability return ..() -/datum/controller/subsystem/weather/proc/run_weather(datum/weather/weather_datum_type, z_levels) +/datum/controller/subsystem/processing/weather/proc/run_weather(datum/weather/weather_datum_type, z_levels) if (istext(weather_datum_type)) for (var/V in subtypesof(/datum/weather)) var/datum/weather/W = V @@ -69,11 +60,11 @@ SUBSYSTEM_DEF(weather) var/datum/weather/W = new weather_datum_type(z_levels) W.telegraph() -/datum/controller/subsystem/weather/proc/make_eligible(z, possible_weather) +/datum/controller/subsystem/processing/weather/proc/make_eligible(z, possible_weather) eligible_zlevels[z] = possible_weather next_hit_by_zlevel["[z]"] = null -/datum/controller/subsystem/weather/proc/get_weather(z, area/active_area) +/datum/controller/subsystem/processing/weather/proc/get_weather(z, area/active_area) var/datum/weather/A for(var/V in processing) var/datum/weather/W = V diff --git a/code/datums/weather/weather.dm b/code/datums/weather/weather.dm index 1e44e9b69d..6761ecbb4c 100644 --- a/code/datums/weather/weather.dm +++ b/code/datums/weather/weather.dm @@ -61,7 +61,7 @@ if(A.z in impacted_z_levels) impacted_areas |= A weather_duration = rand(weather_duration_lower, weather_duration_upper) - SSweather.processing += src //not processing subsystem + START_PROCESSING(SSweather, src) //The reason this doesn't start and stop at main stage is because processing list is also used to see active running weathers (for example, you wouldn't want two ash storms starting at once.) update_areas() for(var/M in GLOB.player_list) var/turf/mob_turf = get_turf(M) @@ -104,9 +104,17 @@ if(stage == END_STAGE) return 1 stage = END_STAGE - SSweather.processing -= src //not processing subsystem + STOP_PROCESSING(SSweather, src) update_areas() +/datum/weather/process() + if(aesthetic || (stage != MAIN_STAGE)) + return + for(var/i in GLOB.mob_living_list) + var/mob/living/L = i + if(can_weather_act(L)) + weather_act(L) + /datum/weather/proc/can_weather_act(mob/living/L) //Can this weather impact a mob? var/turf/mob_turf = get_turf(L) if(mob_turf && !(mob_turf.z in impacted_z_levels)) diff --git a/tgstation.dme b/tgstation.dme index 927027d448..e7d5e50b54 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -292,7 +292,6 @@ #include "code\controllers\subsystem\vis_overlays.dm" #include "code\controllers\subsystem\vore.dm" #include "code\controllers\subsystem\vote.dm" -#include "code\controllers\subsystem\weather.dm" #include "code\controllers\subsystem\processing\chemistry.dm" #include "code\controllers\subsystem\processing\circuit.dm" #include "code\controllers\subsystem\processing\fastprocess.dm" @@ -303,6 +302,7 @@ #include "code\controllers\subsystem\processing\processing.dm" #include "code\controllers\subsystem\processing\projectiles.dm" #include "code\controllers\subsystem\processing\quirks.dm" +#include "code\controllers\subsystem\processing\weather.dm" #include "code\controllers\subsystem\processing\wet_floors.dm" #include "code\datums\action.dm" #include "code\datums\ai_laws.dm"