ID:157064
 
Is there a way to hide overlays?

I tried this, but it didn't work.

            for(var/X in usr.overlays) 
X.invisibility=1
you cant interact with overlays after they have been added, only way is to either remove then add one so it would be

            for(var/X in usr.overlays) 
usr.overlays -= X
var/n = new X.type
n.invisibility = 1
del(X)
I gave out a feature request on this but they said that it was not feasible.And I think the best way to do this is to remove it.

But however if you want to hide an overlay from certain players alone, then I don't think we can do that.
In response to Soul Sign
Soul Sign wrote:
But however if you want to hide an overlay from certain players alone, then I don't think we can do that.

That's what image objects are for.
I think the only way you can accomplish this is to waste datums. For example, this is a very simple method to allow hiding of one overlay:

obj/overlay_thingy
icon = 'someicon.dmi'
var/hidden = 0

mob/var/obj/overlay_thingy/special_overlay = null

mob/verb
add_special_overlay()
if(!src.special_overlay)
src.special_overlay = new
src.overlays += src.special_overlay
hide_special_overlay()
if(src.special_overlay)
if(src.special_overlay.hidden) src.overlays += src.special_overlay
else src.overlays -= src.special_overlay
src.special_overlay.hidden = !src.special_overlay.hidden
else src.add_special_overlay() //if it doesn't exist we'll call it hidden
remove_special_overlay()
if(src.special_overlay) src.overlays -= src.special_overlay
src.special_overlay = null


Because we can "keep track" of the overlay using its container object, we can assign it to a variable belonging to the mob and add or remove it at will. You can probably accomplish the same thing with /icon variables if the game is more dynamic with its icons, but the concept remains the same.
In response to Garthor
o.O
but how come this doesn't seem to work ?
for(var/X in src.overlays) 
src.overlays -= X
var/n = new X:type(x:icon,X:icon_state)
n:invisibility = 5
src.overlays+=n


I can see the overlays even if my see_invisible=0.
In response to Mobius Evalon
Mobius Evalon wrote:
I think the only way you can accomplish this is to waste datums. For example, this is a very simple method to allow hiding of one overlay:

> obj/overlay_thingy
> icon = 'someicon.dmi'
> var/hidden = 0
>
> mob/var/obj/overlay_thingy/special_overlay = null
>
> mob/verb
> add_special_overlay()
> if(!src.special_overlay)
> src.special_overlay = new
> src.overlays += src.special_overlay
> hide_special_overlay()
> if(src.special_overlay)
> if(src.special_overlay.hidden) src.overlays += src.special_overlay
> else src.overlays -= src.special_overlay
> src.special_overlay.hidden = !src.special_overlay.hidden
> else src.add_special_overlay() //if it doesn't exist we'll call it hidden
> remove_special_overlay()
> if(src.special_overlay) src.overlays -= src.special_overlay
> src.special_overlay = null
>

Because we can "keep track" of the overlay using its container object, we can assign it to a variable belonging to the mob and add or remove it at will. You can probably accomplish the same thing with /icon variables if the game is more dynamic with its icons, but the concept remains the same.

Ummm, how does that hide an overlay from certain players alone? o.o

Take this case into consideration.
there are few mobs having see_invisible =2
all others have see_invisibile=1
Now I want to show a certain set of overlays to mobs who can see more.
How is that done?o.O
In response to Soul Sign
overlays is a special list with special entries, the values within will not work as normally as you may think.

And I quote: "The individual items in the list may not be directly accessed, since they are stored in a special internal format."
In response to Soul Sign
Because adding an obj to overlays does not result in an overlays list containing an obj. All visual (and some stupid nonvisual) data of the object is compressed into an appearance object instead. When you get X:type, you get the /image type out of it (though I don't think it's actually that type). image objects do not support invisibility, though in this case the issue is that you are extracting precisely zero visual data from the object in the overlays list and so you are adding an object with no icon to overlays. If you fixed this, you would be able to see it regardless (as, again, invisibility is not supported here).

Of course, I have no idea what this has to do with my post.
In response to Soul Sign
Soul Sign wrote:
Ummm, how does that hide an overlay from certain players alone? o.o

Take this case into consideration.
there are few mobs having see_invisible =2
all others have see_invisibile=1
Now I want to show a certain set of overlays to mobs who can see more.
How is that done?o.O

image objects.
In response to Garthor
Garthor wrote:
image objects.

Image Objects.I am a noob here and umm I ready this.. the image objects part in reference. And I guess the implementation is somewhat like this
var/image/I = image('icon.dmi',usr)  //make an image attached to usr
for(var/client/M)
if(M.mob.see_invisibile>=2)
M.mob << I //allow mob to see it
else //how do you disallow the mob to see it ?



Of which I don't have an idea to implement.Am I right?Where am I wrong?
In response to GhostAnime
Ok so basically this is all just more trouble than its worth.
In response to Soul Sign
Yes, that's correct. To make a player not see it, you... don't output the image to them.
In response to Garthor
Garthor wrote:
Yes, that's correct. To make a player not see it, you... don't output the image to them.

You rock!!Thnx xD