1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-16 15:30:30 +01:00

Avoid placing eggs over air or ignore

- Solves #141
This commit is contained in:
LeMagnesium 2015-07-21 20:46:34 +02:00
parent 31c40de110
commit 6ddba5a15e

View File

@ -212,11 +212,13 @@ function mobs:register_mob(name, def)
and self.child == false
and math.random(1,self.replace_rate) == 1 then
local pos = self.object:getpos()
local nodeunder = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z})
pos.y = pos.y + self.replace_offset
-- print ("replace node = ".. minetest.get_node(pos).name, pos.y)
if self.replace_what
and self.object:getvelocity().y == 0
and #minetest.find_nodes_in_area(pos, pos, self.replace_what) > 0 then
and #minetest.find_nodes_in_area(pos, pos, self.replace_what) > 0 --then
and nodeunder and nodeunder.name ~= "air" then
--and self.state == "stand" then
minetest.set_node(pos, {name = self.replace_with})
end