ID:150090
 
Is there a way to make an overlay appear at a location on the map(please give an example)
Vermolius wrote:
Is there a way to make an overlay appear at a location on the map

Yes.

(please give an example)

Ooh, clever, you prevented me from giving me just a simple 'yes' answer! ;-)


proc/overlay_at_location(icon, iconstate, x, y, z)
var/turf/T = locate(x, y, z)
var/obj/O = new
O.icon = icon
O.icon_state = iconstate
T.overlays += O
del(O)


Careful, though. Once you make an overlay, you can't delete it again.

Well, you can, but it's not the reverse of what you just did... you'd have to delete every overlay from the turf that you overlayed on.
In response to Spuzzum
how about doing this if someone is in a certain spot
lets say (1,2,1)
so if someone is in (1,2,1) can I make an overlay in (2,2,1)?
In response to Spuzzum
Spuzzum wrote:
Careful, though. Once you make an overlay, you can't delete it again.

Well, you can, but it's not the reverse of what you just did... you'd have to delete every overlay from the turf that you overlayed on.

Are you sure? I know you can remove specific icons from the overlays, but I've never tried it while using an obj to access the icon_states.
In response to Shadowdarke
Are you sure? I know you can remove specific icons from the overlays, but I've never tried it while using an obj to access the icon_states.

Pretty sure, but not completely and utterly positive. Last time I checked, the only way you could remove overlays that you've added is to keep the object in a list somewhere and then remove it from the overlays and delete the object.

But that's beyond a code problem.