1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Allow group:groupname in ABM definition and implement minetest.hash_node_position()

This commit is contained in:
Perttu Ahola 2012-03-31 12:30:11 +03:00
parent 1518b8f753
commit 280e1a2512
5 changed files with 54 additions and 15 deletions

View file

@ -380,6 +380,25 @@ public:
getId(name, id);
return id;
}
virtual void getIds(const std::string &name, std::set<content_t> &result)
const
{
if(name.substr(0,6) != "group:"){
content_t id = CONTENT_IGNORE;
if(getId(name, id))
result.insert(id);
return;
}
std::string group = name.substr(6);
for(u16 id=0; id<=MAX_CONTENT; id++)
{
const ContentFeatures &f = m_content_features[id];
if(f.name == "") // Quickly discard undefined nodes
continue;
if(itemgroup_get(f.groups, group) != 0)
result.insert(id);
}
}
virtual const ContentFeatures& get(const std::string &name) const
{
content_t id = CONTENT_IGNORE;