fix detection of dangerous location for flying mobs

This commit is contained in:
Alexander Minges 2020-05-01 14:56:29 +02:00
parent 313fd79612
commit b7ba16f4cd

View file

@ -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?