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

Bug Reports relating to the 097 core are moved to this forum once solved.

Moderator: POL Developer

Locked
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

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

Post 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]
Madman
POL Developer
Posts: 62
Joined: Sun Feb 05, 2006 7:20 pm

Post 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.
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Post 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.
Madman
POL Developer
Posts: 62
Joined: Sun Feb 05, 2006 7:20 pm

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

Post 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.
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

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

Post by Austin »

Its not too big an issue - as the layer information can be retrieved from tiles.cfg
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

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

Post 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.
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

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

Post 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.
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

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

Post 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?
Nando
POL Developer
Posts: 282
Joined: Wed Sep 17, 2008 6:53 pm
Contact:

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

Post 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 ;)
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

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

Post 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.
Locked