Difference between revisions of "minetest.raillike group"
m (Add sort key) |
ROllerozxa (talk | contribs) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | {{UnofficialLua}} | ||
{{DISPLAYTITLE:minetest.raillike_group}} | {{DISPLAYTITLE:minetest.raillike_group}} | ||
− | Creates or retrieves a rating value based on a name, for use with the <code>connect_to_raillike</code> group in | + | Creates or retrieves a rating value based on a name, for use with the <code>connect_to_raillike</code> group in minetest.register_node. |
− | |||
− | |||
− | |||
== Description == | == Description == |
Latest revision as of 13:57, 25 October 2022
This page contains unofficial, low-quality Lua API documentation and is likely to be outdated or wrong. Do not rely on it! For the official and up-to-date documentation, see Lua API Documentation. |
This page has been proposed for deletion for the following reason: "Contains unofficial and potentially outdated, redundant and inconsistent Lua API information" If you don't think that this page should be deleted, please explain why on the talk page. |
Creates or retrieves a rating value based on a name, for use with the connect_to_raillike
group in minetest.register_node.
Description
When defining a node, the connect_to_raillike
group requires a numeric rating value, so that nodes with the same rating can connect together (like rails do when placing them next to each other). This function registers (if it does not exist) or retrieves (if it already exists) a rating value based on a name, and returns it. That name can be shared by multiple mods, so that all mods that use the same name will be assigned the same rating value.
Example
This code will create a node "my_mod:my_gunpowder" that will be able to connect to any nodes that used the name "gunpowder" to invoke this function, like the TNT mod in the Minetest game, but won't be able to connect to any nodes that used a different name, even if adjacent:
minetest.register_node("my_mod:my_gunpowder", {
...
drawtype = "raillike",
...
groups = { connect_to_raillike = minetest.raillike_group("gunpowder"),
... }
})