builtin_entities.txt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. # Builtin Entities
  2. Minetest registers two entities by default: Falling nodes and dropped items.
  3. This document describes how they behave and what you can do with them.
  4. ## Falling node (`__builtin:falling_node`)
  5. This entity is created by `minetest.check_for_falling` in place of a node
  6. with the special group `falling_node=1`. Falling nodes can also be created
  7. artificially with `minetest.spawn_falling_node`.
  8. Needs manual initialization when spawned using `/spawnentity`.
  9. Default behaviour:
  10. * Falls down in a straight line (gravity = `movement_gravity` setting)
  11. * Collides with `walkable` node
  12. * Collides with all physical objects except players
  13. * If the node group `float=1` is set, it also collides with liquid nodes
  14. * When it hits a solid (=`walkable`) node, it will try to place itself as a
  15. node, replacing the node above.
  16. * If the falling node cannot replace the destination node, it is dropped.
  17. * If the destination node is a leveled node (`paramtype2="leveled"`) of the
  18. same node name, the levels of both are summed.
  19. ### Entity fields
  20. * `set_node(self, node[, meta])`
  21. * Function to initialize the falling node
  22. * `node` and `meta` are explained below.
  23. * The `meta` argument is optional.
  24. * `node`: Node table of the node (`name`, `param1`, `param2`) that this
  25. entity represents. Read-only.
  26. * `meta`: Node metadata of the falling node. Will be used when the falling
  27. nodes tries to place itself as a node. Read-only.
  28. ### Rendering / supported nodes
  29. Falling nodes have visuals to look as close as possible to the original node.
  30. This works for most drawtypes, but there are limitations.
  31. Supported drawtypes:
  32. * `normal`
  33. * `signlike`
  34. * `torchlike`
  35. * `nodebox`
  36. * `raillike`
  37. * `glasslike`
  38. * `glasslike_framed`
  39. * `glasslike_framed_optional`
  40. * `allfaces`
  41. * `allfaces_optional`
  42. * `firelike`
  43. * `mesh`
  44. * `fencelike`
  45. * `liquid`
  46. * `airlike` (not pointable)
  47. Other drawtypes still kinda work, but they might look weird.
  48. Supported `paramtype2` values:
  49. * `wallmounted`
  50. * `facedir`
  51. * `colorwallmounted`
  52. * `colorfacedir`
  53. * `color`
  54. ## Dropped item stack (`__builtin:item`)
  55. This is an item stack in a collectable form.
  56. Common cases that spawn a dropped item:
  57. * Item dropped by player
  58. * The root node of a node with the group `attached_node=1` is removed
  59. * `minetest.add_item` is called
  60. Needs manual initialization when spawned using `/spawnentity`.
  61. ### Behavior
  62. * Players can collect it by punching
  63. * Lifespan is defined by the setting `item_entity_ttl`
  64. * Slides on `slippery` nodes
  65. * Subject to gravity (uses `movement_gravity` setting)
  66. * Collides with `walkable` nodes
  67. * Does not collide physical objects
  68. * When it's inside a solid (`walkable=true`) node, it tries to escape to a
  69. neighboring non-solid (`walkable=false`) node
  70. ### Entity fields
  71. * `set_item(self, item)`:
  72. * Function to initialize the dropped item
  73. * `item` (type `ItemStack`) specifies the item to represent
  74. * `age`: Age in seconds. Behaviour according to the setting `item_entity_ttl`
  75. * `itemstring`: Itemstring of the item that this item entity represents.
  76. Read-only.
  77. Other fields are for internal use only.