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
This commit is contained in:
elly1989@rocketmail.com
2012-03-28 10:06:32 +00:00
parent 4c7d775593
commit 38a9e343a6
7 changed files with 108 additions and 82 deletions

View File

@@ -3,43 +3,34 @@
var/list/turretTargets = list() var/list/turretTargets = list()
/area/turret_protected/proc/subjectDied(target) /area/turret_protected/proc/subjectDied(target)
if (istype(target, /mob)) if( ismob(target) )
if (!istype(target, /mob/living/silicon)) if( !issilicon(target) )
if( target:stat ) if( target:stat )
if( target in turretTargets ) if( target in turretTargets )
src.Exited(target) src.Exited(target)
//TODO: make teleporting to places trigger Entered() ~Carn
/area/turret_protected/Entered(O) /area/turret_protected/Entered(O)
..() ..()
if( master && master != src ) if( master && master != src )
return master.Entered(O) return master.Entered(O)
// world << "[O] entered[src.x],[src.y],[src.z]"
if (istype(O, /mob/living/carbon)) if( iscarbon(O) )
if (!(O in turretTargets)) turretTargets |= O
turretTargets += O
else if( istype(O, /obj/mecha) ) else if( istype(O, /obj/mecha) )
var/obj/mecha/M = O var/obj/mecha/Mech = O
if (M.occupant) if( Mech.occupant )
if (!(M in turretTargets)) turretTargets |= Mech
turretTargets += M
return 1 return 1
/area/turret_protected/Exited(O) /area/turret_protected/Exited(O)
if( master && master != src ) if( master && master != src )
return master.Exited(O) 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!"
if( ismob(O) && !issilicon(O) )
turretTargets -= O
else if( istype(O, /obj/mecha) ) else if( istype(O, /obj/mecha) )
if (O in turretTargets)
turretTargets -= O turretTargets -= O
..() ..()
return 1 return 1
@@ -130,10 +121,11 @@
/obj/machinery/turret/proc/check_target(var/atom/movable/T as mob|obj) /obj/machinery/turret/proc/check_target(var/atom/movable/T as mob|obj)
if( T && T in protected_area.turretTargets ) if( T && T in protected_area.turretTargets )
if(!T in protected_area) var/area/area_T = get_area(T)
if( !area_T || (area_T.type != protected_area.type) )
protected_area.Exited(T) 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 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 var/mob/living/carbon/MC = T
if( !MC.stat ) if( !MC.stat )
if( !MC.lying || lasers ) if( !MC.lying || lasers )
@@ -325,10 +317,10 @@
if(stat & BROKEN) return if(stat & BROKEN) return
if (istype(user, /mob/living/silicon)) if (istype(user, /mob/living/silicon))
return src.attack_hand(user) 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)) if (src.allowed(usr))
locked = !locked locked = !locked
user << "You [ locked ? "lock" : "unlock"] the panel." user << "<span class='notice'>You [ locked ? "lock" : "unlock"] the panel.</span>"
if (locked) if (locked)
if (user.machine==src) if (user.machine==src)
user.machine = null user.machine = null
@@ -337,18 +329,18 @@
if (user.machine==src) if (user.machine==src)
src.attack_hand(usr) src.attack_hand(usr)
else else
user << "\red Access denied." user << "<span class='warning'>Access denied.</span>"
/obj/machinery/turretid/attack_ai(mob/user as mob) /obj/machinery/turretid/attack_ai(mob/user as mob)
if(!ailock) if(!ailock)
return attack_hand(user) return attack_hand(user)
else else
user << "There seems to be a firewall preventing you from accessing this device." user << "<span class='notice'>There seems to be a firewall preventing you from accessing this device.</span>"
/obj/machinery/turretid/attack_hand(mob/user as mob) /obj/machinery/turretid/attack_hand(mob/user as mob)
if ( (get_dist(src, user) > 1 )) if ( get_dist(src, user) > 0 )
if (!istype(user, /mob/living/silicon)) if ( !issilicon(user) )
user << text("Too far away.") user << "<span class='notice'>You are too far away.</span>"
user.machine = null user.machine = null
user << browse(null, "window=turretid") user << browse(null, "window=turretid")
return return
@@ -392,6 +384,7 @@
if (!istype(usr, /mob/living/silicon)) if (!istype(usr, /mob/living/silicon))
usr << "Control panel is locked!" usr << "Control panel is locked!"
return return
if ( get_dist(src, usr) == 0 )
if (href_list["toggleOn"]) if (href_list["toggleOn"])
src.enabled = !src.enabled src.enabled = !src.enabled
src.updateTurrets() src.updateTurrets()
@@ -404,7 +397,7 @@
if(control_area) if(control_area)
for (var/obj/machinery/turret/aTurret in get_area_all_atoms(control_area)) for (var/obj/machinery/turret/aTurret in get_area_all_atoms(control_area))
aTurret.setState(enabled, lethal) aTurret.setState(enabled, lethal)
update_icons() src.update_icons()
/obj/machinery/turretid/proc/update_icons() /obj/machinery/turretid/proc/update_icons()
if (src.enabled) if (src.enabled)
@@ -414,12 +407,14 @@
icon_state = "motion3" icon_state = "motion3"
else else
icon_state = "motion0" icon_state = "motion0"
if(control_area) //CODE FIXED BUT REMOVED
for (var/obj/machinery/turretid/aTurret in get_area_all_atoms(control_area)) // if(control_area) //USE: updates other controls in the area
aTurret.icon_state = icon_state // for (var/obj/machinery/turretid/Turret_Control in world) //I'm not sure if this is what it was
aTurret.enabled = enabled // if( Turret_Control.control_area != src.control_area ) continue //supposed to do. Or whether the person
aTurret.lethal = lethal // 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 /obj/structure/turret/gun_turret

View File

@@ -85,38 +85,57 @@
log_admin("DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]): [msg]") 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]<BR>", 1) message_admins("\blue \bold DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]): [msg]<BR>", 1)
/client/proc/cmd_admin_pm(mob/M as mob in world) /client/proc/cmd_admin_pm()
set category = "Admin" set category = "Admin"
set name = "Admin PM" set name = "Admin PM"
if(!authenticated || !holder) if(!authenticated || !holder)
src << "Only administrators may use this command." src << "Only administrators may use this command."
return return
if(M)
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
targets["[C] - [C.mob.real_name](as [C.mob.name])"] = C
else
targets["[C] - No Mob"] = C
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) if(src.muted_complete)
src << "You are muted have a nice day" src << "\red Error: Admin-PM: You are muted."
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 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))
if ( !t || !C || !C.mob ) return
//TODO: rewrite key_name() to use something other than mobs. ~CARN
if (usr.client && usr.client.holder) if (usr.client && usr.client.holder)
M << "\red Admin PM from-<b>[key_name(usr, M, 0)]</b>: [t]" C << "\red Admin PM from-<b>[key_name(usr, C.mob, 0)]</b>: [t]"
usr << "\blue Admin PM to-<b>[key_name(M, usr, 1)]</b>: [t]" src << "\blue Admin PM to-<b>[key_name(C, usr, 1)]</b>: [t]"
else else
if (M.client && M.client.holder) if (C && C.holder)
M << "\blue Reply PM from-<b>[key_name(usr, M, 1)]</b>: [t]" C << "\blue Reply PM from-<b>[key_name(usr, C.mob, 1)]</b>: [t]"
else else
M << "\red Reply PM from-<b>[key_name(usr, M, 0)]</b>: [t]" C << "\red Reply PM from-<b>[key_name(usr, C.mob, 0)]</b>: [t]"
usr << "\blue Reply PM to-<b>[key_name(M, usr, 0)]</b>: [t]" src << "\blue Reply PM to-<b>[key_name(C.mob, usr, 0)]</b>: [t]"
log_admin("PM: [key_name(usr)]->[key_name(M)] : [t]") log_admin("PM: [key_name(usr)]->[key_name(C.mob)] : [t]")
for(var/mob/K in world) //we don't use message_admins here because the sender/receiver might get it too for(var/client/X) //there are fewer clients than mobs
if(K && K.client && K.client.holder && K.key != usr.key && K.key != M.key) if(X.holder && X.key!=usr.key && X.key!=C.key) //check client/X is an admin and isn't the sender or recipient
K << "<B><font color='blue'>PM: [key_name(usr, K)]-&gt;[key_name(M, K)]:</B> \blue [t]</font>" var/mob/K = X.mob //get X's mob
if(K)
K << "<B><font color='blue'>PM: [key_name(usr, K)]-&gt;[key_name(C.mob, K)]:</B> \blue [t]</font>" //inform X
/client/proc/cmd_admin_godmode(mob/M as mob in world) /client/proc/cmd_admin_godmode(mob/M as mob in world)
set category = "Special Verbs" set category = "Special Verbs"

View File

@@ -37,7 +37,7 @@
msg += "</span>" msg += "</span>"
if (src.digitalcamo) if (src.digitalcamo)
msg += "It looks replusingly uncanny!\n" msg += "It is repulsively uncanny!\n"
msg += "*---------*</span>" msg += "*---------*</span>"

View File

@@ -631,9 +631,10 @@
src.client << "\red Admin-player or player-admin conversation only!" src.client << "\red Admin-player or player-admin conversation only!"
return. return.
var/t = input("Message:", text("Private message to [C.key]")) as text|null //get message text, limit it's length.and clean/escape html
if (!t || !usr || !C || !usr.client) var/t = input("Message:", "Private message to [C.key]") as text|null
return t = sanitize( copytext(t,1,500) )
if (!t || !usr || !C || !usr.client) return
if (usr.client && usr.client.holder) //Admin is messaging a player if (usr.client && usr.client.holder) //Admin is messaging a player
C << "\red <font size='4'><b>-- Administrator private message --</b></font>" C << "\red <font size='4'><b>-- Administrator private message --</b></font>"
C << "<b>[key_name(usr.client, C, 0)] [t]</b>" C << "<b>[key_name(usr.client, C, 0)] [t]</b>"

View File

@@ -233,6 +233,9 @@
else if(!href_list["late_join"]) else if(!href_list["late_join"])
new_player_panel() new_player_panel()
if(href_list["priv_msg"])
..() //pass PM calls along to /mob/Topic
return
proc/IsJobAvailable(rank) proc/IsJobAvailable(rank)
var/datum/job/job = job_master.GetJob(rank) var/datum/job/job = job_master.GetJob(rank)

View File

@@ -92,6 +92,14 @@ should be listed in the changelog upon commit tho. Thanks. -->
<!-- To take advantage of the pretty new format (well it was new when I wrote this anyway), open the "add-to-changelog.html" file in any browser and add the stuff and then generate the html code and paste it here --> <!-- To take advantage of the pretty new format (well it was new when I wrote this anyway), open the "add-to-changelog.html" file in any browser and add the stuff and then generate the html code and paste it here -->
<div class="commit sansserif">
<h2 class="date">28 March 2012</h2>
<h3 class="author">Carn updated:</h3>
<ul class="changes bgimages16">
<li class="bugfix">Fixed turrets shooting people that leave the area and the telecomm turret controls.</li>
</ul>
</div>
<div class="commit sansserif"> <div class="commit sansserif">
<h2 class="date">27 March 2012</h2> <h2 class="date">27 March 2012</h2>
<h3 class="author">Nodrak updated:</h3> <h3 class="author">Nodrak updated:</h3>