ID:180800
 
is it possible to define wich layer an overlays displays itself in?

I have a beard.dmi wich I use as an overlay on the mob, the problem is:

when he wears a shirt, his beard is not visible since it is under the shirt. It should be over it, plz help!
On 2/14/01 1:11 pm Kaidorin wrote:
is it possible to define wich layer an overlays displays itself in?

I have a beard.dmi wich I use as an overlay on the mob, the problem is:

when he wears a shirt, his beard is not visible since it is under the shirt. It should be over it, plz help!

Just create an object with the beard icon, set that object's layer to MOB_LAYER + 0.1 or something, and then add that object to the overlays list instead of directly adding the icon. Like so:

mob/proc/AddBeard()
var/obj/beard = new()
beard.icon = 'beard.dmi'
beard.layer = MOB_LAYER + 0.1
overlays += beard
In response to Guy T.
should it be like this?

mob
proc
AddBeard()

var
obj
beard = new()
beard.icon = 'beard.dmi'
beard.layer = MOB_LAYER + 0.1
overlays += beard
In response to Kaidorin
should it be like this?

mob
proc
AddBeard()

var
obj
beard = new()
beard.icon = 'beard.dmi'
beard.layer = MOB_LAYER + 0.1
overlays += beard

Nope. Actually, I don't think this would compile. I think the code I gave you is probably pretty much ready to use... just wherever you want to give a mob a beard, you call AddBeard().

For example:

mob
bearded_guy
New()
. = ..()
AddBeard()

But of course, you probably don't want to do it that way... you probably want to ask players if they want beards. For example, if you wanted to give players the ability to grow a beard at any time, you could do this:

mob/verb/grow_beard()
usr.AddBeard() //BYOND assumes that usr is a mob, and AddBeard() is a proc belonging to the mob type, so this is OK.
In response to Guy T.

beard.layer = MOB_LAYER + 0.1

this should be beard.layer = usr.layer + 0.1, shouldn't it?
it doesn't compile with the above, it says mob_layer is a bad var.