From ccb06749887a39c807e3914475a7a08954ae565c Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sat, 14 Oct 2017 12:45:40 -0400 Subject: [PATCH] Fixes the last Href Token issues (#31666) --- code/modules/admin/topic.dm | 60 ++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index c182107a6a..05a76baeb7 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1210,33 +1210,10 @@ cmd_admin_mute(href_list["mute"], text2num(href_list["mute_type"])) else if(href_list["c_mode"]) - if(!check_rights(R_ADMIN)) - return - - if(SSticker.HasRoundStarted()) - return alert(usr, "The game has already started.", null, null, null, null) - var/dat = {"What mode do you wish to play?
"} - for(var/mode in config.modes) - dat += {"[config.mode_names[mode]]
"} - dat += {"Secret
"} - dat += {"Random
"} - dat += {"Now: [GLOB.master_mode]"} - usr << browse(dat, "window=c_mode") + return HandleCMode() else if(href_list["f_secret"]) - if(!check_rights(R_ADMIN)) - return - - if(SSticker.HasRoundStarted()) - return alert(usr, "The game has already started.", null, null, null, null) - if(GLOB.master_mode != "secret") - return alert(usr, "The game mode has to be secret!", null, null, null, null) - var/dat = {"What game mode do you want to force secret to be? Use this if you want to change the game mode, but want the players to believe it's secret. This will only work if the current game mode is secret.
"} - for(var/mode in config.modes) - dat += {"[config.mode_names[mode]]
"} - dat += {"Random (default)
"} - dat += {"Now: [GLOB.secret_force_mode]"} - usr << browse(dat, "window=f_secret") + return HandleFSecret() else if(href_list["c_mode2"]) if(!check_rights(R_ADMIN|R_SERVER)) @@ -1250,7 +1227,7 @@ to_chat(world, "The mode is now: [GLOB.master_mode]") Game() // updates the main game menu SSticker.save_mode(GLOB.master_mode) - .(href, list("c_mode"=1)) + HandleCMode() else if(href_list["f_secret2"]) if(!check_rights(R_ADMIN|R_SERVER)) @@ -1264,7 +1241,7 @@ log_admin("[key_name(usr)] set the forced secret mode as [GLOB.secret_force_mode].") message_admins("[key_name_admin(usr)] set the forced secret mode as [GLOB.secret_force_mode].") Game() // updates the main game menu - .(href, list("f_secret"=1)) + HandleFSecret() else if(href_list["monkeyone"]) if(!check_rights(R_SPAWN)) @@ -2296,3 +2273,32 @@ dat += thing_to_check usr << browse(dat.Join("
"), "window=related_[C];size=420x300") + +/datum/admins/proc/HandleCMode() + if(!check_rights(R_ADMIN)) + return + + if(SSticker.HasRoundStarted()) + return alert(usr, "The game has already started.", null, null, null, null) + var/dat = {"What mode do you wish to play?
"} + for(var/mode in config.modes) + dat += {"[config.mode_names[mode]]
"} + dat += {"Secret
"} + dat += {"Random
"} + dat += {"Now: [GLOB.master_mode]"} + usr << browse(dat, "window=c_mode") + +/datum/admins/proc/HandleFSecret() + if(!check_rights(R_ADMIN)) + return + + if(SSticker.HasRoundStarted()) + return alert(usr, "The game has already started.", null, null, null, null) + if(GLOB.master_mode != "secret") + return alert(usr, "The game mode has to be secret!", null, null, null, null) + var/dat = {"What game mode do you want to force secret to be? Use this if you want to change the game mode, but want the players to believe it's secret. This will only work if the current game mode is secret.
"} + for(var/mode in config.modes) + dat += {"[config.mode_names[mode]]
"} + dat += {"Random (default)
"} + dat += {"Now: [GLOB.secret_force_mode]"} + usr << browse(dat, "window=f_secret")