]> git.lizzy.rs Git - Crafter.git/commitdiff
Add in custom explosion blink timer to mob api
authoroilboi <47129783+oilboi@users.noreply.github.com>
Tue, 19 May 2020 15:47:53 +0000 (11:47 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Tue, 19 May 2020 15:47:53 +0000 (11:47 -0400)
mods/mob/api/api_hook.lua
mods/mob/api/timers.lua
mods/mob/init.lua

index 533dacf7b57a2c07ef2ba0fc76cfdbe39f0acc67..de8ae62bb69f7727efa570d437eb47ca043cb1fc 100644 (file)
@@ -87,6 +87,7 @@ mob_register.explosion_power = def.explosion_power
 mob_register.tnt_timer = nil
 mob_register.explosion_time = def.explosion_time
 mob_register.explosion_blink_color = def.explosion_blink_color or "white"
+mob_register.explosion_blink_timer = def.explosion_blink_timer or 0.2
 
 mob_register.custom_function_begin = def.custom_function_begin
 mob_register.custom_function_end = def.custom_function_end
index eeb684f9c487c02cd48df37e0ee2f5e612902064..a835f987907508d59c042acda001358f0cfa324c 100644 (file)
@@ -39,7 +39,7 @@ mobs.create_timer_functions = function(def,mob_register)
                self.tnt_timer = self.tnt_timer - dtime
                self.tnt_tick_timer = self.tnt_tick_timer  - dtime
                if self.tnt_tick_timer <= 0 and not self.dead then
-                       self.tnt_tick_timer = 0.2
+                       self.tnt_tick_timer = self.explosion_blink_timer
                        self.tnt_mod_state = math.abs(self.tnt_mod_state-1)
                        if self.tnt_mod_state == 0 then
                                self.object:set_texture_mod("")
index 3539599c6e2a6ca56c5538450a9902584f67ce4f..82071664e95bff0699b0eb5eab6490635553de49 100644 (file)
@@ -480,6 +480,7 @@ mobs.register_mob(
         explosion_radius = 6, -- how far away the mob has to be to initialize the explosion
         explosion_power = 14, -- how big the explosion is (radius)
         explosion_time = 3, -- how long it takes for a mob to explode
+        explosion_blink_timer = 0.1, -- how fast the blinking happens
         
         die_in_light = false,
         --die_in_light_level = 12,