mcl_devtest/mobtest/init.lua

22 lines
545 B
Lua
Raw Normal View History

2022-05-25 18:15:46 +02:00
math.randomseed(os.time())
minetest.register_chatcommand("mobtest",{
description="Spawns all available mobs",
privs={server=true},
func=function(n,param)
local p=minetest.get_player_by_name(n)
local pos=p:get_pos()
for k,v in pairs(minetest.registered_entities) do
2022-11-14 20:41:18 +01:00
if v.is_mob then
2022-05-25 18:15:46 +02:00
local spos=vector.add(pos,vector.new(math.random(100)-50,0,math.random(100)-50))
2022-11-14 20:41:18 +01:00
local o = mcl_mobs.spawn(spos,v.name)
if o then
local l=o:get_luaentity()
if l and l.on_activate then
l.on_activate(l)
end
end
2022-05-25 18:15:46 +02:00
end
end
end})