stop mobs from daydreaming by setting state=stand after they build so they have to reevaluate targets
This commit is contained in:
parent
73af82d0b7
commit
009fb0b159
2
api.lua
2
api.lua
@ -1446,7 +1446,6 @@ minetest.register_entity(name, {
|
|||||||
if math.abs(p1.x-s.x)+math.abs(p1.z-s.z)<0.6 then -- reached waypoint, remove it from queue
|
if math.abs(p1.x-s.x)+math.abs(p1.z-s.z)<0.6 then -- reached waypoint, remove it from queue
|
||||||
table.remove(self.path.way,1);
|
table.remove(self.path.way,1);
|
||||||
end
|
end
|
||||||
|
|
||||||
p = {x=p1.x,y=p1.y,z=p1.z}; -- set new temporary target
|
p = {x=p1.x,y=p1.y,z=p1.z}; -- set new temporary target
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1528,6 +1527,7 @@ minetest.register_entity(name, {
|
|||||||
--minetest.chat_send_all("found path with length " .. #self.path.way);
|
--minetest.chat_send_all("found path with length " .. #self.path.way);
|
||||||
end
|
end
|
||||||
self.path.stuck_timer=0
|
self.path.stuck_timer=0
|
||||||
|
self.state = "stand"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- END PATH FINDING
|
-- END PATH FINDING
|
||||||
|
Loading…
x
Reference in New Issue
Block a user