Skip to content

Commit

Permalink
Add code to support raillike group names
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekdohibs committed May 12, 2015
1 parent b4c3ff6 commit 75622c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions builtin/game/misc.lua
Expand Up @@ -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
4 changes: 4 additions & 0 deletions doc/lua_api.txt
Expand Up @@ -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
Expand Down

0 comments on commit 75622c3

Please sign in to comment.