functions.lua 864 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --[[
  2. -- Localize for performance.
  3. local math_random = math.random
  4. function griefer.get_griefer_count(pos)
  5. local ents = minetest.get_objects_inside_radius(pos, 10)
  6. local count = 0
  7. for k, v in ipairs(ents) do
  8. if not v:is_player() then
  9. local tb = v:get_luaentity()
  10. if tb and tb.mob then
  11. if tb.name and tb.name == "griefer:griefer" then
  12. -- Found monster in radius.
  13. count = count + 1
  14. end
  15. end
  16. end
  17. end
  18. return count
  19. end
  20. function griefer.on_stone_construct(pos)
  21. minetest.get_node_timer(pos):start(math_random(10, 60)
  22. end
  23. function griefer.on_stone_timer(pos, elapsed)
  24. minetest.get_node_timer(pos):start(math_random(10, 60)
  25. end
  26. --]]
  27. if not griefer.run_functions_once then
  28. local c = "griefer:functions"
  29. local f = griefer.modpath .. "/functions.lua"
  30. reload.register_file(c, f, false)
  31. griefer.run_functions_once = true
  32. end