Added a quick adjacent check for alt-clicking

Since we really don't need to be doing a pathing check when we just want to return an object list.
This commit is contained in:
Loganbacca
2014-05-14 19:59:40 +12:00
parent bb33eddb63
commit 9731082e3e
2 changed files with 16 additions and 1 deletions

View File

@@ -55,6 +55,21 @@
return 1 // we don't care about our own density return 1 // we don't care about our own density
return 0 return 0
/*
Quick adjacency (to turf):
* If you are in the same turf, always true
* If you are not adjacent, then false
*/
/turf/proc/AdjacentQuick(var/atom/neighbor, var/atom/target = null)
var/turf/T0 = get_turf(neighbor)
if(T0 == src)
return 1
if(get_dist(src,T0) > 1)
return 0
return 1
/* /*
Adjacency (to anything else): Adjacency (to anything else):
* Must be on a turf * Must be on a turf

View File

@@ -245,7 +245,7 @@
/atom/proc/AltClick(var/mob/user) /atom/proc/AltClick(var/mob/user)
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
if(T && T.Adjacent(user)) if(T && T.AdjacentQuick(user))
if(user.listed_turf == T) if(user.listed_turf == T)
user.listed_turf = null user.listed_turf = null
else else