mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-17 16:41:06 +01:00
Dispensers now support spawn eggs
This commit is contained in:
parent
7c3bf9715a
commit
5df8579e88
2 changed files with 16 additions and 3 deletions
|
@ -2826,7 +2826,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
|
||||||
|
|
||||||
if pos
|
if pos
|
||||||
and within_limits(pos, 0)
|
and within_limits(pos, 0)
|
||||||
and not minetest.is_protected(pos, placer:get_player_name()) then
|
and (not placer or not minetest.is_protected(pos, placer:get_player_name())) then
|
||||||
|
|
||||||
pos.y = pos.y + 1
|
pos.y = pos.y + 1
|
||||||
|
|
||||||
|
@ -2840,9 +2840,11 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
|
||||||
|
|
||||||
if ent.type ~= "monster" then
|
if ent.type ~= "monster" then
|
||||||
-- set owner and tame if not monster
|
-- set owner and tame if not monster
|
||||||
|
if placer then
|
||||||
ent.owner = placer:get_player_name()
|
ent.owner = placer:get_player_name()
|
||||||
ent.tamed = true
|
ent.tamed = true
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- if not in creative then take item
|
-- if not in creative then take item
|
||||||
if not creative then
|
if not creative then
|
||||||
|
|
|
@ -298,6 +298,17 @@ local dispenserdef = {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elseif igroups.spawn_egg then
|
||||||
|
-- Place spawn egg
|
||||||
|
if not dropnodedef.walkable then
|
||||||
|
pointed_thing = { above = droppos, under = { x=droppos.x, y=droppos.y-1, z=droppos.z } }
|
||||||
|
|
||||||
|
minetest.registered_items[iname].on_place(ItemStack(iname), nil, pointed_thing)
|
||||||
|
|
||||||
|
stack:take_item()
|
||||||
|
inv:set_stack("main", stack_id, stack)
|
||||||
|
end
|
||||||
|
|
||||||
-- TODO: Many other dispenser actions
|
-- TODO: Many other dispenser actions
|
||||||
else
|
else
|
||||||
-- Drop item
|
-- Drop item
|
||||||
|
|
Loading…
Reference in a new issue