Advertisement
kaeza

Minetest: Count Entities

Jun 5th, 2013
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.42 KB | None | 0 0
  1. minetest.register_chatcommand("ce", {
  2.     params = "[<range>]",
  3.     description = "Counts entities in a <range> radius sphere. Default is 5.",
  4.     func = function(name, param)
  5.         local n = tonumber(param)
  6.         if n == nil then n = 5 end
  7.         local p = minetest.get_player_by_name(name)
  8.         local l = minetest.get_objects_inside_radius(p:getpos(), n)
  9.         minetest.chat_send_player(name, "There are "..(#l).." entities in the area.")
  10.     end,
  11. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement