]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/mob/api/api_hook.lua
Turn off nametags as they break the animation
[Crafter.git] / mods / mob / api / api_hook.lua
index 0376f11d7f9e40cf56ece3bfbdb7147640523f9f..ba070bcbced8f638f255ed7e1c646a21c31ce624 100644 (file)
@@ -13,7 +13,7 @@ mobs.register_mob = function(def)
 
 
 
-mob_register = {}
+local mob_register = {}
 
 ------------------------------------------------
 mob_register.initial_properties = {
@@ -45,6 +45,7 @@ if def.head_bone then
        mob_register.head_height_offset = def.head_height_offset
        mob_register.head_rotation_offset = def.head_rotation_offset
        mob_register.head_position_correction = def.head_position_correction
+       mob_register.head_coord = def.head_coord
 else
        print("create some other functions to turn mob " .. def.mobname)
 end
@@ -55,6 +56,7 @@ mob_register.dead = false
 
 mob_register.mob = true
 mob_register.hostile = def.hostile
+mob_register.hostile_cooldown = def.hostile_cooldown
 
 mob_register.hostile_timer = 0
 mob_register.timer = 0
@@ -77,6 +79,9 @@ mob_register.hurt_sound = def.hurt_sound
 mob_register.die_sound = def.die_sound
 
 mob_register.attack_type = def.attack_type
+if def.attack_type == "explode" then
+       mob_register.tnt_tick_timer = 0
+end
 mob_register.explosion_radius = def.explosion_radius
 mob_register.explosion_power = def.explosion_power
 mob_register.tnt_timer = nil
@@ -100,11 +105,15 @@ mob_register.die_in_light = def.die_in_light
 mob_register.die_in_light_level = def.die_in_light_level
 
 mob_register.current_animation = 0
+mob_register.hurt_color_timer = 0
 
 mob_register.mob = true
 
 mob_register.collision_boundary = def.collision_boundary or 1
 
+if def.pathfinds then
+       mob_register.path = {}
+end
 
 mobs.create_movement_functions(def,mob_register)
 mobs.create_interaction_functions(def,mob_register)
@@ -123,6 +132,8 @@ mob_register.on_step = function(self, dtime)
        
        if self.dead == false and self.death_animation_timer == 0 then
                self.move(self,dtime)
+               --self.debug_nametag(self,dtime)
+               self.manage_hurt_color_timer(self,dtime)
                self.set_animation(self)
                
                if self.look_around then
@@ -130,7 +141,6 @@ mob_register.on_step = function(self, dtime)
                end
                
                self.manage_punch_timer(self,dtime)
-               --self.debug_nametag(self,dtime)
        else
                self.manage_death_animation(self,dtime)
                self.move_head(self,nil,dtime)