particle.lua 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. ---@meta
  2. ---Particle definition
  3. ----------------------
  4. -- Used by `minetest.add_particle`.
  5. ---@class mt.ParticleDef
  6. ---@field pos mt.Vector
  7. ---@field velocity mt.Vector
  8. -- Spawn particle at pos with velocity and acceleration.
  9. ---@field acceleration mt.Vector
  10. -- Disappears after expirationtime seconds.
  11. ---@field expirationtime number
  12. -- * Scales the visual size of the particle texture.
  13. -- * If `node` is set, size can be set to 0 to spawn a randomly-sized
  14. -- particle (just like actual node dig particles).
  15. ---@field size number
  16. -- If true collides with `walkable` nodes and, depending on the
  17. -- `object_collision` field, objects too.
  18. ---@field collisiondetection boolean
  19. -- If true particle is removed when it collides.
  20. -- Requires collisiondetection = true to have any effect.
  21. ---@field collision_removal boolean
  22. -- * If true particle collides with objects that are defined as
  23. -- `physical = true` and `collide_with_objects = true`.
  24. -- * Requires collisiondetection = true to have any effect.
  25. ---@field object_collision boolean
  26. -- If true faces player using y axis only.
  27. ---@field vertical boolean
  28. -- The texture of the particle.
  29. ---@field texture string
  30. -- Optional, if specified spawns particle only on the player's client.
  31. ---@field playername string|nil
  32. -- Optional, specifies how to animate the particle texture.
  33. ---@field animation mt.TileAnimDef|nil
  34. -- * Optional, specify particle self-luminescence in darkness.
  35. -- * Values: `0..14`.
  36. ---@field glow number|nil
  37. -- * Optional, if specified the particle will have the same appearance as
  38. -- node dig particles for the given node.
  39. -- * `texture` and `animation` will be ignored if this is set.
  40. ---@field node mt.Node|nil
  41. -- * Optional, only valid in combination with `node`
  42. -- If set to a valid number 1-6, specifies the tile from which the
  43. -- particle texture is picked.
  44. -- * Otherwise, the default behavior is used. (currently: any random tile)
  45. ---@field node_tile number|nil
  46. ---ParticleSpawner definition
  47. -------------------------------
  48. -- Used by `minetest.add_particlespawner`.
  49. --
  50. -- The particles' properties are random values between the min and max values.
  51. -- Applies to: pos, velocity, acceleration, expirationtime, size.
  52. -- If `node` is set, min and maxsize can be set to 0 to spawn
  53. -- randomly-sized particles (just like actual node dig particles).
  54. ---@class mt.ParticleSpawnerDef
  55. -- Number of particles spawned over the time period `time`.
  56. ---@field amount number
  57. -- Lifespan of spawner in seconds.
  58. -- If time is 0 spawner has infinite lifespan and spawns the `amount` on
  59. -- a per-second basis.
  60. ---@field time number
  61. ---@field minpos mt.Vector
  62. ---@field maxpos mt.Vector
  63. ---@field minvel mt.Vector
  64. ---@field maxvel mt.Vector
  65. ---@field minacc mt.Vector
  66. ---@field maxacc mt.Vector
  67. ---@field minexptime number
  68. ---@field maxexptime number
  69. ---@field minsize number
  70. ---@field maxsize number
  71. -- If true collide with `walkable` nodes and, depending on the
  72. -- `object_collision` field, objects too.
  73. ---@field collisiondetection boolean
  74. -- If true particles are removed when they collide.
  75. -- Requires collisiondetection = true to have any effect.
  76. ---@field collision_removal boolean
  77. -- If true particles collide with objects that are defined as
  78. -- `physical = true,` and `collide_with_objects = true,`.
  79. -- Requires collisiondetection = true to have any effect.
  80. ---@field object_collision boolean
  81. -- If defined, particle positions, velocities and accelerations are
  82. -- relative to this object's position and yaw.
  83. ---@field attached mt.ObjectRef
  84. -- If true face player using y axis only.
  85. ---@field vertical boolean
  86. -- The texture of the particle.
  87. ---@field texture string
  88. -- Optional, if specified spawns particles only on the player's client.
  89. ---@field playername string|nil
  90. -- Optional, specifies how to animate the particles' texture.
  91. ---@field animation mt.TileAnimDef|nil
  92. -- * Optional, specify particle self-luminescence in darkness.
  93. -- * Values: `0..14`.
  94. ---@field glow number|nil
  95. -- Optional, if specified the particles will have the same appearance as
  96. -- node dig particles for the given node.
  97. -- `texture` and `animation` will be ignored if this is set.
  98. ---@field node mt.Node|nil
  99. -- * Optional, only valid in combination with `node`.
  100. -- * If set to a valid number 1-6, specifies the tile from which the
  101. -- particle texture is picked.
  102. -- * Otherwise, the default behavior is used (currently: any random tile).
  103. ---@field node_tile number|nil