Im trying to figure out how to return mobs(or w.e) in a circle.
I have tried hunting around the forums abit so if you can point me to other topics aswell that would help im all ears.
Code:
Attempting to adapt from: http://www.byond.com/forum/?post=1891928
atom/proc/GetCircle(radius = 1)
. = list()
var/rsq = radius * (radius+32)
var/dx, dy, dsq
for(var/atom/a in bounds(src, radius))
dx = a.Cx() - src.Cx()
dy = a.Cy() - src.Cy()
dsq = dx*dx + dy*dy
if(dsq <= rsq) . += a
Absolute positions and DM StdLib in use. (I believe i gain the same results but unsure)
Problem description:
It seems to work for the most part, but i am noticing that its extending and hitting some instances where it (probably) shouldn't be hitting.
Would it be possible for someone to go over this and lend a hand.
Also for extra points ;) how hard is it to get a hitbox to work with diagonal movement, Primarily for standard player attacks (weapon will determine attack range) getting a hitbox to work for North,East,South,West is easy enough with just bounds() but not sure once the player is attacking while facing diagonally.