1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-12 16:58:39 +00:00

Implement player attribute backend (#4155)

* This backend permit mods to store extra players attributes to a common interface.
* Add the obj:set_attribute(attr, value) Lua call
* Add the obj:get_attribute(attr) Lua call

Examples:
* player:set_attribute("home:home", "10,25,-78")
* player:get_attribute("default:mana")

Attributes are saved as a json in the player file in extended_attributes
key

They are saved only if a modification on the attributes occurs and loaded
when emergePlayer is called (they are attached to PlayerSAO).
This commit is contained in:
Loïc Blot 2017-01-27 08:59:30 +01:00 committed by GitHub
parent 2a89531071
commit b7a98e9850
9 changed files with 128 additions and 6 deletions

View file

@ -791,6 +791,7 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, u16 peer_id_, bool is_singleplayer
m_pitch(0),
m_fov(0),
m_wanted_range(0),
m_extended_attributes_modified(false),
// public
m_physics_override_speed(1),
m_physics_override_jump(1),