MineClone2/mods/mobs/item.lua

121 lines
3.8 KiB
Lua
Raw Normal View History

2017-01-08 04:57:18 +02:00
----------------
-- Spawn eggs --
----------------
2015-06-29 20:55:56 +03:00
minetest.register_craftitem("mobs:sheep", {
2017-01-08 04:57:18 +02:00
description = "Spawn Sheep",
2015-06-29 20:55:56 +03:00
inventory_image = "spawn_sheep.png",
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
groups = {},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.add_entity(pointed_thing.above, "mobs:sheep")
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
minetest.log("action", placer:get_player_name() .. " placed a sheep at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
end
return itemstack
end,
})
minetest.register_craftitem("mobs:slime", {
2017-01-08 04:57:18 +02:00
description = "Spawn Slime",
2015-06-29 20:55:56 +03:00
inventory_image = "spawn_slime.png",
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
groups = {},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.add_entity(pointed_thing.above, "mobs:slime")
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
minetest.log("action", placer:get_player_name() .. " placed a slime at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
end
return itemstack
end,
})
minetest.register_craftitem("mobs:zombie", {
2017-01-08 04:57:18 +02:00
description = "Spawn Zombie",
2015-06-29 20:55:56 +03:00
inventory_image = "spawn_zombie.png",
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
groups = {},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.add_entity(pointed_thing.above, "mobs:zombie")
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
minetest.log("action", placer:get_player_name() .. " placed a zombie at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
end
return itemstack
end,
})
minetest.register_craftitem("mobs:spider", {
2017-01-08 04:57:18 +02:00
description = "Spawn Spider",
2015-06-29 20:55:56 +03:00
inventory_image = "spawn_spider.png",
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
groups = {},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.add_entity(pointed_thing.above, "mobs:spider")
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
minetest.log("action", placer:get_player_name() .. " placed a spider at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
end
return itemstack
end,
})
minetest.register_craftitem("mobs:creeper", {
2017-01-08 04:57:18 +02:00
description = "Spawn Creeper",
2015-06-29 20:55:56 +03:00
inventory_image = "spawn_creeper.png",
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
groups = {},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.add_entity(pointed_thing.above, "mobs:creeper")
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
minetest.log("action", placer:get_player_name() .. " placed a creeper at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
end
return itemstack
end,
})
---------------------
-- Drop de monstre --
---------------------
minetest.register_craftitem("mobs:rotten_flesh", {
2017-01-08 04:57:18 +02:00
description = "Rotten Flesh",
2015-06-29 20:55:56 +03:00
inventory_image = "rotten_flesh.png",
on_use = minetest.item_eat(2),
})
minetest.register_craftitem("mobs:meat_raw_sheep", {
description = "Raw Mutton",
inventory_image = "mutton_raw.png",
on_use = minetest.item_eat(2),
})
minetest.register_craftitem("mobs:meat_cooked_sheep", {
description = "Cooked Mutton",
inventory_image = "mutton_cooked.png",
on_use = minetest.item_eat(4),
})
minetest.register_craftitem("mobs:spider_eye", {
description = "Spider Eye",
inventory_image = "spider_eye.png",
on_use = minetest.item_eat(2),
})
minetest.register_craft({
type = "cooking",
output = "mobs:meat_cooked_sheep",
recipe = "mobs:meat_raw_sheep",
2017-01-04 12:49:05 +02:00
cooktime = 10,
2015-06-29 20:55:56 +03:00
})