world
fps = 30
view = 20
mob
icon = 'mob.dmi'
Login()
..()
turf
icon = 'turf.dmi'
var map/overworld = new(1)
map
var list/data
New(Z_LEVEL)
var x,y,mx=world.maxx,my=world.maxy
data = new/list(mx,my)
for(y = 1 to my)
for(x = 1 to mx)
data[x][y] = locate(x,y,Z_LEVEL)
proc
Ray(ANGLE,X,Y,MAX_STEPS)
var sx = sin(ANGLE), sy = cos(ANGLE)
var rx = X, ry = Y, max = data.len
var turf/turf, list/ret = new, object
for()
if(!MAX_STEPS){break}
MAX_STEPS--
if(rx >= max || 1 > rx){break}
if(ry >= max || 1 > ry){break}
turf = data[rx][ry]
ret += turf
for(object in turf.contents){ret+=object}
rx += sx
ry += sy
return ret
mob/verb/DEMO()
var list/l = overworld.Ray(rand(0,360),x,y,16) - src
world << "l.len = [l.len]"
for(var/o in l)
o:color="#F00"
spawn(3)
animate(o,color=null,time=6)
Created the demo above that lets you quickly send a ray across the map returning all the objects and turfs it encountered, it could be broken up into seperate procs or be given a BITFLAG to allow for what's needed.
I think having this type of thing built-in would be pretty epic, would be much easier and probably use correct math :D
It's super efficient too, able to send out thousands of rays a second with no hit to the cpu.
Averaged