Any comments/critiques are more than welcome! :)
atom/movable
var
mask/mask
proc/HideMask(client/c) // Hides the mask image, making the object visible to a certain client
// debug info to make testing and bug fixing easier if we screw up implementation
if(!istype(c, /client)) CRASH("Invalid client([c]) in [src].HideMask()")
c.RemoveMask(mask.mask_image)
proc/ShowMask(client/c) // Create a mask if it doesn't exist, making the object invisible to a certain client
// debug info to make testing and bug fixing easier if we screw up implementation
if(!istype(c, /client)) CRASH("Invalid client([c]) in [src].ShowMask()")
// recycle the image for multiple clients
if(!mask)
mask = new/mask(src, c)
c.AddMask(mask.mask_image)
image/mask
mask
var/image/mask/mask_image // a unique path to make synching client.images easier
New(atom/movable/am, client/c)
// debug info to make testing and bug fixing easier if we screw up implementation
if(!istype(c, /client)) CRASH("Invalid client([c]) in new /mask([am], [c])")
// create a new mask image, this lets us 'cover up' or 'hide' each object individually
mask_image = new(icon = null, loc = am)
mask_image.override = 1
client
var masks[]
New()
..()
masks = new
// Various client procs to handle the masks
proc/SyncMasks() // Synchs the masks list with images list and cleans up un-needed masks
images.Remove(masks)
for(var/image/mask/i in images)
images.Remove(i)
images.Add(masks)
proc/AddMask(image/i) // Adds a mask to masks list and synchs images
if(!(i in masks))
masks.Add(i)
SyncMasks()
proc/RemoveMask(image/i) // Removes a mask to masks list and synchs images
if(masks.Remove(i))
SyncMasks()
proc/ClearMasks() // Clears all masks from the client and synchs
masks = list()
SyncMasks()
mob
verb
// Some verbs to test implementation
Mask_Item(atom/movable/m in view())
m.ShowMask(client)
Unmask(atom/movable/m in view())
m.HideMask(client)
ClearMasks()
client.ClearMasks()
Disclaimer: I'm not much of a programmer, but there you have it! haha
Nice shoutout. ;P