fix detection of dangerous location for flying mobs
This commit is contained in:
parent
313fd79612
commit
b7ba16f4cd
1 changed files with 13 additions and 3 deletions
|
@ -2032,11 +2032,21 @@ local do_states = function(self, dtime)
|
||||||
|
|
||||||
local is_in_danger = false
|
local is_in_danger = false
|
||||||
if lp then
|
if lp then
|
||||||
-- If mob in or on dangerous block, look for land
|
-- if mob is flying, check if it is in its preferred medium
|
||||||
if (is_node_dangerous(self, self.standing_in) or
|
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_node_dangerous(self, self.standing_on)) then
|
||||||
is_in_danger = true
|
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"})
|
lp = minetest.find_node_near(s, 5, {"group:solid"})
|
||||||
|
|
||||||
-- did we find land?
|
-- did we find land?
|
||||||
|
|
Loading…
Add table
Reference in a new issue