client/Click(var/atom/putHere,location,control,params)
..()
if(istype(putHere,/mob/))
return // do stuff for clicking on units here
else
/*
make the visual for clicking appear below
*/
var/paramslist = params2list(params)
var/px = text2num(paramslist["icon-x"])
var/py = text2num(paramslist["icon-y"])
var/tmp/image/I = image('click.dmi')
I.x=putHere.x
I.y=putHere.y
I.pixel_x=px-16 // we have to do -16 to center it on the cursor click
I.pixel_y=py-16 // just like how we do -16 in the movement
usr.client.images+=I
sleep(7)
usr.client.images-=I
del(I)
Problem description:
When I click all around the map in rapid succession, fine, no problems. When I rapidly click in the same place, the click animations are being thrown to the bottom left (3,3,1) of the map. After some tinkering around, I figured out that this was due to the fact I was actually clicking on image objects I had just created before they disappeared.
That being said, I dont know how I can fix the problem. I cant seem to reference the image objects with istype.
if(istype(putHere,/obj/image)) - does not work
if(istype(putHere,/obj/)) - compiles, but doesnt fix the problem
Can anyone tell me what I am missing here? I am trying to do click movement, which I have got working great, but these click animations are giving me trouble.
Thanks!