ID:1929334
 
(See the best response by Ter13.)
Code:
mob/proc
Attack_Command()
var/mob/t = locate(/mob) in get_step(src,src.dir)
if(!t) world<<"no target"
else world<<"target = ([t])"


Problem description:
In the older BYOND (before pixel movement became standard), this was probably the most ideal method for coding a "punch".

However, now it will pick up the user of Attack_Command() if they are positioned just so (you attack yourself). I figured I would get this result, but I'm wondering how I would go about getting a fix? - if(t!=src) does not count.

For reference, my mob step_size is 4, and I have nothing in the Move() proc.
You might try bounds() (and/or obounds()).
Best response
The new way of doing things is to use obounds().

I wrote a quick and dirty function that should do the job for you called "melee_bounds()".

proc
melee_bounds(atom/movable/ref,dir,dist,width,align=0)
var/w,h

if(istype(ref))
w = ref.bound_width
h = ref.bound_height
else
w = TILE_WIDTH
h = TILE_HEIGHT

switch(dir)
if(NORTH)
. = bounds(ref,floor((w-width)/2)+align,h,width-w,dist-h)
if(NORTHEAST)
. = bounds(ref,bound_width,bound_height,dist-w,dist-h)
if(NORTHWEST)
. = bounds(ref,-dist,bound_height,dist-w,dist-h)
if(SOUTH)
. = bounds(ref,floor((w-width)/2)+align,-dist,width-w,dist-h)
if(EAST)
. = bounds(ref,w,floor((h-width)/2)+align,dist-w,width-h)
if(WEST)
. = bounds(ref,-dist,floor((h-width)/2)+align,dist-w,width-h)
if(SOUTHEAST)
. = bounds(ref,bound_width,-dist,dist-w,dist-h)
if(SOUTHWEST)
. = bounds(ref,-dist,-dist,dist-w,dist-h)


dist = how far the reach of the punch is from the edge of ref.

width = how many pixels wide on the adjacent axis the punch is. This can be greater or lesser than the bounds of the mob.

align = how many pixels to shift the area by on the adjacent axis.
Ah! Yes! Thanks to you both.