ID:139553
 
Code:
mob/Click()
set src in view(1)
attack(src)
..()

mob/proc/attack(mob/M as mob)
if (M.HP <= 0)
usr << "[M] is already dead!"
else
usr << "You attack [M]!"
oview() << "[usr] attacks [M]!"
var/damage = rand(1,10)
world << "[damage] damage!"
M.HP -= damage
M.DeathCheck(src)

obj/item

var/value

Click()
set src in view(1)
..()
src.loc = null


Problem description:

The Click() procs here are supposed to have a range limit of 1 space, but for some reason I'm able to click on anything visible and execute the procs.

It WAS working a couple updates ago, but it suddenly stopped working for some reason while I was working on some unrelated code.
Doesn't work with Click :P, try this:

mob/Click()
if(get_dist(src,usr) > 1) return
attack(src)
..()
In response to Masschaos100
Works great, thanks for the help.