Are player attributes getting removed in 5.0.0 ?

Post Reply
User avatar
davidthecreator
Member
Posts: 452
Joined: Mon Aug 18, 2014 19:48
GitHub: daviddoesminetest
In-game: DavidDoesMinetest
Location: Lithuania

Are player attributes getting removed in 5.0.0 ?

by davidthecreator » Post

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

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: Are player attributes getting removed in 5.0.0 ?

by rubenwardy » Post

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.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
davidthecreator
Member
Posts: 452
Joined: Mon Aug 18, 2014 19:48
GitHub: daviddoesminetest
In-game: DavidDoesMinetest
Location: Lithuania

Re: Are player attributes getting removed in 5.0.0 ?

by davidthecreator » Post

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!

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Are player attributes getting removed in 5.0.0 ?

by Linuxdirk » Post

Are the player attributes already deprecated? I can't remember seeing deprecation warnings when using them in 0.4.17.1.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: Are player attributes getting removed in 5.0.0 ?

by rubenwardy » Post

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
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

Exilyth
Member
Posts: 73
Joined: Sun Jul 28, 2013 18:46
Location: Earth

Re: Are player attributes getting removed in 5.0.0 ?

by Exilyth » Post

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?

micheal65536
Member
Posts: 167
Joined: Mon May 22, 2017 20:27

Re: Are player attributes getting removed in 5.0.0 ?

by micheal65536 » Post

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

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests