aboutsummaryrefslogtreecommitdiff
path: root/src/nodedef.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-31 12:30:11 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-03-31 12:30:11 +0300
commit280e1a2512c71ef0d38643d8b245c40b285879ae (patch)
tree93b8517ea206e8ceaeeb57e7aca964fc24b35a99 /src/nodedef.cpp
parent1518b8f7538aad3b64a2a8a4ddf285fd22469b94 (diff)
downloaddragonfireclient-280e1a2512c71ef0d38643d8b245c40b285879ae.tar.xz
Allow group:groupname in ABM definition and implement minetest.hash_node_position()
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r--src/nodedef.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index 4b0c4b288..da74c8ce5 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -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;