]> git.lizzy.rs Git - Crafter.git/blob - mods/mob/chatcommands.lua
Completely rewrite and remake pig model
[Crafter.git] / mods / mob / chatcommands.lua
1 minetest.register_chatcommand("spawn", {
2         params = "<mobname>",
3         description = "Spawn a mob",
4         privs = {give = true},
5         func = function( name, mob)
6                 local input = mob
7                 local amount = 1
8                 local number_of_mobs = input.find(input, "%s%d+")
9                 if number_of_mobs == nil then
10                         input:gsub("%s", "")
11                         input = "mob:"..input
12                 end
13                 if minetest.registered_entities[input] ~= nil then
14                         local pos = minetest.get_player_by_name(name):getpos()
15                         pos.y = pos.y + 1.625
16                         minetest.add_entity(pos,input)
17                 end
18         end,
19 })