]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/mob/api/api_hook.lua
Optimize a ton of globals to locals
[Crafter.git] / mods / mob / api / api_hook.lua
index 7ddadf1207507717faa4006aa5de1efc009656c8..4607bf2049fc397e742c94ad032e571443a8ed17 100644 (file)
@@ -1,3 +1,4 @@
+local minetest = minetest
 --class 
 mobs = {}
 
@@ -46,8 +47,9 @@ if def.head_bone then
        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
+       mob_register.flip_pitch = def.flip_pitch
 else
-       print("create some other functions to turn mob " .. def.mobname)
+       --print("create some other functions to turn mob " .. def.mobname)
 end
 
 mob_register.hurt_inside_timer = 0
@@ -89,6 +91,7 @@ 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
+       mob_register.explosion_type = def.explosion_type
 end
 mob_register.explosion_radius = def.explosion_radius
 mob_register.explosion_power = def.explosion_power
@@ -103,7 +106,11 @@ 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
-
+if not def.hostile and not def.attacked_hostile then
+       mob_register.scared = false
+       mob_register.scared_timer = 0
+end
+mob_register.attack_damage = def.attack_damage
 
 mob_register.projectile_timer = 0
 mob_register.projectile_type = def.projectile_type
@@ -127,6 +134,16 @@ mob_register.custom_on_death = def.custom_on_death
 
 mob_register.custom_on_activate = def.custom_on_activate
 
+mob_register.custom_on_punch = def.custom_on_punch
+
+mob_register.c_mob_data = def.c_mob_data
+
+mob_register.deactivating = false
+
+mob_register.on_fire = false
+
+mob_register.fire_table = def.fire_table
+
 if def.pathfinds then
        --mob_register.path = {}
        mob_register.pathfinding_timer = 0
@@ -170,6 +187,10 @@ mob_register.on_step = function(self, dtime,moveresult)
 
                self.manage_hurt_color_timer(self,dtime)
 
+               if self.manage_scared_timer then
+                       self.manage_scared_timer(self,dtime)
+               end
+
                if self.set_animation then
                        self.set_animation(self)
                end