Stealth Library

by Jemai1
A simple stealth library which effectively handles invisibility and visibility of icons to selected players. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Jemai1.Stealth##version=2

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://Jemai1.Stealth##version=2

248 downloads
Version 1.0b
Date added: Dec 3 2011
Last updated: Jan 29 2013
2 fans
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.

Click here for screenshots and more info.

Library procs:
atom/proc

stealth(hide)

// Call this proc to hide/show an atom.

// - If hide is non-zero, hide atom. If hide is zero, show atom.

// - It returns 1 if status was changed. Otherwise, it returns 0.

hidden()

// Call this proc to check stealth status.

// - It returns 1 if hidden; 0 if not.

On_Stealth(hide)

// Override this proc to add messages, effects, etc.

// - It is called whenever the atom's stealth status changed.


mob/proc

Detect(atom/atom)

// Override this proc to handle detection of hidden atoms.

// - To detect the atom, return a non-zero value.
// - Otherwise, return zero.

blink()

// Call this proc to refresh the player's vision.

// - It calls client.blink()

wink(atom/atom)

// Call this proc to refresh the player's vision for an atom

// - It calls client.wink(atom)


client/proc

blink()

// Call this proc to refresh the player's vision.

wink(atom/atom)

// Call this proc to refresh the player's vision for an atom

world/proc

blink()

// Call this proc to refresh the vision of all players.

// - It calls the blink() for every client.

wink(atom/atom)

// Call this proc to refresh the vision of all players for an atom

// - It calls the wink(atom) for every client.