mirror of
https://github.com/luanti-org/luanti.git
synced 2025-12-29 17:45:22 +01:00
Player attrs: permits to remove an attribute by setting value to nil (#5716)
* Player attrs: permits to remove an attribute by setting value to nil
When doing player:set_attribute("attr", nil) remove attribute
Also remove a useless check on C++ API part (already done by checkplayer)
Fix #5709
This commit is contained in:
@@ -277,6 +277,16 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void removeExtendedAttribute(const std::string &attr)
|
||||
{
|
||||
PlayerAttributes::iterator it = m_extra_attributes.find(attr);
|
||||
if (it == m_extra_attributes.end())
|
||||
return;
|
||||
|
||||
m_extra_attributes.erase(it);
|
||||
m_extended_attributes_modified = true;
|
||||
}
|
||||
|
||||
inline const PlayerAttributes &getExtendedAttributes()
|
||||
{
|
||||
return m_extra_attributes;
|
||||
|
||||
Reference in New Issue
Block a user