mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add minetest.unregister_item and minetest.register_alias_force
This commit is contained in:
parent
7eacdc7bb8
commit
aa33166386
8 changed files with 121 additions and 3 deletions
|
@ -466,11 +466,17 @@ public:
|
|||
infostream<<"ItemDefManager: erased alias "<<def.name
|
||||
<<" because item was defined"<<std::endl;
|
||||
}
|
||||
virtual void unregisterItem(const std::string &name)
|
||||
{
|
||||
verbosestream<<"ItemDefManager: unregistering \""<<name<<"\""<<std::endl;
|
||||
|
||||
delete m_item_definitions[name];
|
||||
m_item_definitions.erase(name);
|
||||
}
|
||||
virtual void registerAlias(const std::string &name,
|
||||
const std::string &convert_to)
|
||||
{
|
||||
if(m_item_definitions.find(name) == m_item_definitions.end())
|
||||
{
|
||||
if (m_item_definitions.find(name) == m_item_definitions.end()) {
|
||||
verbosestream<<"ItemDefManager: setting alias "<<name
|
||||
<<" -> "<<convert_to<<std::endl;
|
||||
m_aliases[name] = convert_to;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue