ID:1304678
 
(See the best response by Khye.)
Problem description: I seem to be posting here an awful lot anyways to the problem. I've created an attack verb and if I as i press attack it targets myself or brings up an input box to select the mob I'm attacking or myself. Any clues on how I could going about solving this issue? Screen shot provided below

Code:
    verb
Attack(mob/M as mob in get_step(usr,usr.dir))


http://gyazo.com/4647cc270bf403d74721b4f5680047b9
That's a bit strange, but perhaps what you're looking for is:

verb
Attack()
for(var/mob/M in get_step(src,usr.dir))


Thanks i thought about trying that at first but dismissed it because I thought it would do the same thing.
Best response
Ah, I just remembered...you're using pixel movement.

Yeah, the issue is, since you're using pixel movement, your bounding box can occupy two tiles at once. So you can technically be in your get_step because of that. A better way to go about this would be to use:

verb
Attack()
var x = 0, y = 0
if(dir & NORTH) y += 16
if(dir & SOUTH) y -= 16
if(dir & EAST) x += 16
if(dir & WEST) x -= 16
for(var/mob/M in obounds(src,x,y,0,0))


This would be more accurate for pixel movement. Albro1 came up with this btw.
I saw this in a post earlier, would i need to change 16? Or does it matter?
You can swap 16 with any number depending on the range you'd like the attack to be.