X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=mods%2Fmob%2Fapi%2Fapi_hook.lua;h=3c88b35125dc3495b9e4cf577d9270125d3b3b6a;hb=a5f470ad91240a9c31654c65ec627c116bcf700a;hp=d4913a4b81bdb92f46a99cedd782e7c42bc4e7fb;hpb=274aa90ba2057fe926b112e4eceef556b72f7601;p=Crafter.git diff --git a/mods/mob/api/api_hook.lua b/mods/mob/api/api_hook.lua index d4913a4..3c88b35 100644 --- a/mods/mob/api/api_hook.lua +++ b/mods/mob/api/api_hook.lua @@ -13,7 +13,7 @@ mobs.register_mob = function(def) -mob_register = {} +local mob_register = {} ------------------------------------------------ mob_register.initial_properties = { @@ -56,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 @@ -78,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 @@ -92,20 +96,25 @@ mob_register.attacked_hostile = def.attacked_hostile mob_register.projectile_timer = 0 mob_register.projectile_type = def.projectile_type +mob_register.takes_fall_damage = def.takes_fall_damage or true mob_register.item_drop = def.item_drop -mob_register.item_minimum = def.item_minimum or def.item_amount -mob_register.item_amount = def.item_amount +mob_register.item_minimum = def.item_minimum or 1 +mob_register.item_max = def.item_max 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) @@ -120,10 +129,14 @@ mob_register.on_step = function(self, dtime) end self.collision_detection(self) - self.fall_damage(self) + if self.fall_damage then + self.fall_damage(self) + end 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 @@ -131,7 +144,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)