ID:2804542
 
Problem description:

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


The KEEP_TOGETHER flag is what you need. Apply it to the appearance_flags of your mob.
It doesn't work.
The reference's said about drawing overlays and underlays as one unit, not about vis_contents.
It's to hard for me :(
Could someone check the files and help me figured out what i do wrong?

https://drive.google.com/file/d/ 1S_76mef6DEyzR0VpjBTkMWo1bp_fYuhp/view?usp=sharing
In response to Marekssj3
image.override doesn't apply to things in vis_contents. i've brought this up in the discord before and it was never really resolved. i was wanting to use it for something with body parts as well funny enough.