From acb27889bf3016ecc574e62117d2f58e1439a914 Mon Sep 17 00:00:00 2001 From: SoundScopes Date: Mon, 26 Oct 2015 12:24:52 +0000 Subject: [PATCH] Toggle Da Hub --- code/modules/admin/admin_verbs.dm | 16 +++++++++++++++- .../admin/permissionverbs/permsission lists.dm | 4 +++- code/world.dm | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 21a6bd42..a7aa84a2 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -638,4 +638,18 @@ usr << "Your varedits will now be hidden from developers" else usr << "Your varedits will now be shown to developers" - return \ No newline at end of file + return + +/client/proc/toggle_visibily() + set category = "Server" + set name = "Toggle Hub Visibility" + set desc = "Toggle between public and hidden" + + if(!check_rights(R_SERVER|R_STEALTH)) + return + + world.visibility = !world.visibility + + message_admins("[src] has toggled the hub [world.visibility ? "public" : "hidden"]") + world.save_visibility(world.visibility) + return diff --git a/code/modules/admin/permissionverbs/permsission lists.dm b/code/modules/admin/permissionverbs/permsission lists.dm index 8d4314e8..bfddf36a 100644 --- a/code/modules/admin/permissionverbs/permsission lists.dm +++ b/code/modules/admin/permissionverbs/permsission lists.dm @@ -87,6 +87,7 @@ var/list/admin_verbs_admin = list( /client/proc/toggledrones, /client/proc/toggleprayers, /client/proc/toggle_view_range, /*changes how far we can see*/ + /client/proc/toggle_visibily, /client/proc/secrets, /client/proc/set_ooc ) @@ -206,7 +207,8 @@ var/list/admin_verbs_server = list( /client/proc/Set_Holiday, /client/proc/ToRban, /client/proc/toggle_log_hrefs, - /client/proc/toggle_random_events + /client/proc/toggle_random_events, + /client/proc/toggle_visibily ) var/list/admin_verbs_debug = list( diff --git a/code/world.dm b/code/world.dm index 12723a6b..f5b526c3 100644 --- a/code/world.dm +++ b/code/world.dm @@ -22,6 +22,7 @@ world.log << "Your server's byond version does not meet the recommended requirements for this server. Please update BYOND" load_configuration() + load_visibility() if(config && config.server_name != null && config.server_suffix && world.port > 0) // dumb and hardcoded but I don't care~ @@ -253,6 +254,19 @@ var/master_server_password fdel(F) F << the_mode +/world/proc/load_visibility() + var/list/Lines = file2list("data/hubsetting.txt") + if(Lines.len) + if(Lines[1]) + if(istext(Lines[1])) + Lines[1] = text2num(Lines[1]) + visibility = Lines[1] + log_misc("Are we visible '[Lines[1]]'") + +/world/proc/save_visibility(var/the_visibility) + var/F = file("data/hubsetting.txt") + fdel(F) + F << the_visibility /hook/startup/proc/loadMOTD() world.load_motd()