[MIRROR] Ports Barometers from Yogstation (#5647)

* Ports Barometers from Yogstation (#35730)

* Ports Barometers from Yogstation

* Ports Barometers from Yogstation

* Added missing barometer_predictable bools

* Gives the atmos analyzer love instead of a new item.

* Moves playsound under cooldown to prevent soundspam.

* Ports Barometers from Yogstation
This commit is contained in:
CitadelStationBot
2018-02-21 19:44:20 -06:00
committed by Poojawa
parent 87053ef22b
commit 03dfbe7137
7 changed files with 91 additions and 2 deletions
+14 -1
View File
@@ -11,6 +11,7 @@ SUBSYSTEM_DEF(weather)
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
@@ -29,7 +30,9 @@ SUBSYSTEM_DEF(weather)
var/datum/weather/W = pickweight(possible_weather)
run_weather(W, list(text2num(z)))
eligible_zlevels -= z
addtimer(CALLBACK(src, .proc/make_eligible, z, possible_weather), rand(3000, 6000) + initial(W.weather_duration_upper), TIMER_UNIQUE) //Around 5-10 minutes between weathers
var/randTime = rand(3000, 6000)
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)
for(var/V in subtypesof(/datum/weather))
@@ -68,3 +71,13 @@ SUBSYSTEM_DEF(weather)
/datum/controller/subsystem/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)
var/datum/weather/A
for(var/V in processing)
var/datum/weather/W = V
if((z in W.impacted_z_levels) && W.area_type == active_area.type)
A = W
break
return A