Another method could be to create a class of objects that are visible only to certain users.
invisiobj // The invisobj class will still be tangible, but just // not visible. That is, it can only be seen by certain // mobs, but it will still interact with the overworld // if it is dense.
parent_type = /obj
var // The list of mobs this is displayed to. They are // actually displayed to clients, but we'll just use // this for simplicity. list/displayed[0]
image/image
New(atom/loc) ..(loc)
image = new /image(src.icon, loc, src.icon_state)
icon = null icon_state = null
Move(...) ..()
// Everytime the /invisiobj moves via the Move() // method, the image's data is updated to support // this change.
UnDisplay(mob/m) src.displayed -= m if(m.client) m.client.images -= src.image
src.OnUnDisplay(mob/m)
OnDisplay(mob/m)
OnUnDisplay(mob/m)
This is a clear example of where it would be nice for BYOND to have strict accessor and mutator methods for directly-changing variables. Alas, it doesn't, so this is the closest I can get that is also fairly general. Just make sure to use Move() to move the object.
You can also use: