summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNovatux <nathanael.courant@laposte.net>2015-05-12 11:19:52 +0200
committerNovatux <nathanael.courant@laposte.net>2015-05-12 20:48:55 +0200
commit75622c30beb390b7ed578010a00390aa971b3951 (patch)
tree3c9ff5b14e97ca60e70beb413fd01e992d6f4129
parentb4c3ff6eab197828d370c30d66e033cde9d2f13d (diff)
downloadminetest-75622c30beb390b7ed578010a00390aa971b3951.tar.gz
minetest-75622c30beb390b7ed578010a00390aa971b3951.tar.bz2
minetest-75622c30beb390b7ed578010a00390aa971b3951.zip
Add code to support raillike group names
-rw-r--r--builtin/game/misc.lua11
-rw-r--r--doc/lua_api.txt4
2 files changed, 15 insertions, 0 deletions
diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua
index c31df541d..a71d5d02a 100644
--- a/builtin/game/misc.lua
+++ b/builtin/game/misc.lua
@@ -112,3 +112,14 @@ function core.record_protection_violation(pos, name)
end
end
+local raillike_ids = {}
+local raillike_cur_id = 0
+function core.raillike_group(name)
+ local id = raillike_ids[name]
+ if not id then
+ raillike_cur_id = raillike_cur_id + 1
+ raillike_ids[name] = raillike_cur_id
+ id = raillike_cur_id
+ end
+ return id
+end
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 8fda137ae..5a1d49d03 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -2190,6 +2190,10 @@ These functions return the leftover itemstack.
* Get rating of a group of an item. (`0` means: not in group)
* `minetest.get_node_group(name, group)`: returns a rating
* Deprecated: An alias for the former.
+* `minetest.raillike_group(name)`: returns a rating
+ * Returns rating of the connect_to_raillike group corresponding to name
+ * If name is not yet the name of a connect_to_raillike group, a new group id
+ * is created, with that name
* `minetest.get_content_id(name)`: returns an integer
* Gets the internal content ID of `name`
* `minetest.get_name_from_content_id(content_id)`: returns a string