From 66e6a2dbf0d9ccc7af0cc549233fcd9c2c8222c3 Mon Sep 17 00:00:00 2001 From: carnie Date: Sun, 31 Mar 2013 11:26:22 +0100 Subject: [PATCH] Mobs each now have a unique tag which are not after they are deleted (unlike byond's \ref[] macro) Since tag replaces the output of the \ref[] macro, this means that menus which use hrefs with \ref[mob] will no longer be able to accidentally link to the wrong mob. The tags are of the form "mob_475" etc Admin_pms now use ckey instead of client-reference. This means that PMs will no longer accidentally get sent to the wrong people. There is no risk of players using hrefs to send adminhelps to known admin ckeys to see if they are online (as I'd already changed the PM system to not tell non-admin users whom received their message). key_name() now accepts text input (key or ckey) - it is slightly more efficient to feed it a client or mob however! This functionality is provided to allow certain admintools to become more robust when we want to talk about e.g. a griefer whom has just DCed whom no-longer has a corpse (no client/mob...just a ckey reference). key_name() now reports DCed players properly. --- code/__HELPERS/unsorted.dm | 26 ++-- code/modules/admin/admin.dm | 130 +++++++++--------- code/modules/admin/player_panel.dm | 81 +++++------ code/modules/admin/topic.dm | 2 +- code/modules/admin/verbs/adminpm.dm | 11 +- code/modules/client/client procs.dm | 13 +- code/modules/mob/living/carbon/human/life.dm | 8 -- .../modules/mob/living/silicon/decoy/decoy.dm | 1 + .../mob/living/silicon/pai/software.dm | 3 - code/modules/mob/login.dm | 4 +- code/modules/mob/mob.dm | 2 + code/modules/mob/new_player/new_player.dm | 1 + 12 files changed, 139 insertions(+), 143 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 353e0f46ead..7710d2cfec0 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -478,36 +478,46 @@ Turf and target are seperate in case you want to teleport some distance from a t var/mob/M var/client/C var/key + var/ckey if(!whom) return "*null*" if(istype(whom, /client)) C = whom M = C.mob key = C.key + ckey = C.ckey else if(ismob(whom)) M = whom C = M.client key = M.key - else if(istype(whom, /datum)) - var/datum/D = whom - return "*invalid:[D.type]*" + ckey = M.ckey + else if(istext(whom)) + key = whom + ckey = ckey(whom) + C = directory[ckey] + if(C) + M = C.mob else return "*invalid*" . = "" + if(!ckey) + include_link = 0 + if(key) - if(include_link && C) - . += "" - + if(include_link) + . += "" + if(C && C.holder && C.holder.fakekey && !include_name) . += "Administrator" else . += key + if(!C) + . += "\[DC\]" if(include_link) - if(C) . += "" - else . += " (DC)" + . += "" else . += "*no key*" diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 1055324f57d..d0fdbe4b182 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -17,62 +17,60 @@ var/global/floorIsLava = 0 set name = "Show Player Panel" set desc="Edit player (respawn, ban, heal, etc)" + if(!check_rights()) + return + if(!M) usr << "You seem to be selecting a mob that doesn't exist anymore." return - if (!istype(src,/datum/admins)) - src = usr.client.holder - if (!istype(src,/datum/admins)) - usr << "Error: you are not an admin!" - return var/body = "Options for [M.key]" body += "Options panel for [M]" if(M.client) body += " played by [M.client] " - body += "\[[M.client.holder ? M.client.holder.rank : "Player"]\]" + body += "\[[M.client.holder ? M.client.holder.rank : "Player"]\]" if(istype(M, /mob/new_player)) body += " Hasn't Entered Game " else - body += " \[Heal\] " + body += " \[Heal\] " body += "

\[ " body += "VV - " - body += "TP - " - body += "PM - " - body += "SM - " - body += "JMP\]
" + body += "TP - " + body += "PM - " + body += "SM - " + body += "JMP\]
" body += "Mob type = [M.type]

" - body += "Kick | " + body += "Kick | " body += "Warn | " - body += "Ban | " - body += "Jobban | " - body += "Appearance Ban | " - body += "Notes " + body += "Ban | " + body += "Jobban | " + body += "Appearance Ban | " + body += "Notes " if(M.client) - body += "| Prison | " + body += "| Prison | " var/muted = M.client.prefs.muted body += "
Mute: " - body += "\[IC | " - body += "OOC | " - body += "PRAY | " - body += "ADMINHELP | " - body += "DEADCHAT\]" - body += "(toggle all)" + body += "\[IC | " + body += "OOC | " + body += "PRAY | " + body += "ADMINHELP | " + body += "DEADCHAT\]" + body += "(toggle all)" body += "

" - body += "Jump to | " - body += "Get | " - body += "Send To" + body += "Jump to | " + body += "Get | " + body += "Send To" body += "

" - body += "Traitor panel | " - body += "Narrate to | " - body += "Subtle message" + body += "Traitor panel | " + body += "Narrate to | " + body += "Subtle message" if (M.client) if(!istype(M, /mob/new_player)) @@ -84,66 +82,66 @@ var/global/floorIsLava = 0 if(ismonkey(M)) body += "Monkeyized | " else - body += "Monkeyize | " + body += "Monkeyize | " //Corgi if(iscorgi(M)) body += "Corgized | " else - body += "Corgize | " + body += "Corgize | " //AI / Cyborg if(isAI(M)) body += "Is an AI " else if(ishuman(M)) - body += "Make AI | " - body += "Make Robot | " - body += "Make Alien | " - body += "Make Blob Fragment | " - body += "Make Slime " + body += "Make AI | " + body += "Make Robot | " + body += "Make Alien | " + body += "Make Blob Fragment | " + body += "Make Slime " //Simple Animals if(isanimal(M)) - body += "Re-Animalize | " + body += "Re-Animalize | " else - body += "Animalize | " + body += "Animalize | " body += "

" body += "Rudimentary transformation:
These transformations only create a new mob type and copy stuff over. They do not take into account MMIs and similar mob-specific things. The buttons in 'Transformations' are preferred, when possible.

" - body += "Observer | " - body += "\[ Alien: Drone, " - body += "Hunter, " - body += "Queen, " - body += "Sentinel, " - body += "Larva \] " - body += "Human " - body += "\[ slime: Baby, " - body += "Adult \] " - body += "Monkey | " - body += "Cyborg | " - body += "Cat | " - body += "Runtime | " - body += "Corgi | " - body += "Ian | " - body += "Crab | " - body += "Coffee | " - //body += "Parrot | " - //body += "Poly | " - body += "\[ Construct: Armoured , " - body += "Builder , " - body += "Wraith \] " - body += "Shade" + body += "Observer | " + body += "\[ Alien: Drone, " + body += "Hunter, " + body += "Queen, " + body += "Sentinel, " + body += "Larva \] " + body += "Human " + body += "\[ slime: Baby, " + body += "Adult \] " + body += "Monkey | " + body += "Cyborg | " + body += "Cat | " + body += "Runtime | " + body += "Corgi | " + body += "Ian | " + body += "Crab | " + body += "Coffee | " + //body += "Parrot | " + //body += "Poly | " + body += "\[ Construct: Armoured , " + body += "Builder , " + body += "Wraith \] " + body += "Shade" body += "
" if (M.client) body += "

" body += "Other actions:" body += "
" - body += "Forcesay | " - body += "Thunderdome 1 | " - body += "Thunderdome 2 | " - body += "Thunderdome Admin | " - body += "Thunderdome Observer | " + body += "Forcesay | " + body += "Thunderdome 1 | " + body += "Thunderdome 2 | " + body += "Thunderdome Admin | " + body += "Thunderdome Observer | " body += "
" body += "" diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index cc389291a3c..1fbd7a6dc39 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -1,5 +1,5 @@ /datum/admins/proc/player_panel_new()//The new one - if (!usr.client.holder) + if(!check_rights()) return var/dat = "Player Panel" @@ -65,6 +65,7 @@ clearAll(); var span = document.getElementById(id); + var ckey = key.toLowerCase().replace(/\[^a-z@0-9\]+/g,""); body = "
"; @@ -74,15 +75,15 @@ body += ""; - body += "PP - " - body += "N - " + body += "PP - " + body += "N - " body += "VV - " - body += "TP - " - body += "PM - " - body += "SM - " - body += "JMP
" + body += "TP - " + body += "PM - " + body += "SM - " + body += "JMP
" if(antagonist > 0) - body += "Antagonist"; + body += "Antagonist"; body += "
"; @@ -193,7 +194,7 @@ Player panel
- Hover over a line to see more information - Check antagonists + Hover over a line to see more information - Check antagonists

@@ -319,7 +320,7 @@ //The old one /datum/admins/proc/player_panel_old() - if (!usr.client.holder) + if(!check_rights()) return var/dat = "Player Menu" dat += "" @@ -360,16 +361,16 @@ dat += {" - - + + "} switch(is_special_character(M)) if(0) - dat += {""} + dat += {""} if(1) - dat += {""} + dat += {""} if(2) - dat += {""} + dat += {""} dat += "
NameReal NameAssigned JobKeyOptionsPMTraitor?
[(M.client ? "[M.client]" : "No client")]XPMXPMTraitor?Traitor?Traitor?Traitor?Traitor?Traitor?
" @@ -384,23 +385,23 @@ dat += "Round Duration: [round(world.time / 36000)]:[add_zero(world.time / 600 % 60, 2)]:[world.time / 100 % 6][world.time / 100 % 10]
" dat += "Emergency shuttle
" if (!emergency_shuttle.online) - dat += "Call Shuttle
" + dat += "Call Shuttle
" else var/timeleft = emergency_shuttle.timeleft() switch(emergency_shuttle.location) if(0) - dat += "ETA: [(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]
" - dat += "Send Back
" + dat += "ETA: [(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]
" + dat += "Send Back
" if(1) - dat += "ETA: [(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]
" - dat += "[ticker.delay_end ? "End Round Normally" : "Delay Round End"]
" + dat += "ETA: [(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]
" + dat += "[ticker.delay_end ? "End Round Normally" : "Delay Round End"]
" if(ticker.mode.syndicates.len) dat += "
" for(var/datum/mind/N in ticker.mode.syndicates) var/mob/M = N.current if(M) - dat += "" - dat += "" + dat += "" + dat += "" else dat += "" dat += "
Syndicates
[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]PM
[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]PM
Nuclear Operative not found!

" @@ -410,7 +411,7 @@ while(!istype(disk_loc, /turf)) if(istype(disk_loc, /mob)) var/mob/M = disk_loc - dat += "carried by [M.real_name] " + dat += "carried by [M.real_name] " if(istype(disk_loc, /obj)) var/obj/O = disk_loc dat += "in \a [O.name] " @@ -425,19 +426,19 @@ if(!M) dat += "" else - dat += "" - dat += "" + dat += "" + dat += "" for(var/datum/mind/N in ticker.mode.revolutionaries) var/mob/M = N.current if(M) - dat += "" - dat += "" + dat += "" + dat += "" dat += "
Nuclear Disk(s)
Head Revolutionary not found!
[M.real_name] (Leader)[M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]PM
[M.real_name] (Leader)[M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]PM
[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]PM
[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]PM
" for(var/datum/mind/N in ticker.mode.get_living_heads()) var/mob/M = N.current if(M) - dat += "" - dat += "" + dat += "" + dat += "" var/turf/mob_loc = get_turf_loc(M) dat += "" else @@ -449,9 +450,9 @@ for(var/datum/mind/changeling in ticker.mode.changelings) var/mob/M = changeling.current if(M) - dat += "" - dat += "" - dat += "" + dat += "" + dat += "" + dat += "" else dat += "" dat += "
Target(s)Location
[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]PM
[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]PM[mob_loc.loc]
[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]PMShow Objective
[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]PMShow Objective
Changeling not found!
" @@ -461,9 +462,9 @@ for(var/datum/mind/wizard in ticker.mode.wizards) var/mob/M = wizard.current if(M) - dat += "[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]" - dat += "PM" - dat += "Show Objective" + dat += "[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]" + dat += "PM" + dat += "Show Objective" else dat += "Wizard not found!" dat += "" @@ -473,8 +474,8 @@ for(var/datum/mind/N in ticker.mode.cult) var/mob/M = N.current if(M) - dat += "[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]" - dat += "PM" + dat += "[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]" + dat += "PM" dat += "" if(ticker.mode.traitors.len > 0) @@ -482,9 +483,9 @@ for(var/datum/mind/traitor in ticker.mode.traitors) var/mob/M = traitor.current if(M) - dat += "[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]" - dat += "PM" - dat += "Show Objective" + dat += "[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]" + dat += "PM" + dat += "Show Objective" else dat += "Traitor not found!" dat += "" diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 8462b271f1a..c78537d420e 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1343,7 +1343,7 @@ src.owner << "Name = [M.name]; Real_name = [M.real_name]; Mind_name = [M.mind?"[M.mind.name]":""]; Key = [M.key];" src.owner << "Location = [location_description];" src.owner << "[special_role_description]" - src.owner << "(PM) (PP) (VV) (SM) (JMP) (CA)" + src.owner << "(PM) (PP) (VV) (SM) (JMP) (CA)" else if(href_list["adminspawncookie"]) if(!check_rights(R_ADMIN|R_FUN)) return diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index 56f0156dce2..2445db29315 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -35,12 +35,17 @@ //takes input from cmd_admin_pm_context, cmd_admin_pm_panel or /client/Topic and sends them a PM. //Fetching a message if needed. src is the sender and C is the target client -/client/proc/cmd_admin_pm(var/client/C, var/msg) +/client/proc/cmd_admin_pm(whom, msg) if(prefs.muted & MUTE_ADMINHELP) src << "Error: Admin-PM: You are unable to use admin PM-s (muted)." return - - if(!istype(C,/client)) + + var/client/C + if(istext(whom)) + C = directory[whom] + else if(istype(whom,/client)) + C = whom + if(!C) if(holder) src << "Error: Admin-PM: Client not found." else adminhelp(msg) //admin we are replying to left. adminhelp instead return diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index e462eeb5b4b..171c31fabb9 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -29,20 +29,9 @@ return next_allowed_topic_time = world.time + TOPIC_SPAM_DELAY - //search the href for script injection - if( findtext(href,"?) (VV) (PM) (JMP)") - */ //Apparently, the person who wrote this code designed it so that //blinded get reset each cycle and then get activated later in the //code. Very ugly. I dont care. Moving this stuff here so its easy diff --git a/code/modules/mob/living/silicon/decoy/decoy.dm b/code/modules/mob/living/silicon/decoy/decoy.dm index acabb07d59d..5db44b05608 100644 --- a/code/modules/mob/living/silicon/decoy/decoy.dm +++ b/code/modules/mob/living/silicon/decoy/decoy.dm @@ -6,6 +6,7 @@ canmove = 0 /mob/living/silicon/decoy/New() + ..() src.icon = 'icons/mob/AI.dmi' src.icon_state = "ai" src.anchored = 1 diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm index 6c7956c086f..dc3bd9d0f60 100644 --- a/code/modules/mob/living/silicon/pai/software.dm +++ b/code/modules/mob/living/silicon/pai/software.dm @@ -116,9 +116,6 @@ /mob/living/silicon/pai/Topic(href, href_list) ..() - - if(href_list["priv_msg"]) // Admin-PMs were triggering the interface popup. Hopefully this will stop it. - return var/soft = href_list["software"] var/sub = href_list["sub"] if(soft) diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 1c3498802d1..0bd910cb5c3 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -17,10 +17,10 @@ spawn() alert("You have logged in already with another key this round, please log out of this one NOW or risk being banned!") if(matches) if(M.client) - message_admins("Notice: [key_name_admin(src)] has the same [matches] as [key_name_admin(M)].", 1) + message_admins("Notice: [key_name_admin(src)] has the same [matches] as [key_name_admin(M)].", 1) log_access("Notice: [key_name(src)] has the same [matches] as [key_name(M)].") else - message_admins("Notice: [key_name_admin(src)] has the same [matches] as [key_name_admin(M)] (no longer logged in). ", 1) + message_admins("Notice: [key_name_admin(src)] has the same [matches] as [key_name_admin(M)] (no longer logged in). ", 1) log_access("Notice: [key_name(src)] has the same [matches] as [key_name(M)] (no longer logged in).") /mob/Login() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index faa3d0ea514..b4c7d46ec4d 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -5,7 +5,9 @@ ghostize() ..() +var/next_mob_id = 0 /mob/New() + tag = "mob_[next_mob_id++]" mob_list += src if(stat == DEAD) dead_mob_list += src diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index f7abec2be59..ea13dccbb0e 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -15,6 +15,7 @@ anchored = 1 // don't get pushed around New() + tag = "mob_[next_mob_id++]" mob_list += src verb/new_player_panel()