From 293a895d9209a1c32077ce29bfdad809d7b0c082 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Thu, 18 May 2017 13:58:52 -0500 Subject: [PATCH] [MIRROR] Fixes a bug where shuttles would not function (#1016) * Fixes a bug where shuttles would not function * Update master.dm * Delete master.dm.rej --- code/controllers/master.dm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/code/controllers/master.dm b/code/controllers/master.dm index c245c33e51..a220c2530c 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -132,7 +132,7 @@ GLOBAL_VAR_INIT(CURRENT_TICKLIMIT, TICK_LIMIT_RUNNING) msg = "The [BadBoy.name] subsystem seems to be destabilizing the MC and will be offlined." BadBoy.flags |= SS_NO_FIRE if(msg) - to_chat(GLOB.admins, "[msg]") + to_chat(GLOB.admins, "[msg]") log_world(msg) if (istype(Master.subsystems)) @@ -189,9 +189,15 @@ GLOBAL_VAR_INIT(CURRENT_TICKLIMIT, TICK_LIMIT_RUNNING) // Loop. Master.StartProcessing(0) -/datum/controller/master/proc/SetRunLevel(runlevel) - testing("MC: Runlevel changed from [isnull(current_runlevel) ? "NULL" : current_runlevel] to [runlevel]") - current_runlevel = runlevel +/datum/controller/master/proc/SetRunLevel(new_runlevel) + var/old_runlevel = current_runlevel + if(isnull(old_runlevel)) + old_runlevel = "NULL" + + testing("MC: Runlevel changed from [old_runlevel] to [new_runlevel]") + current_runlevel = log(2, new_runlevel) + 1 + if(current_runlevel < 1) + CRASH("Attempted to set invalid runlevel: [new_runlevel]") // Starts the mc, and sticks around to restart it if the loop ever ends. /datum/controller/master/proc/StartProcessing(delay) @@ -233,7 +239,7 @@ GLOBAL_VAR_INIT(CURRENT_TICKLIMIT, TICK_LIMIT_RUNNING) timer += world.tick_lag * rand(1, 5) SS.next_fire = timer continue - + var/ss_runlevels = SS.runlevels var/added_to_any = FALSE for(var/I in 1 to GLOB.bitflags.len) @@ -253,7 +259,7 @@ GLOBAL_VAR_INIT(CURRENT_TICKLIMIT, TICK_LIMIT_RUNNING) for(var/I in runlevel_sorted_subsystems) sortTim(runlevel_sorted_subsystems, /proc/cmp_subsystem_priority) I += tickersubsystems - + var/cached_runlevel = current_runlevel var/list/current_runlevel_subsystems = runlevel_sorted_subsystems[cached_runlevel]