From 6ddba5a15e18be3ea080a33454759350cb9acd4d Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Tue, 21 Jul 2015 20:46:34 +0200 Subject: [PATCH] Avoid placing eggs over air or ignore - Solves #141 --- mods/mobs/api.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index 75a6fea9..de0bc049 100755 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -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