From b17fb867214eb740c78671862d3a1c4d2ad1fad9 Mon Sep 17 00:00:00 2001 From: Leshana Date: Tue, 30 May 2017 23:54:59 -0400 Subject: [PATCH] Tweaks Statpanel and System Initialization --- code/controllers/master.dm | 4 ++++ code/modules/admin/verbs/modifyvariables.dm | 2 +- code/modules/client/client procs.dm | 12 ++++++++++++ code/modules/examine/examine.dm | 5 +++-- code/modules/mob/mob.dm | 17 +++++++++++++++++ code/world.dm | 3 +-- 6 files changed, 38 insertions(+), 5 deletions(-) diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 4dcf58d45e..981cf6d2bb 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -149,7 +149,11 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING // Sort subsystems by display setting for easy access. sortTim(subsystems, /proc/cmp_subsystem_display) // Set world options. + #ifdef UNIT_TEST + world.sleep_offline = 0 + #else world.sleep_offline = 1 + #endif world.fps = config.fps var/initialized_tod = REALTIMEOFDAY sleep(1) diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 51f1fbceb3..ecd26e9b56 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -4,7 +4,7 @@ var/list/forbidden_varedit_object_types = list( /datum/feedback_variable //Prevents people messing with feedback gathering, ) -var/list/VVlocked = list("vars", "client", "virus", "viruses", "cuffed", "last_eaten", "unlock_content", "bound_x", "bound_y", "step_x", "step_y", "force_ending") +var/list/VVlocked = list("vars", "client", "virus", "viruses", "cuffed", "last_eaten", "unlock_content", "bound_x", "bound_y", "step_x", "step_y", "force_ending", "queued_priority") var/list/VVicon_edit_lock = list("icon", "icon_state", "overlays", "underlays") var/list/VVckey_edit = list("key", "ckey") diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 212e7a49e8..d908df1b3d 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -284,6 +284,18 @@ if(inactivity > duration) return inactivity return 0 +// Byond seemingly calls stat, each tick. +// Calling things each tick can get expensive real quick. +// So we slow this down a little. +// See: http://www.byond.com/docs/ref/info.html#/client/proc/Stat +/client/Stat() + . = ..() + if (holder) + sleep(1) + else + sleep(5) + stoplag() + /client/proc/last_activity_seconds() return inactivity / 10 diff --git a/code/modules/examine/examine.dm b/code/modules/examine/examine.dm index f09fce6cf3..ec64ffbe41 100644 --- a/code/modules/examine/examine.dm +++ b/code/modules/examine/examine.dm @@ -49,9 +49,10 @@ description_holders["icon"] = "\icon[A]" description_holders["desc"] = A.desc -/client/Stat() +/mob/Stat() . = ..() - if(usr && statpanel("Examine")) + if(client && statpanel("Examine")) + var/description_holders = client.description_holders stat(null,"[description_holders["icon"]] [description_holders["name"]]") //The name, written in big letters. stat(null,"[description_holders["desc"]]") //the default examine text. if(description_holders["info"]) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index f16af92a74..7574bb4c77 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -672,6 +672,23 @@ if(processScheduler) processScheduler.statProcesses() + if(statpanel("MC")) + stat("CPU:","[world.cpu]") + stat("Instances:","[world.contents.len]") + stat(null) + if(Master) + Master.stat_entry() + else + stat("Master Controller:", "ERROR") + if(Failsafe) + Failsafe.stat_entry() + else + stat("Failsafe Controller:", "ERROR") + if(Master) + stat(null) + for(var/datum/controller/subsystem/SS in Master.subsystems) + SS.stat_entry() + if(listed_turf && client) if(!TurfAdjacent(listed_turf)) listed_turf = null diff --git a/code/world.dm b/code/world.dm index 02ec2669a9..8d51f84b47 100644 --- a/code/world.dm +++ b/code/world.dm @@ -70,8 +70,6 @@ var/global/datum/global_init/init = new () #if UNIT_TEST log_unit_test("Unit Tests Enabled. This will destroy the world when testing is complete.") log_unit_test("If you did not intend to enable this please check code/__defines/unit_testing.dm") -#else - sleep_offline = 1 #endif // Set up roundstart seed list. @@ -116,6 +114,7 @@ var/global/datum/global_init/init = new () processScheduler = new master_controller = new /datum/controller/game_controller() + Master.Initialize(10, FALSE) spawn(1) processScheduler.deferSetupFor(/datum/controller/process/ticker) processScheduler.setup()