My first attempt to make this possible was to make an image that holds the icon and overlays of an atom. Then, make the icon and overlays null. Finally, show the image datum to selected players.
It works. However, flick() never worked on images.
On this rainy day, upon paying attention to the override var of images, I realized that I should reverse the process. Instead of using images for visibility, I could use it for invisibility. Really.
This stealth library is the product of that simple idea.
Now, flick() can be used without worries.
Try it out and please give comments and suggestions.
Library features:
// - Effectively handles invisibility/visibility of atoms.*
mob/proc
Hide()
src.stealth(1)
Appear()
src.stealth(0)
// - Lets developers choose who can see what.
mob
Detect(atom/atom)
if( atom == src )
return TRUE
else
return FALSE
// - Icons, overlays and flick() friendly
mob/verb
Cloak_of_Invisibility()
if( !src.hidden() )
overlays += /obj/cloak
Hide()
flick("smirk",src)
view(5,src) << "[src] vanished!"
else
Appear()
overlays -= /obj/cloak
flick("bleh",src)
view(5,src) << "[src]: Surprise!"
*Invisibility is only icon related. Mouse opacity, invisibility of verbs and other factors are not affected.
Demo (included in the library) screenshots: