From 9a34619e09899a4501bd672c84f55c64192d7b72 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 aaed1968e93..a005ed1f6a7 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1204,33 +1204,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)) @@ -1244,7 +1221,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)) @@ -1258,7 +1235,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)) @@ -2290,3 +2267,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")