Files
GS13NG/code/controllers/subsystem/weather.dm
Poojawa 7e9b96a00f April sync (#360)
* Maps and things no code/icons

* helpers defines globalvars

* Onclick world.dm orphaned_procs

* subsystems

Round vote and shuttle autocall done here too

* datums

* Game folder

* Admin - chatter modules

* clothing - mining

* modular computers - zambies

* client

* mob level 1

* mob stage 2 + simple_animal

* silicons n brains

* mob stage 3 + Alien/Monkey

* human mobs

* icons updated

* some sounds

* emitter y u no commit

* update tgstation.dme

* compile fixes

* travis fixes

Also removes Fast digest mode, because reasons.

* tweaks for travis Mentors are broke again

Also fixes Sizeray guns

* oxygen loss fix for vore code.

* removes unused code

* some code updates

* bulk fixes

* further fixes

* outside things

* whoops.

* Maint bar ported

* GLOBs.
2017-04-13 23:37:00 -05:00

45 lines
1.5 KiB
Plaintext

//Used for all kinds of weather, ex. lavaland ash storms.
SUBSYSTEM_DEF(weather)
name = "Weather"
flags = SS_BACKGROUND
wait = 10
var/list/processing = list()
var/list/existing_weather = list()
var/list/eligible_zlevels = list(ZLEVEL_LAVALAND)
/datum/controller/subsystem/weather/fire()
for(var/V in processing)
var/datum/weather/W = V
if(W.aesthetic)
continue
for(var/mob/living/L in GLOB.mob_list)
if(W.can_impact(L))
W.impact(L)
for(var/Z in eligible_zlevels)
var/list/possible_weather_for_this_z = list()
for(var/V in existing_weather)
var/datum/weather/WE = V
if(WE.target_z == Z && WE.probability) //Another check so that it doesn't run extra weather
possible_weather_for_this_z[WE] = WE.probability
var/datum/weather/W = pickweight(possible_weather_for_this_z)
run_weather(W.name, Z)
eligible_zlevels -= Z
addtimer(CALLBACK(src, .proc/make_z_eligible, Z), rand(3000, 6000) + W.weather_duration_upper, TIMER_UNIQUE) //Around 5-10 minutes between weathers
/datum/controller/subsystem/weather/Initialize(start_timeofday)
..()
for(var/V in subtypesof(/datum/weather))
var/datum/weather/W = V
new W //weather->New will handle adding itself to the list
/datum/controller/subsystem/weather/proc/run_weather(weather_name, Z)
if(!weather_name)
return
for(var/V in existing_weather)
var/datum/weather/W = V
if(W.name == weather_name && W.target_z == Z)
W.telegraph()
/datum/controller/subsystem/weather/proc/make_z_eligible(zlevel)
eligible_zlevels |= zlevel