]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/mob/api/api_hook.lua
Implement better path shortcutting when less than 4 steps in path
[Crafter.git] / mods / mob / api / api_hook.lua
index 4d4ee838d8f8b526c431c5e6e1a7263543aec7ae..40b062697d773a1cb9b310ee8b685ab31205e7e0 100644 (file)
@@ -127,7 +127,8 @@ mob_register.mob = true
 mob_register.collision_boundary = def.collision_boundary or 1
 
 if def.pathfinds then
-       mob_register.path = {}
+       --mob_register.path = {}
+       mob_register.pathfinding_timer = 0
 end
 
 mobs.create_movement_functions(def,mob_register)
@@ -159,6 +160,10 @@ mob_register.on_step = function(self, dtime,moveresult)
                        self.look_around(self,dtime)
                end
                
+               if self.pathfinding then
+                       self.pathfinding(self,dtime)
+               end
+
                if self.handle_friendly_in_daylight_timer then
                        self.handle_friendly_in_daylight_timer(self,dtime)
                end