Minetest: Count Entities

Jun 5th, 2013
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. })
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.