Proximity sensing refactor (#425)

This commit is contained in:
CitadelStationBot
2017-04-16 18:15:29 -04:00
committed by TalkingCactus
parent dfd470adf9
commit 64068fc614
12 changed files with 160 additions and 144 deletions
-40
View File
@@ -1137,46 +1137,6 @@ B --><-- A
if(location == src)
return 1
/proc/add_to_proximity_list(atom/A, range)
var/turf/T = get_turf(A)
if(!T || !A.loc)
throw EXCEPTION("Someone adding a prox sensor in nullspace")
var/list/L = block(locate(T.x - range, T.y - range, T.z), locate(T.x + range, T.y + range, T.z))
for(var/B in L)
var/turf/C = B
LAZYINITLIST(C.proximity_checkers)
C.proximity_checkers[A] = TRUE
return L
/proc/remove_from_proximity_list(atom/A, range, oldloc = null)
var/turf/T = get_turf(oldloc ? oldloc : A)
var/list/L = block(locate(T.x - range, T.y - range, T.z), locate(T.x + range, T.y + range, T.z))
for(var/B in L)
var/turf/C = B
if (!C.proximity_checkers)
continue
C.proximity_checkers.Remove(A)
/proc/shift_proximity(atom/checker, atom/A, range, atom/B, newrange)
var/turf/T = get_turf(A)
var/turf/Q = get_turf(B)
if(T == Q && range == newrange)
return 0
var/list/L = block(locate(T.x - range, T.y - range, T.z), locate(T.x + range, T.y + range, T.z))
var/list/M = block(locate(Q.x - newrange, Q.y - newrange, Q.z), locate(Q.x + newrange, Q.y + newrange, Q.z))
var/list/N = L - M
var/list/O = M - L
for(var/C in N)
var/turf/D = C
if (!D.proximity_checkers)
continue
D.proximity_checkers.Remove(checker)
for(var/E in O)
var/turf/F = E
LAZYINITLIST(F.proximity_checkers)
F.proximity_checkers[checker] = TRUE
return 1
/proc/flick_overlay_static(image/I, atom/A, duration)
set waitfor = 0
if(!A || !I)