I used simple system based on images (override) to showing/hiding npc's for individual players.
client
var/list/NPCimages = list()
proc
updateNPCimage(var/NPCs/N, list/Params, vis = 1)
if(N && istype(N, /NPCs))
var/NPCimage/thisNPC = NPCimages[N.name]
world<<thisNPC
if(!thisNPC)
NPCimages[N.name] = new /NPCimage(image(icon=N.icon,loc= N, icon_state=N.icon_state, dir=N.dir, layer=N.layer), 1)
if(N.hasShadow)
NPCimages[N.name].image.underlays += N.underlays
//TODO - reflections.
thisNPC = NPCimages[N.name]
thisNPC.image.loc=N
thisNPC.visable = vis
for(var/v in Params)
thisNPC.image.vars[v] = Params[v]
NPCimages[N.name] = thisNPC
NPCimages[N.name].image.override = 1
if(vis) NPCimages[N.name].image.alpha = 255
else NPCimages[N.name].image.alpha = 0
src << NPCimages[N.name].image
NPCimage
var
name
image/image
visable
New(i,v=1)
image = i
visable = v
mob
proc
isVisableNPC(name)
if(client?.NPCimages[name] && client?.NPCimages[name].visable) return 1
else return 0
It's working fine but, i want change way to create characters in game. I implement some sort of body builder. it's based on vis_contents. And here is my problem because my body parts are "above" my hero and when i want hide my person it didn't work on my body parts. Is somehow possible to "join" body parts to mob?
Body builder:
mob
var
list/parts
New()
BuildParts()
if(parts)
for(var/v in parts)
vis_contents += parts[v]
..()
proc
BuildParts()
player
BuildParts(list/p)
if(!p)
p = parts = list()
p["skin"] = new/obj/bodypart{icon_state="skin"}()
p["eyes"] = new/obj/bodypart{icon_state="eyes"}()
p["hair"] = new/obj/bodypart{icon_state="hair"}()
obj/bodypart
icon = 'BallMob.dmi'
vis_flags = VIS_INHERIT_DIR
layer = FLOAT_LAYER
plane = FLOAT_PLANE