object.lua 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. ---@meta
  2. ---Object properties
  3. --------------------
  4. -- Used by `ObjectRef` methods. Part of an Entity definition.
  5. -- These properties are not persistent, but are applied automatically to the
  6. -- corresponding Lua entity using the given registration fields.
  7. -- Player properties need to be saved manually.
  8. ---@class mt.ObjectProp
  9. -- For players only. Defaults to `minetest.PLAYER_MAX_HP_DEFAULT`.
  10. ---@field hp_max integer
  11. -- For players only. Defaults to `minetest.PLAYER_MAX_BREATH_DEFAULT`.
  12. ---@field breath_max integer
  13. -- For players only. Zoom FOV in degrees.
  14. -- Note that zoom loads and/or generates world beyond the server's
  15. -- maximum send and generate distances, so acts like a telescope.
  16. -- Smaller zoom_fov values increase the distance loaded/generated.
  17. -- Defaults to 15 in creative mode, 0 in survival mode.
  18. -- zoom_fov = 0 disables zooming for the player.
  19. ---@field zoom_fov number
  20. -- For players only. Camera height above feet position in nodes.
  21. -- Defaults to 1.625.
  22. ---@field eye_height number
  23. -- Collide with `walkable` nodes.
  24. ---@field physical boolean
  25. -- Collide with other objects if physical = true
  26. ---@field collide_with_objects boolean
  27. -- * `{xmin, ymin, zmin, xmax, ymax, zmax}` in nodes from object position.
  28. -- * Default: `{-0.5, 0.0, -0.5, 0.5, 1.0, 0.5}`.
  29. ---@field collisionbox number[]
  30. -- * `{xmin, ymin, zmin, xmax, ymax, zmax}` in nodes from object position.
  31. -- * Selection box uses collision box dimensions when not set.
  32. ---@field selectionbox number[]
  33. -- Overrides selection box when false
  34. ---@field pointable boolean
  35. -- * "cube" is a node-sized cube.
  36. -- * "sprite" is a flat texture always facing the player.
  37. -- * "upright_sprite" is a vertical flat texture.
  38. -- * "mesh" uses the defined mesh model.
  39. -- * "item" is similar to "wielditem" but ignores the 'wield_image' parameter.
  40. -- * "wielditem" is used for dropped items.
  41. -- (see builtin/game/item_entity.lua).
  42. -- For this use 'wield_item = itemname' (Deprecated: 'textures = {itemname}').
  43. -- If the item has a 'wield_image' the object will be an extrusion of
  44. -- that, otherwise:
  45. -- If 'itemname' is a cubic node or nodebox the object will appear
  46. -- identical to 'itemname'.
  47. -- If 'itemname' is a plantlike node the object will be an extrusion
  48. -- of its texture.
  49. -- Otherwise for non-node items, the object will be an extrusion of
  50. -- 'inventory_image'.
  51. -- If 'itemname' contains a ColorString or palette index (e.g. from
  52. -- `minetest.itemstring_with_palette()`), the entity will inherit the color.
  53. ---@field visual "cube"|"sprite"|"upright_sprite"|"mesh"|"item"|"wielditem"
  54. -- Multipliers for the visual size. If `z` is not specified, `x` will be used
  55. -- to scale the entity along both horizontal axes.
  56. ---@field visual_size mt.Vector
  57. -- File name of mesh when using "mesh" visual
  58. ---@field mesh string
  59. -- Number of required textures depends on visual.
  60. -- * "cube" uses 6 textures just like a node, but all 6 must be defined.
  61. -- * "sprite" uses 1 texture.
  62. -- * "upright_sprite" uses 2 textures: {front, back}.
  63. -- * "wielditem" expects 'textures = {itemname}' (see 'visual' above).
  64. -- * "mesh" requires one texture for each mesh buffer/material (in order).
  65. ---@field textures string[]
  66. -- Number of required colors depends on visual.
  67. ---@field colors mt.ColorSpec[]
  68. -- Use texture's alpha channel.
  69. -- * Excludes "upright_sprite" and "wielditem".
  70. -- * Note: currently causes visual issues when viewed through other
  71. -- semi-transparent materials such as water.
  72. ---@field use_texture_alpha boolean
  73. -- Used with spritesheet textures for animation and/or frame selection
  74. -- according to position relative to player.
  75. -- Defines the number of columns and rows in the spritesheet:
  76. -- `{columns, rows}`.
  77. ---@field spritediv {x: integer, y: integer}
  78. -- Used with spritesheet textures.
  79. -- Defines the `{column, row}` position of the initially used frame in the
  80. -- spritesheet.
  81. ---@field initial_sprite_basepos {x: integer, y: integer}
  82. -- If false, object is invisible and can't be pointed.
  83. ---@field is_visible boolean
  84. -- If true, is able to make footstep sounds of nodes
  85. -- (see node sound definition for details).
  86. ---@field makes_footstep_sound boolean
  87. -- Set constant rotation in radians per second, positive or negative.
  88. -- Object rotates along the local Y-axis, and works with set_rotation.
  89. -- Set to 0 to disable constant rotation.
  90. ---@field automatic_rotate number
  91. -- If positive number, object will climb upwards when it moves
  92. -- horizontally against a `walkable` node, if the height difference
  93. -- is within `stepheight`.
  94. ---@field stepheight number
  95. -- Automatically set yaw to movement direction, offset in degrees.
  96. -- 'false' to disable.
  97. ---@field automatic_face_movement_dir number
  98. -- Limit automatic rotation to this value in degrees per second.
  99. -- No limit if value <= 0.
  100. ---@field automatic_face_movement_max_rotation_per_sec number
  101. -- Set to false to disable backface_culling for model
  102. ---@field backface_culling boolean
  103. -- Add this much extra lighting when calculating texture color.
  104. -- Value < 0 disables light's effect on texture color.
  105. -- For faking self-lighting, UI style entities, or programmatic coloring
  106. -- in mods.
  107. ---@field glow integer
  108. -- The name to display on the head of the object. By default empty.
  109. -- If the object is a player, a nil or empty nametag is replaced by the player's name.
  110. -- For all other objects, a nil or empty string removes the nametag.
  111. -- To hide a nametag, set its color alpha to zero. That will disable it entirely.
  112. ---@field nametag string
  113. -- Sets text color of nametag
  114. ---@field nametag_color mt.ColorSpec
  115. -- Sets background color of nametag
  116. -- `false` will cause the background to be set automatically based on user settings.
  117. -- Default: false
  118. ---@field nametag_bgcolor mt.ColorSpec
  119. -- Same as infotext for nodes. Empty by default
  120. ---@field infotext string
  121. -- If false, never save this object statically. It will simply be
  122. -- deleted when the block gets unloaded.
  123. -- The get_staticdata() callback is never called then.
  124. -- Defaults to 'true'.
  125. ---@field static_save boolean
  126. -- Texture modifier to be applied for a short duration when object is hit
  127. ---@field damage_texture_modifier string
  128. -- Setting this to 'false' disables diffuse lighting of entity
  129. ---@field shaded boolean
  130. -- Defaults to true for players, false for other entities.
  131. -- If set to true the entity will show as a marker on the minimap.
  132. ---@field show_on_minimap boolean