mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Add player:get_meta(), deprecate player attributes (#7202)
* Add player:get_meta(), deprecate player attributes
This commit is contained in:
@@ -72,14 +72,15 @@ void RemotePlayer::serializeExtraAttributes(std::string &output)
|
||||
{
|
||||
assert(m_sao);
|
||||
Json::Value json_root;
|
||||
const PlayerAttributes &attrs = m_sao->getExtendedAttributes();
|
||||
|
||||
const StringMap &attrs = m_sao->getMeta().getStrings();
|
||||
for (const auto &attr : attrs) {
|
||||
json_root[attr.first] = attr.second;
|
||||
}
|
||||
|
||||
output = fastWriteJson(json_root);
|
||||
|
||||
m_sao->setExtendedAttributeModified(false);
|
||||
m_sao->getMeta().setModified(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -132,8 +133,9 @@ void RemotePlayer::deSerialize(std::istream &is, const std::string &playername,
|
||||
const Json::Value::Members attr_list = attr_root.getMemberNames();
|
||||
for (const auto &it : attr_list) {
|
||||
Json::Value attr_value = attr_root[it];
|
||||
sao->setExtendedAttribute(it, attr_value.asString());
|
||||
sao->getMeta().setString(it, attr_value.asString());
|
||||
}
|
||||
sao->getMeta().setModified(false);
|
||||
} catch (SettingNotFoundException &e) {}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user