From 3216b07759becc373e833d38389bd2a486d090a6 Mon Sep 17 00:00:00 2001 From: NikNakFlak Date: Tue, 11 Aug 2015 21:05:30 -0700 Subject: [PATCH 1/3] Makes restarts not restart the server if admins are online --- code/controllers/subsystem/voting.dm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/voting.dm b/code/controllers/subsystem/voting.dm index 7988d4ab99e..90a9f38b568 100644 --- a/code/controllers/subsystem/voting.dm +++ b/code/controllers/subsystem/voting.dm @@ -116,7 +116,18 @@ var/datum/subsystem/vote/SSvote else master_mode = . if(restart) - world.Reboot("Restart vote successful.", "end_error", "restart vote") + if(!admins.len) + return + var/total_admins + var/afk_admins + for(var/client/C in admins) + total_admins++ + if(C.is_afk()) + afk_admins++ + var/active_admins + active_admins = total_admins - afk_admins + if(active_admins <= 0) + world.Reboot("Restart vote successful.", "end_error", "restart vote") return . From 65b6eae001131b8ef95eebf3e5924cbebc7547c7 Mon Sep 17 00:00:00 2001 From: Orange Borg Date: Wed, 12 Aug 2015 16:33:05 +1200 Subject: [PATCH 2/3] Improve the check for active admins --- code/controllers/subsystem/voting.dm | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/code/controllers/subsystem/voting.dm b/code/controllers/subsystem/voting.dm index 90a9f38b568..677757deeaa 100644 --- a/code/controllers/subsystem/voting.dm +++ b/code/controllers/subsystem/voting.dm @@ -116,16 +116,10 @@ var/datum/subsystem/vote/SSvote else master_mode = . if(restart) - if(!admins.len) - return - var/total_admins - var/afk_admins + var/active_admins = 0 for(var/client/C in admins) - total_admins++ - if(C.is_afk()) - afk_admins++ - var/active_admins - active_admins = total_admins - afk_admins + if(!C.is_afk()) + active_admins++ if(active_admins <= 0) world.Reboot("Restart vote successful.", "end_error", "restart vote") From f176789a0b40596069fd9dd4aed184ebfa39e128 Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Tue, 11 Aug 2015 22:03:21 -0700 Subject: [PATCH 3/3] improvements to vote restart when admins are on It will only count admins who can actually restart the server. It will stop searching for admins once it finds one. It will let the users and admins know that the restart vote will not automatically restart the server because of the active admins. --- code/controllers/subsystem/voting.dm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/controllers/subsystem/voting.dm b/code/controllers/subsystem/voting.dm index 677757deeaa..d413809558e 100644 --- a/code/controllers/subsystem/voting.dm +++ b/code/controllers/subsystem/voting.dm @@ -118,10 +118,14 @@ var/datum/subsystem/vote/SSvote if(restart) var/active_admins = 0 for(var/client/C in admins) - if(!C.is_afk()) - active_admins++ - if(active_admins <= 0) + if(!C.is_afk() && check_rights_for(C, R_SERVER)) + active_admins = 1 + break + if(!active_admins) world.Reboot("Restart vote successful.", "end_error", "restart vote") + else + world << "Notice:Restart vote will not restart the server automatically because there are active admins on." + message_admins("A restart vote has passed, but there are active admins on with +server, so it has been canceled. If you wish, you may restart the server.") return .