1 mobs.create_timer_functions = function(def,mob_register)
2 --this controls how fast the mob punches
3 mob_register.manage_punch_timer = function(self,dtime)
4 if self.punch_timer > 0 then
5 self.punch_timer = self.punch_timer - dtime
7 --this controls how fast you can punch the mob (punched timer reset)
8 if self.punched_timer > 0 then
9 --print(self.punched_timer)
10 self.punched_timer = self.punched_timer - dtime
14 --this controls the hostile state
15 if def.hostile == true or def.attacked_hostile == true then
16 if def.hostile_cooldown == true then
17 mob_register.manage_hostile_timer = function(self,dtime)
18 if self.hostile_timer > 0 then
19 self.hostile_timer = self.hostile_timer - dtime
21 if self.hostile_timer <= 0 then
28 mob_register.manage_hurt_color_timer = function(self,dtime)
29 if self.hurt_color_timer > 0 then
30 self.hurt_color_timer = self.hurt_color_timer - dtime
31 if self.hurt_color_timer <= 0 then
32 self.hurt_color_timer = 0
33 self.object:set_texture_mod("")
38 mob_register.manage_explode_timer = function(self,dtime)
39 self.tnt_timer = self.tnt_timer - dtime
40 self.tnt_tick_timer = self.tnt_tick_timer - dtime
41 if self.tnt_tick_timer <= 0 and not self.dead then
42 self.tnt_tick_timer = self.explosion_blink_timer
43 self.tnt_mod_state = math.abs(self.tnt_mod_state-1)
44 if self.tnt_mod_state == 0 then
45 self.object:set_texture_mod("")
47 self.object:set_texture_mod("^[colorize:"..self.explosion_blink_color..":130")
49 --print(self.object:get_texture_mod())
50 --self.object:set_texture_mod("^[colorize:red:130")
52 if self.tnt_timer <= 0 and not self.dead then
54 self.object:set_texture_mod("^[colorize:red:130")
56 local pos = self.object:get_pos()
58 tnt(pos,self.explosion_power)
62 mob_register.manage_projectile_timer = function(self,dtime)
63 self.projectile_timer = self.projectile_timer - dtime
66 --this stops the pig from flying into the air
67 mob_register.manage_jump_timer = function(self,dtime)
68 if self.jump_timer > 0 then
69 self.jump_timer = self.jump_timer - dtime