Advertisement
Guest User

Untitled

a guest
Sep 24th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. local timer = 0
  2.  
  3. minetest.register_globalstep(function(dtime)
  4.  
  5. timer = timer + dtime
  6.  
  7. -- every 1 second
  8. if timer < 1 then
  9. return
  10. end
  11.  
  12. -- reset time for next check
  13. timer = 0
  14.  
  15. -- loop through all players
  16. for _,player in ipairs(minetest.get_connected_players()) do
  17.  
  18. -- get player position and add 1.5 for head level
  19. local pos = player:get_pos() ; pos.y = pos.y + 1.5
  20.  
  21. local health = player:get_hp()
  22.  
  23. if health > 0 then
  24.  
  25. -- show particle
  26. minetest.add_particle({
  27. pos = pos,
  28. velocity = {
  29. x = math.random() - 0.5,
  30. y = math.random(0.4, 1.0),
  31. z = math.random() - 0.5,
  32. },
  33. size = math.random(2, 4),
  34. vertical = true,
  35. texture = "heart.png",
  36. })
  37. end
  38. end
  39. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement