turf
proc
TurfBoundsOkay(mob/a,X=0,Y=0)
if(!X && !Y) return 1 //allow the move as it is not actually moving anywhere so it can't actually hit anything
var
turf/t = src
edge_x = a.step_x //edge_x and edge_y will represent an outside edge of the bounding box to check against
edge_y = a.step_y
edge_x += a.bound_x
if(X>0) edge_x += a.bound_width
edge_y += a.bound_y
if(Y>0) edge_y += a.bound_height
if(edge_x + X > world.icon_size) t = get_step(t,EAST)
else if(t && edge_x + X < 0) t = get_step(t,WEST)
if(t && edge_y + Y > world.icon_size) t = get_step(t,NORTH)
else if(t && edge_y + Y < 0) t = get_step(t,SOUTH)
if(!t) return
if(!t.turf_bound_width || !t.turf_bound_height) return 1 //custom bounding boxes aren't even on this turf so you can try to move there
edge_x+=X
edge_y+=Y
while(edge_x > world.icon_size) edge_x-=world.icon_size
while(edge_x < 0) edge_x+=world.icon_size
while(edge_y > world.icon_size) edge_y-=world.icon_size
while(edge_y < 0) edge_y+=world.icon_size
//HERE: i'm pretty sure this part is not made correctly
if(num_between(edge_x, t.turf_bound_x, t.turf_bound_x + t.turf_bound_width))
if(num_between(edge_y, t.turf_bound_y, t.turf_bound_y + t.turf_bound_height)) return //do not allow this move because the player's bounding box would be touching or intersecting the turf's bounding box if it is allowed to move
return 1 //nothing appears to be stopping this movement from happening so go for it
I have this proc I made called TurfBoundsOkay() which checks if a mob would be allowed to enter a turf based on the turf and the mob's bounding boxes and the direction the mob is trying to move. The proc's X and Y arguments are the pixel direction the mob is trying to move. This code is part of a system I'm making to allow turfs to have bounding boxes because BYOND does not support that normally. I commented the lines that I suspect are the problem area.
I copied BYOND's system with the bound_x/y bound_height/width vars by giving turfs the turf_bound_x/y and turf_bound_height/width vars. Thanks.