Added nil check

This commit is contained in:
ElCeejo 2021-10-03 17:55:57 -07:00 committed by GitHub
parent d41679d41d
commit b548582ae1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -914,8 +914,9 @@ function animalia.hq_wander_ranged(self, prty)
pos.z + random(-1, 1)
)
local node = minetest.get_node(random_goal)
if minetest.registered_nodes[node.name].drawtype == "liquid"
or minetest.registered_nodes[node.name].walkable then
if node.name
and (minetest.registered_nodes[node.name].drawtype == "liquid"
or minetest.registered_nodes[node.name].walkable) then
random_goal = nil
end
if self.lasso_pos
@ -1512,4 +1513,4 @@ function animalia.head_tracking(self)
end
move_head(self, tyaw, dir.y)
end
end
end