[creatures] Make sure that 'self.last_node' not 'nil' (#22)
This commit is contained in:
parent
2814ceb050
commit
c2bedc3816
@ -480,7 +480,7 @@ creatures.on_step = function(self, dtime)
|
|||||||
local sn = core.get_node_or_nil(p)
|
local sn = core.get_node_or_nil(p)
|
||||||
local eat_node
|
local eat_node
|
||||||
for _,name in pairs(nodes) do
|
for _,name in pairs(nodes) do
|
||||||
if name == self.last_node.name then
|
if self.last_node ~= nil and name == self.last_node.name then
|
||||||
eat_node = current_pos
|
eat_node = current_pos
|
||||||
break
|
break
|
||||||
elseif sn and sn.name == name then
|
elseif sn and sn.name == name then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user