From 647bcb7597c5bf99e581aa62d0a56260f0d245e4 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Mon, 6 Apr 2020 12:08:33 -0400 Subject: [PATCH 1/2] Fix per-zlevel skyboxes not really allowing custom ones It's not going to break the world to remove this 'assumption' cache --- code/controllers/subsystems/skybox.dm | 5 ----- maps/~map_system/maps.dm | 7 +++---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/code/controllers/subsystems/skybox.dm b/code/controllers/subsystems/skybox.dm index 82b498f00e..b435c90ca7 100644 --- a/code/controllers/subsystems/skybox.dm +++ b/code/controllers/subsystems/skybox.dm @@ -47,11 +47,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) diff --git a/maps/~map_system/maps.dm b/maps/~map_system/maps.dm index a48af689d3..f40ed991a6 100644 --- a/maps/~map_system/maps.dm +++ b/maps/~map_system/maps.dm @@ -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 From bc3bce67327497dd20b25b301e4a8069927e206e Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Mon, 6 Apr 2020 12:08:55 -0400 Subject: [PATCH 2/2] Fix infinite server destroying loop in interval effects --- .../effects/map_effects/map_effects.dm | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/code/game/objects/effects/map_effects/map_effects.dm b/code/game/objects/effects/map_effects/map_effects.dm index 03a07a56ce..ef7374e10f 100644 --- a/code/game/objects/effects/map_effects/map_effects.dm +++ b/code/game/objects/effects/map_effects/map_effects.dm @@ -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)