Page 1 of 1

Are player attributes getting removed in 5.0.0 ?

PostPosted: Tue Dec 11, 2018 14:10
by davidthecreator
Heard something about some sort of attributes being deprecated in MT 5.0.0 ...

Wasn't sure if those were player attributes, or if other entities could have attributes and will have them deprecated... But I've been messing a lot with player attributes in my upcoming projects and am just wondering if player attributes aren't getting removed or something

Re: Are player attributes getting removed in 5.0.0 ?

PostPosted: Tue Dec 11, 2018 14:18
by rubenwardy
Player Attributes are deprecated in 5.0.0, which means that you are encouraged to not use them in mods.
Player Attributes are replaced by player meta, which uses the same API as node and item meta, and mod storage.

Player Attributes may be removed in the future, but removing deprecated functions only tends to happen during major releases - eg: 6.0.0

Before:

Code: Select all
player:set_attribute("foo", "123")
print(tonumber(player:get_attribute("foo")))


After:


Code: Select all
local meta = player:get_meta()
meta:set_int("foo", 123)
print(meta:get_int("foo"))



It's worth noting that depends.txt and description.txt are also deprecated in 5.0.0, but we probably won't ever remove support for them.

Re: Are player attributes getting removed in 5.0.0 ?

PostPosted: Tue Dec 11, 2018 14:22
by davidthecreator
rubenwardy wrote:Player Attributes are deprecated, which means that you are encouraged to not use them in mods.
Player Attributes are replaced by player meta, which uses the same API as node and item meta, and mod storage.

Player Attributes may be removed in the future, but removing deprecated functions only tends to happen during major releases - eg: 6.0.0

Before:

Code: Select all
player:set_attribute("foo", "123")
print(tonumber(player:get_attribute("foo")))


After:


Code: Select all
local meta = player:get_meta()
meta:set_int("foo", 123)
print(meta:get_int("foo"))



It's worth noting that depends.txt and description.txt are also deprecated in 5.0.0, but we probably won't ever remove support for them.


Oh... Ok...

Thanks!

Re: Are player attributes getting removed in 5.0.0 ?

PostPosted: Tue Dec 11, 2018 14:44
by Linuxdirk
Are the player attributes already deprecated? I can't remember seeing deprecation warnings when using them in 0.4.17.1.

Re: Are player attributes getting removed in 5.0.0 ?

PostPosted: Tue Dec 11, 2018 14:46
by rubenwardy
Linuxdirk wrote:Are the player attributes already deprecated? I can't remember seeing deprecation warnings when using them in 0.4.17.1.


In 5.0.0, yes

Re: Are player attributes getting removed in 5.0.0 ?

PostPosted: Sat May 11, 2019 10:21
by Exilyth
rubenwardy wrote:It's worth noting that depends.txt and description.txt are also deprecated in 5.0.0, but we probably won't ever remove support for them.


That's good to know. What's the new mechanism for mod/game dependencies then?

Re: Are player attributes getting removed in 5.0.0 ?

PostPosted: Mon Jun 03, 2019 07:56
by micheal65536
Exilyth wrote:
rubenwardy wrote:It's worth noting that depends.txt and description.txt are also deprecated in 5.0.0, but we probably won't ever remove support for them.


That's good to know. What's the new mechanism for mod/game dependencies then?

Not to derail the thread but the new format is mod.conf. Read the documentation here: https://github.com/minetest/minetest/bl ... i.txt#L155