From 38a9e343a68b5d4ed2eb0b74d87de0a05afd590a Mon Sep 17 00:00:00 2001 From: "elly1989@rocketmail.com" Date: Wed, 28 Mar 2012 10:06:32 +0000 Subject: [PATCH] Fixes Issue 441 (it was a typo) Fixes Issue 424 (it was some code in turrets.dm which was setting all the turret controls in the lobby area to off...for no raisin.) Admins can now PM people in the lobby Admin-PM verb now uses clients instead of mobs Removed a vulnerability in the PM system that allowed unauthorised access to a select few admin-tools. Text changes in examine verbs for monkeys and humans (typos) git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3366 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/machinery/turrets.dm | 101 +++++++++--------- code/modules/admin/verbs/randomverbs.dm | 67 +++++++----- .../mob/living/carbon/human/examine.dm | 2 +- .../mob/living/carbon/monkey/examine.dm | 2 +- code/modules/mob/mob.dm | 7 +- code/modules/mob/new_player/new_player.dm | 3 + html/changelog.html | 8 ++ 7 files changed, 108 insertions(+), 82 deletions(-) diff --git a/code/game/machinery/turrets.dm b/code/game/machinery/turrets.dm index ccc0e3247ad..fc8657b5a0a 100644 --- a/code/game/machinery/turrets.dm +++ b/code/game/machinery/turrets.dm @@ -3,44 +3,35 @@ var/list/turretTargets = list() /area/turret_protected/proc/subjectDied(target) - if (istype(target, /mob)) - if (!istype(target, /mob/living/silicon)) - if (target:stat) - if (target in turretTargets) + if( ismob(target) ) + if( !issilicon(target) ) + if( target:stat ) + if( target in turretTargets ) src.Exited(target) +//TODO: make teleporting to places trigger Entered() ~Carn /area/turret_protected/Entered(O) ..() - if(master && master != src) + if( master && master != src ) return master.Entered(O) -// world << "[O] entered[src.x],[src.y],[src.z]" - if (istype(O, /mob/living/carbon)) - if (!(O in turretTargets)) - turretTargets += O - else if (istype(O, /obj/mecha)) - var/obj/mecha/M = O - if (M.occupant) - if (!(M in turretTargets)) - turretTargets += M + if( iscarbon(O) ) + turretTargets |= O + else if( istype(O, /obj/mecha) ) + var/obj/mecha/Mech = O + if( Mech.occupant ) + turretTargets |= Mech return 1 /area/turret_protected/Exited(O) - if(master && master != src) + if( master && master != src ) return master.Exited(O) -// world << "[O] exited [src.x],[src.y],[src.z]" - if (istype(O, /mob)) - if (!istype(O, /mob/living/silicon)) - if (O in turretTargets) - //O << "removing you from target list" - turretTargets -= O - //else - //O << "You aren't in our target list!" - else if (istype(O, /obj/mecha)) - if (O in turretTargets) - turretTargets -= O + if( ismob(O) && !issilicon(O) ) + turretTargets -= O + else if( istype(O, /obj/mecha) ) + turretTargets -= O ..() return 1 @@ -129,18 +120,19 @@ return /obj/machinery/turret/proc/check_target(var/atom/movable/T as mob|obj) - if(T && T in protected_area.turretTargets) - if(!T in protected_area) + if( T && T in protected_area.turretTargets ) + var/area/area_T = get_area(T) + if( !area_T || (area_T.type != protected_area.type) ) protected_area.Exited(T) return 0 //If the guy is somehow not in the turret's area (teleportation), get them out the damn list. --NEO - if(istype(T, /mob/living/carbon)) + if( iscarbon(T) ) var/mob/living/carbon/MC = T - if(!MC.stat) - if(!MC.lying || lasers) + if( !MC.stat ) + if( !MC.lying || lasers ) return 1 - else if(istype(T, /obj/mecha)) + else if( istype(T, /obj/mecha) ) var/obj/mecha/ME = T - if(ME.occupant) + if( ME.occupant ) return 1 return 0 @@ -325,10 +317,10 @@ if(stat & BROKEN) return if (istype(user, /mob/living/silicon)) return src.attack_hand(user) - else // trying to unlock the interface + else if( get_dist(src, user) == 0 ) // trying to unlock the interface if (src.allowed(usr)) locked = !locked - user << "You [ locked ? "lock" : "unlock"] the panel." + user << "You [ locked ? "lock" : "unlock"] the panel." if (locked) if (user.machine==src) user.machine = null @@ -337,18 +329,18 @@ if (user.machine==src) src.attack_hand(usr) else - user << "\red Access denied." + user << "Access denied." /obj/machinery/turretid/attack_ai(mob/user as mob) if(!ailock) return attack_hand(user) else - user << "There seems to be a firewall preventing you from accessing this device." + user << "There seems to be a firewall preventing you from accessing this device." /obj/machinery/turretid/attack_hand(mob/user as mob) - if ( (get_dist(src, user) > 1 )) - if (!istype(user, /mob/living/silicon)) - user << text("Too far away.") + if ( get_dist(src, user) > 0 ) + if ( !issilicon(user) ) + user << "You are too far away." user.machine = null user << browse(null, "window=turretid") return @@ -392,19 +384,20 @@ if (!istype(usr, /mob/living/silicon)) usr << "Control panel is locked!" return - if (href_list["toggleOn"]) - src.enabled = !src.enabled - src.updateTurrets() - else if (href_list["toggleLethal"]) - src.lethal = !src.lethal - src.updateTurrets() + if ( get_dist(src, usr) == 0 ) + if (href_list["toggleOn"]) + src.enabled = !src.enabled + src.updateTurrets() + else if (href_list["toggleLethal"]) + src.lethal = !src.lethal + src.updateTurrets() src.attack_hand(usr) /obj/machinery/turretid/proc/updateTurrets() if(control_area) for (var/obj/machinery/turret/aTurret in get_area_all_atoms(control_area)) aTurret.setState(enabled, lethal) - update_icons() + src.update_icons() /obj/machinery/turretid/proc/update_icons() if (src.enabled) @@ -414,12 +407,14 @@ icon_state = "motion3" else icon_state = "motion0" - if(control_area) - for (var/obj/machinery/turretid/aTurret in get_area_all_atoms(control_area)) - aTurret.icon_state = icon_state - aTurret.enabled = enabled - aTurret.lethal = lethal - + //CODE FIXED BUT REMOVED +// if(control_area) //USE: updates other controls in the area +// for (var/obj/machinery/turretid/Turret_Control in world) //I'm not sure if this is what it was +// if( Turret_Control.control_area != src.control_area ) continue //supposed to do. Or whether the person +// Turret_Control.icon_state = icon_state //who coded it originally was just tired +// Turret_Control.enabled = enabled //or something. I don't see any situation +// Turret_Control.lethal = lethal //in which this would be used on the current map. + //If he wants it back he can uncomment it /obj/structure/turret/gun_turret diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index b53867a6574..f927b54b5ca 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -85,38 +85,57 @@ log_admin("DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]): [msg]") message_admins("\blue \bold DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]): [msg]
", 1) -/client/proc/cmd_admin_pm(mob/M as mob in world) +/client/proc/cmd_admin_pm() set category = "Admin" set name = "Admin PM" if(!authenticated || !holder) src << "Only administrators may use this command." return - if(M) - if(src.muted_complete) - src << "You are muted have a nice day" - return - if (!( ismob(M) )) - return - var/t = input("Message:", text("Private message to [M.key]")) as text|null - if(holder.rank != "Game Admin" && holder.rank != "Game Master") - t = strip_html(t,500) - if (!( t )) - return - if (usr.client && usr.client.holder) - M << "\red Admin PM from-[key_name(usr, M, 0)]: [t]" - usr << "\blue Admin PM to-[key_name(M, usr, 1)]: [t]" - else - if (M.client && M.client.holder) - M << "\blue Reply PM from-[key_name(usr, M, 1)]: [t]" + + var/list/client/targets[0] + for(var/client/C) + if(C.mob) + if(istype(C.mob, /mob/new_player)) + targets["[C] - (New Player)"] = C + else if(istype(C.mob, /mob/dead/observer)) + targets["[C] - [C.mob.name](Ghost)"] = C else - M << "\red Reply PM from-[key_name(usr, M, 0)]: [t]" - usr << "\blue Reply PM to-[key_name(M, usr, 0)]: [t]" + targets["[C] - [C.mob.real_name](as [C.mob.name])"] = C + else + targets["[C] - No Mob"] = C - log_admin("PM: [key_name(usr)]->[key_name(M)] : [t]") + var/target = input(usr,"To whom shall we send a message?","Admin PM",null) in targets + var/client/C = targets[target] + if( !C || !istype(C,/client) ) + src << "\red Error: Admin-PM: Client not found." + return + if(src.muted_complete) + src << "\red Error: Admin-PM: You are muted." + return + var/t = input("Message:", "Private message to [C.key]") as text|null + if( !(holder.rank in list("Game Admin", "Game Master")) ) + t = sanitize(copytext(t,1,500)) - for(var/mob/K in world) //we don't use message_admins here because the sender/receiver might get it too - if(K && K.client && K.client.holder && K.key != usr.key && K.key != M.key) - K << "PM: [key_name(usr, K)]->[key_name(M, K)]: \blue [t]" + if ( !t || !C || !C.mob ) return + + //TODO: rewrite key_name() to use something other than mobs. ~CARN + if (usr.client && usr.client.holder) + C << "\red Admin PM from-[key_name(usr, C.mob, 0)]: [t]" + src << "\blue Admin PM to-[key_name(C, usr, 1)]: [t]" + else + if (C && C.holder) + C << "\blue Reply PM from-[key_name(usr, C.mob, 1)]: [t]" + else + C << "\red Reply PM from-[key_name(usr, C.mob, 0)]: [t]" + src << "\blue Reply PM to-[key_name(C.mob, usr, 0)]: [t]" + + log_admin("PM: [key_name(usr)]->[key_name(C.mob)] : [t]") + + for(var/client/X) //there are fewer clients than mobs + if(X.holder && X.key!=usr.key && X.key!=C.key) //check client/X is an admin and isn't the sender or recipient + var/mob/K = X.mob //get X's mob + if(K) + K << "PM: [key_name(usr, K)]->[key_name(C.mob, K)]: \blue [t]" //inform X /client/proc/cmd_admin_godmode(mob/M as mob in world) set category = "Special Verbs" diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 62f3d883200..a77437b335c 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -187,7 +187,7 @@ foundghost++ break if(!foundghost) - msg += "and [t_his] soul has departed" + msg += " and [t_his] soul has departed" msg += "...\n" else diff --git a/code/modules/mob/living/carbon/monkey/examine.dm b/code/modules/mob/living/carbon/monkey/examine.dm index 2a096cb755a..b1583999645 100644 --- a/code/modules/mob/living/carbon/monkey/examine.dm +++ b/code/modules/mob/living/carbon/monkey/examine.dm @@ -37,7 +37,7 @@ msg += "" if (src.digitalcamo) - msg += "It looks replusingly uncanny!\n" + msg += "It is repulsively uncanny!\n" msg += "*---------*" diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index b82e8a79947..dcecf90e662 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -631,9 +631,10 @@ src.client << "\red Admin-player or player-admin conversation only!" return. - var/t = input("Message:", text("Private message to [C.key]")) as text|null - if (!t || !usr || !C || !usr.client) - return + //get message text, limit it's length.and clean/escape html + var/t = input("Message:", "Private message to [C.key]") as text|null + t = sanitize( copytext(t,1,500) ) + if (!t || !usr || !C || !usr.client) return if (usr.client && usr.client.holder) //Admin is messaging a player C << "\red -- Administrator private message --" C << "[key_name(usr.client, C, 0)] [t]" diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 2aed4c852b6..82a5de69434 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -233,6 +233,9 @@ else if(!href_list["late_join"]) new_player_panel() + if(href_list["priv_msg"]) + ..() //pass PM calls along to /mob/Topic + return proc/IsJobAvailable(rank) var/datum/job/job = job_master.GetJob(rank) diff --git a/html/changelog.html b/html/changelog.html index 7dd9042e528..b0db5dfe681 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -92,6 +92,14 @@ should be listed in the changelog upon commit tho. Thanks. --> +
+

28 March 2012

+

Carn updated:

+ +
+

27 March 2012

Nodrak updated: