ID:2056266
 
(See the best response by Kaiochao.)
Code:
turf/Click(O)
if(usr.isCasting==1)
var/dir = get_dir(usr,src)
Fire(dir,ability,src)
usr.isCasting=0


Problem description:

The code I posted is not the full code but easily helps you understanding what I want. Basically, certain abilities will have a different cast type: click, once the mob casts the ability they will have some time to click a place, where that ability shall appear, imagine a thunder bolt, then I click a place, that's where the thunder bolt will land.

As you can see by the code, I put a Click(O) in the turf, and a flag in the ability, once the flag is equal 1 I get the turf direction and pass it to my Fire proc, then I fire the ability in that dir or in that location (imagine a fireball, It won't 'appear' in that location, but be cast to that direction).
It works flawlessly, the problem is that I have to put a Click proc in every turf or obj that might be in the map: a stone, a door, a house. It isn't a big problem, and I'm okay to maintain the code that way, my question is: is this the best practice for this ideia? I was thinking that maybe my cast proc could have a way to 'wait' the for the click instead of setting a flag and a click for turfs, but I couldn't find a way to do so.
Best response
When a client clicks on an atom, the engine calls client.Click(object, location, control, params), which then calls object.Click(location, control, params). You can override client.Click() and cast towards the object clicked.
For the object checked through client/Click(), you can have it check to see if it has a physical location.
client/Click(atom/o)
..()
if(o.x && o.y && o.z)
...continue code