mob
proc
sneak(var/n as num|null,var/mob/m as mob in world)
if(m.invisibility)
m.invisibility = 0
m.sight &= ~SEE_SELF
m.overlays -= 'invis.dmi'
else
m.invisibility = n
m.sight |= SEE_SELF
m.overlays += 'invis.dmi'
checkrange(m)
checkrange(var/mob/d)
set background = 1
spawn() while (d.invisibility < 50 && d.invisibility != 0)
for(var/mob/m in oview(1))
if(m in oview(1))
d.invisibility = 0
d.sight &= ~SEE_SELF
d.overlays -= 'invis.dmi'
break
Problem description:
This proc is called by a verb that thieves have, it basically turns them invisible and when they get within one tile of another mob it makes them visible. It works fine except that it lags extreemly bad. Anyone have any ideas?
its looping like crasy
there are 1 or 2 things todo
you can add a sleep on the end to delay it
that will slow down the cpu drain
or you can
add into the player movement when there within the range it
un hides them (this will use even less cpu) but you will need to write the check right so you dont check every mob type around them