Merge pull request #6970 from VOREStation/pol-couplefix

Fix 2 bugs
This commit is contained in:
Atermonera
2020-04-10 23:49:46 -07:00
committed by GitHub
3 changed files with 19 additions and 24 deletions
-5
View File
@@ -68,11 +68,6 @@ SUBSYSTEM_DEF(skybox)
/datum/controller/subsystem/skybox/proc/get_skybox(z)
if(!skybox_cache["[z]"])
skybox_cache["[z]"] = generate_skybox(z)
if(global.using_map.use_overmap)
var/obj/effect/overmap/visitable/O = map_sectors["[z]"]
if(istype(O))
for(var/zlevel in O.map_z)
skybox_cache["[zlevel]"] = skybox_cache["[z]"]
return skybox_cache["[z]"]
/datum/controller/subsystem/skybox/proc/generate_skybox(z)
@@ -11,6 +11,7 @@
var/ignore_ghosts = FALSE // If true, ghosts won't satisfy the above requirement.
var/ignore_afk = TRUE // If true, AFK people (5 minutes) won't satisfy it as well.
var/retry_delay = 5 SECONDS // How long until we check for players again.
var/next_attempt = 0 // Next time we're going to do ACTUAL WORK
/obj/effect/map_effect/ex_act()
return
@@ -25,32 +26,32 @@
/obj/effect/map_effect/interval
var/interval_lower_bound = 5 SECONDS // Lower number for how often the map_effect will trigger.
var/interval_upper_bound = 5 SECONDS // Higher number for above.
var/halt = FALSE // Set to true to stop the loop when it reaches the next iteration.
/obj/effect/map_effect/interval/Initialize()
handle_interval_delay()
return ..()
. = ..()
START_PROCESSING(SSobj, src)
/obj/effect/map_effect/interval/Destroy()
halt = TRUE // Shouldn't need it to GC but just in case.
STOP_PROCESSING(SSobj, src)
return ..()
// Override this for the specific thing to do. Be sure to call parent to keep looping.
// Override this for the specific thing to do.
/obj/effect/map_effect/interval/proc/trigger()
handle_interval_delay()
return
// Handles the delay and making sure it doesn't run when it would be bad.
/obj/effect/map_effect/interval/proc/handle_interval_delay()
/obj/effect/map_effect/interval/process()
//Not yet!
if(world.time < next_attempt)
return
// Check to see if we're useful first.
if(halt)
return // Do not pass .(), do not recursively collect 200 thaler.
if(!always_run && !check_for_player_proximity(src, proximity_needed, ignore_ghosts, ignore_afk))
//Nobody home, try again after retry_delay
addtimer(CALLBACK(src, .proc/handle_interval_delay), retry_delay)
next_attempt = world.time + retry_delay
// Hey there's someone nearby.
else
//Someone was here!
addtimer(CALLBACK(src, .proc/trigger), rand(interval_lower_bound, interval_upper_bound))
next_attempt = world.time + rand(interval_lower_bound, interval_upper_bound)
trigger()
// Helper proc to optimize the use of effects by making sure they do not run if nobody is around to perceive it.
/proc/check_for_player_proximity(var/atom/proximity_to, var/radius = 12, var/ignore_ghosts = FALSE, var/ignore_afk = TRUE)
+3 -4
View File
@@ -179,10 +179,9 @@ var/list/all_maps = list()
)
/datum/map/proc/get_skybox_datum(z)
if(map_levels["[z]"])
var/datum/map_z_level/picked = map_levels["[z]"]
if(picked.custom_skybox)
return picked.custom_skybox
var/datum/map_z_level/picked = zlevels["[z]"]
if(picked?.custom_skybox)
return picked.custom_skybox
return default_skybox