Page 1 of 1

item.layer

Posted: Thu Jun 07, 2012 6:12 am
by garyglitter
From memory from working on older cores, the item.layer method returned the items layer (iirc). Now I'm seeing that it only returns the items layer if it is equipped, otherwise it returns 0. I'm using tile_layer instead now, just thought this was weird.

I suppose it's a handy way to know if the item is equipped or not. I'm guessing this it the purpose of it, if so then the description ought to be changed from
equipment layer
to something like
equipment layer if equipped
save a bit of confusion on my part :P

Re: item.layer

Posted: Thu Jun 07, 2012 2:14 pm
by RusseL
core-changes.txt

Code: Select all

12-17 MuadDib:
        Fixed :  Item.layer gets reset to 0 when unequipped.
that was a bug :cheesy:

Re: item.layer

Posted: Thu Jun 07, 2012 8:10 pm
by garyglitter
Ah ok. So it's only meant to return the layer when equipped then? Thanks :P I did have a look at the change log but didn't see that one haha.

Re: item.layer

Posted: Sat Jun 09, 2012 2:03 am
by Tomi
Another way to check if equipped is to check if item.container is a CharRef