From 8658a64dc3a87ac65f6cfc2e1e5ab2c022a35579 Mon Sep 17 00:00:00 2001 From: "sieve32@gmail.com" Date: Tue, 31 Jul 2012 02:02:30 +0000 Subject: [PATCH] -Redid admin_list to be based off clients rather than mobs (Why I did it with mobs first, I'll never know). This fixes AdminWho and Asay and such not working pre-game. -Added in the proper list stuff for changeling stasis -Added a verb to the debug list (Game Admin+) to check the mob lists instead of requiring the item (Works the same way) Fixes Issue 708 git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4240 316c924e-a436-60f5-8080-3fe189b3f50e --- code/datums/helper_datums/tension.dm | 5 ++-- code/defines/procs/global_lists.dm | 27 ++++++++----------- code/defines/procs/statistics.dm | 4 +-- .../gamemodes/changeling/changeling_powers.dm | 3 +++ code/game/verbs/who.dm | 26 +++++++++--------- code/modules/admin/admin.dm | 16 +++++------ code/modules/admin/admin_verbs.dm | 16 ++++++----- code/modules/admin/verbs/adminsay.dm | 6 ++--- code/modules/admin/verbs/debug.dm | 21 ++++++++++++++- code/modules/admin/verbs/pray.dm | 14 +++++----- code/modules/admin/verbs/striketeam.dm | 4 +-- .../admin/verbs/striketeam_syndicate.dm | 4 +-- code/modules/client/client procs.dm | 6 +++-- code/modules/mob/login.dm | 4 +-- code/modules/mob/logout.dm | 1 - code/modules/mob/new_player/login.dm | 2 -- 16 files changed, 87 insertions(+), 72 deletions(-) diff --git a/code/datums/helper_datums/tension.dm b/code/datums/helper_datums/tension.dm index 87213afdcce..e735fa0d28e 100644 --- a/code/datums/helper_datums/tension.dm +++ b/code/datums/helper_datums/tension.dm @@ -101,9 +101,8 @@ var/global/datum/tension/tension_master if(forcenexttick) forcenexttick = 0 - for (var/mob/M in admin_list) - if (M.client) - M << " The tensioner wishes to create additional antagonists! Press (this) in 60 seconds to abort!" + for (var/client/C in admin_list) + C << " The tensioner wishes to create additional antagonists! Press (this) in 60 seconds to abort!" spawn(600) if(!supress) diff --git a/code/defines/procs/global_lists.dm b/code/defines/procs/global_lists.dm index d1eee8028b4..e22f6cfa3f8 100644 --- a/code/defines/procs/global_lists.dm +++ b/code/defines/procs/global_lists.dm @@ -24,9 +24,9 @@ proc/make_player_list()//Global proc that rebuilds the player list proc/make_admin_list()//Rebuild that shit to try and avoid issues with stealthmins admin_list = list() - for(var/mob/M in player_list) - if(M.client && M.client.holder) - admin_list += M + for(var/client/C in client_list) + if(C && C.holder) + admin_list += C proc/make_mob_list() for(var/mob/p in mob_list) @@ -67,14 +67,14 @@ proc/rebuild_mob_lists() mob_list += M if(M.client) player_list += M - if(M.client.holder) - admin_list += M if(M.stat != DEAD) living_mob_list += M else dead_mob_list += M for(var/client/C) client_list += C.ckey + if(C.holder) + admin_list += C proc/add_to_mob_list(var/mob/A)//Adds an individual mob if(A) @@ -83,10 +83,8 @@ proc/add_to_mob_list(var/mob/A)//Adds an individual mob dead_mob_list |= A if(A.stat != 2) living_mob_list |= A - if(A.client) - player_list |= A - if(A.client.holder) - admin_list |= A +// if(A.client) +// player_list |= A proc/remove_from_mob_list(var/mob/R)//Removes an individual mob mob_list -= R @@ -94,11 +92,8 @@ proc/remove_from_mob_list(var/mob/R)//Removes an individual mob dead_mob_list -= R if(R.stat != 2) living_mob_list -= R - if(R.client) - player_list -= R - if(R.client.holder) - admin_list -= R - +// if(R.client) +// player_list -= R proc/make_client_list()//Rebuilds client list for(var/mob/c in client_list) @@ -110,7 +105,7 @@ proc/make_client_list()//Rebuilds client list -/obj/item/listdebug//Quick debugger for the global lists +/*/obj/item/listdebug//Quick debugger for the global lists icon = 'icons/obj/assemblies.dmi' icon_state = "radio-igniter-tank" @@ -127,4 +122,4 @@ proc/make_client_list()//Rebuilds client list if("Dead Mobs") usr << dd_list2text(dead_mob_list,",") if("Clients") - usr << dd_list2text(client_list,",") \ No newline at end of file + usr << dd_list2text(client_list,",")*/ \ No newline at end of file diff --git a/code/defines/procs/statistics.dm b/code/defines/procs/statistics.dm index 8dbdff063c6..bf4caa111c0 100644 --- a/code/defines/procs/statistics.dm +++ b/code/defines/procs/statistics.dm @@ -22,8 +22,8 @@ proc/sql_poll_admins() if(!sqllogging) return var/admincount = 0 - for (var/mob/M in admin_list) - if(M && M.client) + for (var/client/C in admin_list) + if(C) admincount += 1 var/DBConnection/dbcon = new() dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") diff --git a/code/game/gamemodes/changeling/changeling_powers.dm b/code/game/gamemodes/changeling/changeling_powers.dm index c29df024cbb..8babf6c6965 100644 --- a/code/game/gamemodes/changeling/changeling_powers.dm +++ b/code/game/gamemodes/changeling/changeling_powers.dm @@ -564,6 +564,9 @@ Tarjan shit, not recoding this -Sieve{R}*/ L.tod = worldtime2text() spawn(1200) + if(L.stat == 2) + dead_mob_list -= L + living_mob_list += L L.stat = 0 //usr.fireloss = 0 L.tod = null diff --git a/code/game/verbs/who.dm b/code/game/verbs/who.dm index f15784b766d..102d7236ab8 100644 --- a/code/game/verbs/who.dm +++ b/code/game/verbs/who.dm @@ -10,9 +10,9 @@ proc/get_all_clients() proc/get_all_admin_clients() var/list/client/clients = list() - for (var/mob/M in admin_list) + for (var/client/C in admin_list) - clients += M.client + clients += C return clients @@ -44,17 +44,17 @@ proc/get_all_admin_clients() usr << "Current Admins:" - for (var/mob/M in admin_list) - if(M && M.client && M.client.holder) + for (var/client/C in admin_list) + if(C && C.holder) if(usr.client && usr.client.holder) var/afk = 0 - if( M.client.inactivity > AFK_THRESHOLD ) //When I made this, the AFK_THRESHOLD was 3000ds = 300s = 5m, see setup.dm for the new one. + if(C.inactivity > AFK_THRESHOLD ) //When I made this, the AFK_THRESHOLD was 3000ds = 300s = 5m, see setup.dm for the new one. afk = 1 - if(isobserver(M)) - usr << "[M.key] is a [M.client.holder.rank][M.client.stealth ? " (as [M.client.fakekey])" : ""] - Observing [afk ? "(AFK)" : ""]" - else if(istype(M,/mob/new_player)) - usr << "[M.key] is a [M.client.holder.rank][M.client.stealth ? " (as [M.client.fakekey])" : ""] - Has not entered [afk ? "(AFK)" : ""]" - else if(istype(M,/mob/living)) - usr << "[M.key] is a [M.client.holder.rank][M.client.stealth ? " (as [M.client.fakekey])" : ""] - Playing [afk ? "(AFK)" : ""]" - else if(!M.client.stealth) - usr << "\t[M.client] is a [M.client.holder.rank]" + if(isobserver(C.mob)) + usr << "[C] is a [C.holder.rank][C.stealth ? " (as [C.fakekey])" : ""] - Observing [afk ? "(AFK)" : ""]" + else if(istype(C.mob,/mob/new_player)) + usr << "[C] is a [C.holder.rank][C.stealth ? " (as [C.fakekey])" : ""] - Has not entered [afk ? "(AFK)" : ""]" + else if(istype(C.mob,/mob/living)) + usr << "[C] is a [C.holder.rank][C.stealth ? " (as [C.fakekey])" : ""] - Playing [afk ? "(AFK)" : ""]" + else if(!C.stealth) + usr << "\t[C] is a [C.holder.rank]" diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index fa592f7b6c5..2bdc81693e8 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -6,14 +6,14 @@ var/global/BSACooldown = 0 /proc/message_admins(var/text, var/admin_ref = 0, var/admin_holder_ref = 0) var/rendered = "ADMIN LOG: [text]" log_adminwarn(rendered) - for (var/mob/M in admin_list) - if (M) + for (var/client/C in admin_list) + if (C) var/msg = rendered if (admin_ref) - msg = dd_replaceText(msg, "%admin_ref%", "\ref[M]") - if (admin_holder_ref && M.client.holder) - msg = dd_replaceText(msg, "%holder_ref%", "\ref[M.client.holder]") - M << msg + msg = dd_replaceText(msg, "%admin_ref%", "\ref[C]") + if (admin_holder_ref && C.holder) + msg = dd_replaceText(msg, "%holder_ref%", "\ref[C.holder]") + C << msg /obj/admins/Topic(href, href_list) @@ -1454,7 +1454,7 @@ var/global/BSACooldown = 0 log_admin("[key_name(usr)] has removed [C]'s adminship") message_admins("[key_name_admin(usr)] has removed [C]'s adminship", 1) admins.Remove(C.ckey) - admin_list -= C.mob + admin_list -= C else if(C == owner) //no promoting/demoting yourself message_admins("[C] tried to change their own admin-rank >:(") @@ -1464,7 +1464,7 @@ var/global/BSACooldown = 0 log_admin("[key_name(usr)] has made [C] a [rank]") message_admins("[key_name_admin(usr)] has made [C] a [rank]", 1) admins[C.ckey] = rank - admin_list |= C.mob + admin_list |= C if (href_list["object_list"]) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 28874a0bf71..8f8d0d7389f 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -281,6 +281,7 @@ verbs += /client/proc/cinematic //show a cinematic sequence verbs += /client/proc/startSinglo //Used to prevent the station from losing power while testing stuff out. verbs += /client/proc/toggle_log_hrefs + verbs += /client/proc/cmd_debug_mob_lists else return return @@ -430,6 +431,7 @@ verbs -= /client/proc/kill_airgroup verbs -= /client/proc/debug_master_controller verbs -= /client/proc/check_ai_laws + verbs -= /client/proc/cmd_debug_mob_lists return @@ -475,13 +477,13 @@ /client/proc/get_admin_state() set name = "Get Admin State" set category = "Debug" - for(var/mob/M in admin_list) - if(M.client.holder.state == 1) - src << "[M.key] is playing - [M.client.holder.state]" - else if(M.client.holder.state == 2) - src << "[M.key] is observing - [M.client.holder.state]" + for(var/client/C in admin_list) + if(C.holder.state == 1) + src << "[C.key] is playing - [C.holder.state]" + else if(C.holder.state == 2) + src << "[C.key] is observing - [C.holder.state]" else - src << "[M.key] is undefined - [M.client.holder.state]" + src << "[C.key] is undefined - [C.holder.state]" feedback_add_details("admin_verb","GAS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -751,7 +753,7 @@ src.clear_admin_verbs() src.update_admins(null) admins.Remove(src.ckey) - admin_list -= src.mob + admin_list -= src usr << "You are now a normal player." feedback_add_details("admin_verb","DAS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/admin/verbs/adminsay.dm b/code/modules/admin/verbs/adminsay.dm index 5159a4c5019..73756fc80a4 100644 --- a/code/modules/admin/verbs/adminsay.dm +++ b/code/modules/admin/verbs/adminsay.dm @@ -22,9 +22,9 @@ return feedback_add_details("admin_verb","M") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - for (var/mob/M in admin_list) + for (var/client/C in admin_list) if (src.holder.rank == "Admin Observer") - M << "ADMIN: [key_name(usr, M)]: [msg]" + C << "ADMIN: [key_name(usr, C)]: [msg]" else - M << "ADMIN: [key_name(usr, M)] (JMP): [msg]" + C << "ADMIN: [key_name(usr, C)] (JMP): [msg]" diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 3e12cb8561e..3abb7fbf7a6 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -820,4 +820,23 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that for(var/obj/machinery/power/smes/SMES in world) if(SMES.anchored) - SMES.chargemode = 1 \ No newline at end of file + SMES.chargemode = 1 + +/client/proc/cmd_debug_mob_lists() + set category = "Debug" + set name = "Debug Mob Lists" + set desc = "For when you just gotta know" + + switch(input("Which list?") in list("Players","Admins","Mobs","Living Mobs","Dead Mobs", "Clients")) + if("Players") + usr << dd_list2text(player_list,",") + if("Admins") + usr << dd_list2text(admin_list,",") + if("Mobs") + usr << dd_list2text(mob_list,",") + if("Living Mobs") + usr << dd_list2text(living_mob_list,",") + if("Dead Mobs") + usr << dd_list2text(dead_mob_list,",") + if("Clients") + usr << dd_list2text(client_list,",") diff --git a/code/modules/admin/verbs/pray.dm b/code/modules/admin/verbs/pray.dm index 925265b2e42..615253c1045 100644 --- a/code/modules/admin/verbs/pray.dm +++ b/code/modules/admin/verbs/pray.dm @@ -16,9 +16,9 @@ var/icon/cross = icon('icons/obj/storage.dmi',"bible") - for (var/mob/M in admin_list) - if (M.client.seeprayers) - M << "\blue \icon[cross] PRAY: [key_name(src, M)] (?) (PP) (VV) (SM) (JMP) (CA) (SC): [msg]" + for (var/client/C in admin_list) + if (C.seeprayers) + C << "\blue \icon[cross] PRAY: [key_name(src, C)] (?) (PP) (VV) (SM) (JMP) (CA) (SC): [msg]" usr << "Your prayers have been received by the gods." feedback_add_details("admin_verb","PR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -31,8 +31,8 @@ // log_admin("[key_name(Sender)] sent a message to Centcomm! The message was [msg]") // Handled somewhere else - for (var/mob/M in admin_list) - M << "\blue CENTCOMM:[key_name(Sender, M)] (PP) (VV) (SM) (JMP) (CA) (BSA) (RPLY): [msg]" + for (var/client/C in admin_list) + C << "\blue CENTCOMM:[key_name(Sender, C)] (PP) (VV) (SM) (JMP) (CA) (BSA) (RPLY): [msg]" // /proc/Syndicate_announce(var/text , var/mob/Sender) @@ -40,6 +40,6 @@ // log_admin("[key_name(Sender)] sent a message to the Syndicate! The message was [msg]") // Handled somewhere else - for (var/mob/M in admin_list) - M << "\blue SYNDICATE:[key_name(Sender, M)] (PP) (VV) (SM) (JMP) (CA) (BSA) (RPLY): [msg]" + for (var/client/C in admin_list) + C << "\blue SYNDICATE:[key_name(Sender, C)] (PP) (VV) (SM) (JMP) (CA) (BSA) (RPLY): [msg]" // diff --git a/code/modules/admin/verbs/striketeam.dm b/code/modules/admin/verbs/striketeam.dm index a5199e835fa..30ce8900448 100644 --- a/code/modules/admin/verbs/striketeam.dm +++ b/code/modules/admin/verbs/striketeam.dm @@ -54,10 +54,10 @@ var/global/sent_strike_team = 0 var/mob/dead/observer/G//Basic variable to search for later. var/candidates_list[] = list()//candidates for being a commando out of all the active ghosts in world. var/commandos_list[] = list()//actual commando ghosts as picked by the user. - for(G in admin_list) + for(G in dead_mob_list) if(!G.client.holder && ((G.client.inactivity/10)/60) <= 5) //Whoever called/has the proc won't be added to the list. // if(((G.client.inactivity/10)/60) <= 5) //Removing it allows even the caller to jump in. Good for testing. - candidates_list += G.client//Add their client to list. + candidates_list += G//Add their client to list. for(var/i=commandos_possible,(i>0&&candidates_list.len),i--)//Decrease with every commando selected. var/client/G_client = input("Pick characters to spawn as the commandos. This will go on until there either no more ghosts to pick from or the slots are full.", "Active Players") as null|anything in candidates_list//It will auto-pick a person when there is only one candidate. if(G_client)//They may have logged out when the admin was choosing people. Or were not chosen. Would run time error otherwise. diff --git a/code/modules/admin/verbs/striketeam_syndicate.dm b/code/modules/admin/verbs/striketeam_syndicate.dm index 487d31ec6cd..682fd97446d 100644 --- a/code/modules/admin/verbs/striketeam_syndicate.dm +++ b/code/modules/admin/verbs/striketeam_syndicate.dm @@ -54,10 +54,10 @@ var/global/sent_syndicate_strike_team = 0 var/mob/dead/observer/G//Basic variable to search for later. var/candidates_list[] = list()//candidates for being a commando out of all the active ghosts in world. var/syndicate_commandos_list[] = list()//actual commando ghosts as picked by the user. - for(G in admin_list) + for(G in dead_mob_list) if(!G.client.holder && ((G.client.inactivity/10)/60) <= 5) //Whoever called/has the proc won't be added to the list. // if(((G.client.inactivity/10)/60) <= 5) //Removing it allows even the caller to jump in. Good for testing. - candidates_list += G.client//Add their client to list. + candidates_list += G//Add their client to list. for(var/i=syndicate_commandos_possible,(i>0&&candidates_list.len),i--)//Decrease with every commando selected. var/client/G_client = input("Pick characters to spawn as the commandos. This will go on until there either no more ghosts to pick from or the slots are full.", "Active Players") as null|anything in candidates_list//It will auto-pick a person when there is only one candidate. if(G_client)//They may have logged out when the admin was choosing people. Or were not chosen. Would run time error otherwise. diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index deec3507c8c..6790381bdba 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -90,7 +90,7 @@ if( connection != "seeker" ) del(src) return - client_list |= src + client_list += src if ( (world.address == address || !address) && !host ) host = key world.update_status() @@ -103,7 +103,9 @@ if( ckey in admins ) holder = new /obj/admins(src) holder.rank = admins[ckey] + admin_list += src update_admins(admins[ckey]) + admin_memo_show() @@ -111,10 +113,10 @@ //DISCONNECT// ////////////// /client/Del() - client_list.Remove(ckey) spawn(0) if(holder) + admin_list -= src del(holder) client_list -= src return ..() diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index f70e7cf2a15..0f2296958ec 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -23,9 +23,7 @@ log_access("Notice: [key_name(src)] has the same [matches] as [key_name(M)] (no longer logged in).") /mob/Login() - player_list |= list(src) - if(client.holder) - admin_list |= list(src) + player_list |= src update_Login_details() world.update_status() client.images = null //remove the images such as AIs being unable to see runes diff --git a/code/modules/mob/logout.dm b/code/modules/mob/logout.dm index 7b86c6e1fa2..c1d2c3588a4 100644 --- a/code/modules/mob/logout.dm +++ b/code/modules/mob/logout.dm @@ -1,6 +1,5 @@ /mob/Logout() player_list -= src - admin_list -= src log_access("Logout: [key_name(src)]") if (admins[src.ckey]) if (ticker && ticker.current_state == GAME_STATE_PLAYING) //Only report this stuff if we are currently playing. diff --git a/code/modules/mob/new_player/login.dm b/code/modules/mob/new_player/login.dm index 9fa0a180a53..71bcfa66e75 100644 --- a/code/modules/mob/new_player/login.dm +++ b/code/modules/mob/new_player/login.dm @@ -20,8 +20,6 @@ sight |= SEE_TURFS player_list |= src - if(src.client.holder) - admin_list |= src var/list/watch_locations = list() for(var/obj/effect/landmark/landmark in world)