I have a 'track' which is basically a turf with an Entered(). When a mob walks into it with certain veriables set, it auto walks them around it.
obj/lane/duel
var/icon_state_a
var/mob/activate
icon = 'dlane.dmi'
dlane
icon_state_a = "on"
I have have added to the turfs Entered() the following;
for(var/obj/lane/duel/D in oview(10)) if(!D.activate) D.icon_state = D.icon_state_a
So while im walking around this track, and Entered() is being set off, all obj/lane/duel within a 10x10 view of the turf will switch their blank icon_state's to the objs set "icon_state_a" variable (but only if they dont have a mob linked to them).
Having the mob/activate is a good way since then when a mob leaves the server or whatever, i can search the world for obj's they affected and reset them. Ready for another player to affect.
Would this be a laggy way to deal with this? Is there a better way?
The whole point of this is to have an object 'do something' when a mob walks within a certain range of it with certain variables to give an effect a bit like below...
The object would be the "DUEL" and it would be invisible until a mob walks within range of it with a certain variables set.
So is this the best way i can hope for, or is there a more efficient way?
I was thinking of adding a var to my turf, and making a subtype so that i can place every 5 squares of the track. Those would be the only ones that would have the variable that would trigger this for(). That way it wont be doing it on EVERY turf the mob enters.
I just wanted to see if there was some better way id not considered (quite possible).