Are player attributes getting removed in 5.0.0 ?

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

Are player attributes getting removed in 5.0.0 ?

by davidthecreator » Tue Dec 11, 2018 14:10

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: 5859
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Are player attributes getting removed in 5.0.0 ?

by rubenwardy » Tue Dec 11, 2018 14:18

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.
 

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

Re: Are player attributes getting removed in 5.0.0 ?

by davidthecreator » Tue Dec 11, 2018 14:22

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: 2197
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: Are player attributes getting removed in 5.0.0 ?

by Linuxdirk » Tue Dec 11, 2018 14:44

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: 5859
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Are player attributes getting removed in 5.0.0 ?

by rubenwardy » Tue Dec 11, 2018 14:46

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
 

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

Re: Are player attributes getting removed in 5.0.0 ?

by Exilyth » Sat May 11, 2019 10:21

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: 130
Joined: Mon May 22, 2017 20:27

Re: Are player attributes getting removed in 5.0.0 ?

by micheal65536 » Mon Jun 03, 2019 07:56

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
 


Return to Feature Discussion



Who is online

Users browsing this forum: No registered users and 2 guests