diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 4a4a56bb..c027ce16 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -2032,11 +2032,21 @@ local do_states = function(self, dtime) local is_in_danger = false if lp then - -- If mob in or on dangerous block, look for land - if (is_node_dangerous(self, self.standing_in) or + -- if mob is flying, check if it is in its preferred medium + if self.fly then + if minetest.get_item_group(self.standing_in, self.fly_in) then + is_in_danger = false + elseif is_node_dangerous(self, self.standing_in) then + is_in_danger = true + end + elseif (is_node_dangerous(self, self.standing_in) or is_node_dangerous(self, self.standing_on)) then is_in_danger = true - + end + -- If mob in or on dangerous block, look for land + if is_in_danger then + minetest.log(self.name .. " is in/on dangerous node " .. self.standing_on .. " or " .. self.standing_in) + minetest.log(self.water_damage) lp = minetest.find_node_near(s, 5, {"group:solid"}) -- did we find land?