add spawn eggs; don't let hopper kill mobs on top

master
Martin Doege 2015-04-16 00:00:44 +02:00
parent 6638579c62
commit 2fd9de52c4
21 changed files with 39 additions and 7 deletions

View File

@ -20,7 +20,7 @@ minetest.register_abm({
local p = minetest.deserialize(q)
local stack = ItemStack(p.itemstring)
local cpos = minetest.find_node_near(pos, 1.5, {"default:chest"})
if cpos then
if cpos and not stack:is_empty() then
local meta = minetest.env:get_meta(cpos)
local inv = meta:get_inventory()
if inv:room_for_item("main", stack) then

View File

@ -728,3 +728,23 @@ function mobs:register_arrow(name, def)
end
})
end
function mobs:register_egg(mob, desc, img)
minetest.register_craftitem(mob, {
description = "Spawn "..desc,
inventory_image = img,
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above
if pointed_thing.above and not minetest.is_protected(pos, placer:get_player_name()) then
pos.y = pos.y + 0.5
minetest.add_entity(pos, mob)
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
end
return itemstack
end,
})
end

View File

@ -953,6 +953,16 @@ minetest.register_craft({
}
})
-- spawn eggs
mobs:register_egg("mobs:chicken", "Chicken", "spawn_egg_chicken.png")
mobs:register_egg("mobs:cow", "Cow", "spawn_egg_cow.png")
mobs:register_egg("mobs:creeper", "Creeper", "spawn_egg_creeper.png")
mobs:register_egg("mobs:pig", "Pig", "spawn_egg_pig.png")
mobs:register_egg("mobs:sheep", "Sheep", "spawn_egg_sheep.png")
mobs:register_egg("mobs:skeleton", "Skeleton", "spawn_egg_skeleton.png")
mobs:register_egg("mobs:zombie", "Zombie", "spawn_egg_zombie.png")
if minetest.setting_get("log_mods") then
minetest.log("action", "mobs loaded")
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 901 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 903 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 925 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

View File

@ -54,12 +54,6 @@ function ocean:register_guardian (name, def)
if guardian_lonely(self, pos) and not minetest.env:find_node_near(pos, 24, def.spawn) then
self.object:remove()
end
if pos.y > 2 then
self.object:setvelocity({x = 0, y = -5, z = 0})
end
if pos.y > 6 then
self.object:remove()
end
local objs = minetest.env:get_objects_inside_radius(pos, 24)
local ppos = {}
local attack_player

View File

@ -1,3 +1,5 @@
default
sponge
fishing
mobs

View File

@ -27,5 +27,6 @@ ocean:register_guardian ("ocean:guardian", {
spawn = "ocean:prismarine"
})
ocean:register_spawn("ocean:guardian", {"default:water_source"},{"ocean:prismarine_bricks","ocean:prismarine"}, 20, 0, 20, 8, 0)
mobs:register_egg("ocean:guardian", "Guardian", "spawn_egg_guardian.png")

View File

@ -2,4 +2,5 @@ default
mesecons_materials
nether
tnt
mobs

View File

@ -94,3 +94,5 @@ slimes:register_spawn("slimes:greenbig", {"default:cobble"},{"default:mossycobbl
slimes:register_spawn("slimes:greenmedium", {"default:cobble"},{"default:mossycobble"}, 20, 15, 20, 8, 32000)
slimes:register_spawn("slimes:greensmall", {"default:cobble"},{"default:mossycobble"}, 20, 15, 8, 8, 32000)
mobs:register_egg("slimes:greenbig", "Slime", "spawn_egg_slime.png")

View File

@ -85,3 +85,5 @@ slimes:register_spawn("slimes:lavabig", {"nether:rack"},{"air","nether:rack"}, 2
slimes:register_spawn("slimes:lavamedium", {"nether:rack"},{"air","nether:rack"}, 20, 4, 10000, 8, -5000)
slimes:register_spawn("slimes:lavasmall", {"nether:rack"},{"air","nether:rack"}, 20, 4, 15000, 8, -5000)
mobs:register_egg("slimes:lavabig", "Magma Cube", "spawn_egg_magma_cube.png")