]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/mob/api/api_hook.lua
Overhaul mob collisionboxes and texture mod handling when hurt
[Crafter.git] / mods / mob / api / api_hook.lua
index 8a7be47ee67c294a656ff8811b95ad29e9d022e6..4a79a895cea50cdbcb05061f033345eef67f883b 100644 (file)
@@ -13,7 +13,7 @@ mobs.register_mob = function(def)
 
 
 
-mob_register = {}
+local mob_register = {}
 
 ------------------------------------------------
 mob_register.initial_properties = {
@@ -101,6 +101,7 @@ 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
 
@@ -119,27 +120,19 @@ mob_register.on_step = function(self, dtime)
                self.custom_function_begin(self,dtime)
        end
        
-       --self.collision_detection(self)
+       self.collision_detection(self)
        self.fall_damage(self)
        
        if self.dead == false and self.death_animation_timer == 0 then
-               --self.move(self,dtime)
-               
-               if not self.yaw then self.yaw = 0 end
-               self.yaw = self.yaw + dtime
-               if self.yaw > math.pi then
-                       self.yaw = -math.pi
-               end
-               self.object:set_velocity(minetest.yaw_to_dir(self.yaw))
+               self.move(self,dtime)
                
+               self.manage_hurt_color_timer(self,dtime)
                self.set_animation(self)
                
                if self.look_around then
                        self.look_around(self,dtime)
                end
                
-               --print(self.object:get_yaw()-(math.pi/2))
-               
                self.manage_punch_timer(self,dtime)
                --self.debug_nametag(self,dtime)
        else