Groups

From Minetest Developer Wiki
Jump to: navigation, search

Groups can be used for several things in Minetest. They are mostly used to define the digging times of nodes, but there many other uses.

Contents

Define groups

The groups of a node or tool are defined in the definiton table:

minetest.register_node("mod:testnode", {
	-- [...]
	groups = {crumbly=1, meat=2,},
})

The rating can be any integer, but 0 is equal to nil.

Group names

This section lists some groups which are used.

Note: Unless specified otherwise, the group rating is assumed to be 1.

Special groups

These groups are directly used by Minetest to treat group members differently, and they are not tied to any particular mod or subgame.

  • immortal: Disables the group damage system for an entity
  • level: Can be used to give an additional sense of progression in the game.
    • A larger level will cause eg. a weapon of a lower level make much less damage, and get weared out much faster, or not be able to get drops from destroyed nodes.
    • 0 is something that is directly accessible at the start of gameplay
    • There is no upper limit
  • dig_immediate: player can always pick up node without tool wear
    • 2: node is removed without tool wear after 0.5 seconds or so (rail, sign)
    • 3: node is removed without tool wear immediately (torch)
  • disable_jump: Player (and possibly other things) cannot jump from node
  • fall_damage_add_percent: Changes the damage taken when the player falls on this node; higher values mean more damage The damage is calculated according to this formula: damage speed = speed * (1 + value/100). Example values:
    • 25: 25% more fall damage
    • -25: 25% less fall damage
    • -100: 100% less fall damage (this disables fall damage entirely)
  • bouncy: value is bounce speed in percent
  • falling_node: if there is no walkable block under the node it will fall
  • attached_node: if the node under it is not a walkable block the node will be dropped as an item. If the node is wallmounted the wallmounted direction is checked.
  • connect_to_raillike: makes nodes of raillike drawtype connect to other group members with same drawtype
  • slippery: Players and items will slide on the node. Slipperiness rises steadily with `slippery` value, starting at 1.

Known custom groups

See Groups/Custom groups.

Other uses

Mods can use groups for whatever they want. They can be used in crafting recipes, ABM definitions and more functions like this: "group:groupname" (e.g. "group:crumbly").

To use them in the mod code the function minetest.get_item_group("name", "group") is useful.

Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox