From a56103c151310efd04d319db3e0190b132d54f9d Mon Sep 17 00:00:00 2001 From: Ccomp5950 Date: Sun, 17 Nov 2013 10:00:12 -0600 Subject: [PATCH] Added Adminverbs for turning off and on the various items needed. Also added the proc get_ghosts() with 2 versions of output, it defaults to returning a mob list but can be set to return a list for use with an input window. --- code/modules/admin/admin_verbs.dm | 2 + code/modules/admin/verbs/randomverbs.dm | 96 ++++++++++++++++++---- code/modules/mob/dead/observer/observer.dm | 19 +++-- 3 files changed, 94 insertions(+), 23 deletions(-) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 606a6e82ffc..1158633bf80 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -70,6 +70,8 @@ var/list/admin_verbs_admin = list( /client/proc/man_up, /client/proc/global_man_up, /client/proc/response_team, // Response Teams admin verb + /client/proc/toggle_antagHUD_use, + /client/proc/toggle_antagHUD_restrictions, /client/proc/allow_character_respawn /* Allows a ghost to respawn */ ) var/list/admin_verbs_ban = list( diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 6a5af5cf25f..010e99e23e4 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -226,26 +226,38 @@ Allow admins to set players to be able to respawn/bypass 30 min wait, without th Ccomp's first proc. */ +/client/proc/get_ghosts(var/notify = 0,var/what = 2) + // what = 1, return ghosts ass list. + // what = 2, return mob list + + var/list/mobs = list() + var/list/ghosts = list() + var/list/sortmob = sortAtom(mob_list) // get the mob list. + /var/any=0 + for(var/mob/dead/observer/M in sortmob) + mobs.Add(M) //filter it where it's only ghosts + any = 1 //if no ghosts show up, any will just be 0 + if(!any) + if(notify) + src << "There doesn't appear to be any ghosts for you to select." + return + + for(var/mob/M in mobs) + var/name = M.name + ghosts[name] = M //get the name of the mob for the popup list + if(what==1) + return ghosts + else + return mobs + + /client/proc/allow_character_respawn() set category = "Special Verbs" set name = "Allow player to respawn" set desc = "Let's the player bypass the 30 minute wait to respawn or allow them to re-enter their corpse." if(!holder) src << "Only administrators may use this command." - var/any = 0 - var/list/mobs = list() - var/list/ghosts = list() - var/list/sortmob = sortAtom(mob_list) // get the mob list. - for(var/mob/dead/observer/M in sortmob) - mobs.Add(M) //filter it where it's only ghosts - any = 1 //if no ghosts show up, any will just be 0 - if(!any) - src << "There doesn't appear to be any ghosts for you to select." - return - - for(var/mob/M in mobs) - var/name = M.name - ghosts[name] = M //get the name of the mob for the popup list + var/list/ghosts= get_ghosts(1) var/target = input("Please, select a ghost!", "COME BACK TO LIFE!", null, null) as null|anything in ghosts if(!target) @@ -268,6 +280,62 @@ Ccomp's first proc. message_admins("Admin [key_name_admin(usr)] allowed [key_name_admin(G)] to bypass the 30 minute respawn limit", 1) +/client/proc/toggle_antagHUD_use() + set category = "Server" + set name = "Toggle antagHUD usage" + set desc = "Toggles antagHUD usage for observers" + + if(!holder) + src << "Only administrators may use this command." + var/action="" + if(config.antag_hud_allowed) + for(var/mob/dead/observer/g in get_ghosts()) + if(g.antagHUD) + g.antagHUD = 0 // Disable it on those that have it enabled + g.has_enabled_antagHUD = 2 // We'll allow them to respawn + g << "\red TheAdministrator has disabled AntagHUD " + config.antag_hud_allowed = 0 + src << "\red AntagHUD usage has been disabled" + action = "disabled" + else + for(var/mob/dead/observer/g in get_ghosts()) + g << "\blue The Administrator has enabled AntagHUD " // Notify all observers they can now use AntagHUD + config.antag_hud_allowed = 1 + action = "enabled" + src << "\blue AntagHUD usage has been enabled" + + + log_admin("[key_name(usr)] has [action] antagHUD usage for observers") + message_admins("Admin [key_name_admin(usr)] has [action] antagHUD usage for observers", 1) + + + +/client/proc/toggle_antagHUD_restrictions() + set category = "Server" + set name = "Toggle antagHUD Restrictions" + set desc = "Restricts players that have used antagHUD from being able to join this round." + if(!holder) + src << "Only administrators may use this command." + var/action="" + if(config.antag_hud_restricted) + for(var/mob/dead/observer/g in get_ghosts()) + g << "\blue The administrator has lifted restrictions on joining the round if you use AntagHUD" + action = "lifted restrictions" + config.antag_hud_restricted = 0 + src << "\blue AntagHUD restrictions have been lifted" + else + for(var/mob/dead/observer/g in get_ghosts()) + g << "\red The administrator has placed restrictions on joining the round if you use AntagHUD" + g << "\red Your AntagHUD has been disabled, you may choose to re-enabled it but will be under restrictions " + g.antagHUD = 0 + g.has_enabled_antagHUD = 0 + action = "placed restrictions" + config.antag_hud_restricted = 1 + src << "\red AntagHUD restrictions have been enabled" + + log_admin("[key_name(usr)] has [action] on joining the round if they use AntagHUD") + message_admins("Admin [key_name_admin(usr)] has [action] on joining the round if they use AntagHUD", 1) + diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 9df4b8a84ca..7febbd4561c 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -79,16 +79,17 @@ Works together with spawning an observer, noted above. if(client.images.len) - for(var/image/hud in client.images) - if(copytext(hud.icon_state,1,4) == "hud") - client.images.Remove(hud) + for(var/image/hud in client.images) + if(copytext(hud.icon_state,1,4) == "hud") + client.images.Remove(hud) + var/mob/dead/observer/M = src if(M.antagHUD) - var/list/target_list = list() - for(var/mob/living/target in oview(M)) - if( target.mind&&(target.mind.special_role||issilicon(target)) ) - target_list += target - if(target_list.len) - M.assess_targets(target_list, M) + var/list/target_list = list() + for(var/mob/living/target in oview(M)) + if( target.mind&&(target.mind.special_role||issilicon(target)) ) + target_list += target + if(target_list.len) + M.assess_targets(target_list, M)