X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=mods%2Fmob%2Fapi%2Fapi_hook.lua;h=7ddadf1207507717faa4006aa5de1efc009656c8;hb=bfb749e695c505a76280fcbf9137c4fcc2cdb5a5;hp=4d4ee838d8f8b526c431c5e6e1a7263543aec7ae;hpb=f50031b5a6e2675312185c64cd0a2fb9f811796f;p=Crafter.git diff --git a/mods/mob/api/api_hook.lua b/mods/mob/api/api_hook.lua index 4d4ee83..7ddadf1 100644 --- a/mods/mob/api/api_hook.lua +++ b/mods/mob/api/api_hook.lua @@ -55,6 +55,7 @@ mob_register.death_animation_timer = 0 mob_register.dead = false mob_register.mob = true +mob_register.mobname = def.mobname mob_register.hostile = def.hostile if def.friendly_in_daylight == true then @@ -97,7 +98,9 @@ mob_register.explosion_blink_color = def.explosion_blink_color or "white" mob_register.explosion_blink_timer = def.explosion_blink_timer or 0.2 mob_register.custom_function_begin = def.custom_function_begin +mob_register.custom_function = def.custom_function mob_register.custom_function_end = def.custom_function_end + mob_register.projectile_timer_cooldown = def.projectile_timer_cooldown mob_register.attacked_hostile = def.attacked_hostile @@ -122,12 +125,17 @@ mob_register.hurt_color_timer = 0 mob_register.damage_color = def.damage_color or "red" mob_register.custom_on_death = def.custom_on_death -mob_register.mob = true - -mob_register.collision_boundary = def.collision_boundary or 1 +mob_register.custom_on_activate = def.custom_on_activate if def.pathfinds then - mob_register.path = {} + --mob_register.path = {} + mob_register.pathfinding_timer = 0 +end + +if def.custom_timer then + mob_register.c_timer = 0 + mob_register.custom_timer = def.custom_timer + mob_register.custom_timer_function = def.custom_timer_function end mobs.create_movement_functions(def,mob_register) @@ -148,9 +156,20 @@ mob_register.on_step = function(self, dtime,moveresult) end if self.dead == false and self.death_animation_timer == 0 then + if self.do_custom_timer then + self.do_custom_timer(self,dtime) + end + + if self.custom_function then + self.custom_function(self,dtime,moveresult) + end + self.move(self,dtime,moveresult) + --self.debug_nametag(self,dtime) + self.manage_hurt_color_timer(self,dtime) + if self.set_animation then self.set_animation(self) end @@ -159,6 +178,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