X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=mods%2Fmob%2Fapi%2Fapi_hook.lua;h=40b062697d773a1cb9b310ee8b685ab31205e7e0;hb=1722fde2cef43a27682f5aac6c3577bb1140397b;hp=8f945b859388f047db4e22cb48fc9a3c9d269ac1;hpb=c09067c77ece357b018dd03963e0a1e19f9c4686;p=Crafter.git diff --git a/mods/mob/api/api_hook.lua b/mods/mob/api/api_hook.lua index 8f945b8..40b0626 100644 --- a/mods/mob/api/api_hook.lua +++ b/mods/mob/api/api_hook.lua @@ -55,7 +55,13 @@ mob_register.death_animation_timer = 0 mob_register.dead = false mob_register.mob = true + mob_register.hostile = def.hostile +if def.friendly_in_daylight == true then + mob_register.friendly_in_daylight = def.friendly_in_daylight + mob_register.friendly_in_daylight_timer = 0 +end + mob_register.hostile_cooldown = def.hostile_cooldown mob_register.hostile_timer = 0 @@ -121,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) @@ -153,6 +160,14 @@ 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 + self.manage_punch_timer(self,dtime) else self.manage_death_animation(self,dtime)