Page 1 of 1

[fixed] Item.layer only works for items (once) equipped

Posted: Sun May 25, 2008 12:07 am
by ncrsn
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]

Posted: Fri Aug 15, 2008 11:02 pm
by Madman
Interesting. I think you are wrong in one very minor detail- I think if you set the items layer, it remains set even if it was never equipped. But that is a mostly useless distinction.

Posted: Sat Aug 16, 2008 12:07 am
by ncrsn
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.

Re: Item.layer only works for items (once) equipped (POL 097)

Posted: Sun Aug 17, 2008 11:11 pm
by Madman
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.

Re: Item.layer only works for items (once) equipped (POL 097)

Posted: Mon Aug 18, 2008 7:12 am
by Austin
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)

Posted: Mon Aug 18, 2008 10:43 am
by ncrsn
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)

Posted: Mon Aug 18, 2008 11:01 am
by Austin
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.

Re: Item.layer only works for items (once) equipped (POL 097)

Posted: Mon Aug 18, 2008 11:26 am
by ncrsn
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)

Posted: Sat Dec 20, 2008 5:24 pm
by Nando

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.
so, fixed ;)

Re: [fixed] Item.layer only works for items (once) equipped

Posted: Sun Dec 21, 2008 6:09 pm
by ncrsn
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.