Anyone know what's wrong with this proc? I took the algorithm itself directly from the website I found it from, and although it was in C++, I'm pretty sure I got the algorithm correct.
iscolliding(xp,yp)
if(!density) return
var
top1 = pixy+yp+height
bottom1 = pixy+yp
left1 = pixx+xp
right1 = pixx+xp+width
for(var/atom/A in range(1,src))
if(!A.density || A==src) continue
var
top2 = A.pixy+A.height
bottom2 = A.pixy
left2 = A.pixx
right2 = A.pixx + A.width
if(bottom1 > top2) continue
if(top1 < bottom2) continue
if(right1 < left2) continue
if(left1 > right2) continue
return A
In other words, you might bump a chair on the other side of the table without first bumping the table. I highly recommend Theodis' QuickSort library for this task. If you need some tips on getting it working, let me know.