ID:146844
 

obj
terror
TO1
icon = 'terroists.dmi'
icon_state = "1"
density = 1
Click()
var/obj/h = new/obj/hit(src)
h.pixel_x = rand(1,36)
h.pixel_y = rand(1,36)

This is an overlay. When i click it. Nothing happens. :(
Siientx wrote:
This is an overlay. When i click it. Nothing happens. :(

That's because when an object is added to an atom is an overlay, it's not the object itself that you see but a "snapshot" of the object that, for all purposes, acts like its atom.

Translation: An overlay's Click() proc is its atom's click proc, which is why that isn't working.
In response to Wizkidd0123
Ok, well how do i fix this so it works?
In response to Siientx
When you click on an overlay, the atom it belongs to's Click() proc is called.

So, say you had a /mob/player with an overlay. If you clicked on the overlay, /mob/player/Click() would get called.
In response to Jon88
I know i know, but how do i get it so if i click the HEAD overlay it calls the HEADSHOT proc?
In response to Siientx
You don't. Not without making the head object an actual object (rather than an overlay) that follows the rest of the player around, anyway.
In response to Siientx
This requires that the mob and the mob's head are completely on seperate turfs(pixel_x and pixel_y).

atom/Click() takes a Location as an argument. That location is the location of the object clicked. So if that location variable doesn't equal the mob's location, that means that they must have clicked on an overlay that is above a different turf. :)