This is only a small nuisance, but worth the thread: item.layer returns valid information only if the item is equipped or has been equipped in the past. Say, I create a sword on the ground and check it's layer using .getprop layer: "Property layer is not set or zero." If I equip it and try again, result is "Property layer is: 1". After unequipping the value is still correct, until the server is rebooted.
As far as I know this has existed for a very long time.
Even if the item is never-ever equipped layer property should tell the layer it would fit into, if any.
[Core: POL 097 -- Nando]
[fixed] Item.layer only works for items (once) equipped
Moderator: POL Developer
What do you mean by setting layer?
Wasn't sure so I tried two ways.
1. Defining layer in itemdesc.cfg element
2. Trying to set layer in game using .setprop-command
Neither way made a correct value readable without equipping the item first. Of course layer is r/o value so it cannot be changed / trying did not refresh the value like equipping does.
Also interesting is that even though layer is objtype -even graphic- spesific value, it is saved per item, for one equipped axe didn't make axes around it to have corrected layer values. Maybe it's just me who tend to think "hard coded" values are really stored only once.
Wasn't sure so I tried two ways.
1. Defining layer in itemdesc.cfg element
2. Trying to set layer in game using .setprop-command
Neither way made a correct value readable without equipping the item first. Of course layer is r/o value so it cannot be changed / trying did not refresh the value like equipping does.
Also interesting is that even though layer is objtype -even graphic- spesific value, it is saved per item, for one equipped axe didn't make axes around it to have corrected layer values. Maybe it's just me who tend to think "hard coded" values are really stored only once.
Re: Item.layer only works for items (once) equipped (POL 097)
Ah, I know what my mistake was on layer- I was (strangely enough!) confusing it with Facing when I said that- specifically facing's weird overloading where it also stores the light type for an object. You are correct that layer is r/o and so ignore what I said about setting it, I was on crack.
Now that you mention it, I vaguely remember this layer issue coming up years ago.
Now that you mention it, I vaguely remember this layer issue coming up years ago.
Re: Item.layer only works for items (once) equipped (POL 097)
Its not too big an issue - as the layer information can be retrieved from tiles.cfg
Re: Item.layer only works for items (once) equipped (POL 097)
No it isn't, but then again, is a non-working hardly fixable feature worth keeping in the core? I don't know, but until it works, it's better to use the mentioned tiles.cfg method.
Re: Item.layer only works for items (once) equipped (POL 097)
Internally the layer property seems to be used to determine if an item is equipped on a mobile.
I think the issue is - when unequipped, the layer property is not being erased.
I think the issue is - when unequipped, the layer property is not being erased.
Re: Item.layer only works for items (once) equipped (POL 097)
Okay, then... Is there a reason not to switch the internal way to use .container property, as it tells for sure if item is equipped by mobile (returns a reference if it is)? That way .layer could be, if possible and there is a motivation to do so, changed to return the correct layer value every time?
Re: Item.layer only works for items (once) equipped (POL 097)
Code: Select all
12-17 MuadDib:
Fixed : Item.layer gets reset to 0 when unequipped.
Added : Item.tile_layer returns the Layer setting in the Tiles.cfg/Tiledata.
This was added to always give the layer it uses, while leaving the
internal handling both of Core and Scripts that utilize the fact of
"if layer is set, it's equipped". This is ALWAYS set from the tile info
at server load. So changing your tiledata, re-creating tiles.cfg will
auto update your items.
Note : Item.layer gets internally reset on server load if it is equipped, via
tiles.cfg entry as well.
Re: [fixed] Item.layer only works for items (once) equipped
Yeah, looking good.
Not only the mentioned fix but also the post reply button is right where it's supposed to!
Thank you all again.
Not only the mentioned fix but also the post reply button is right where it's supposed to!
Thank you all again.