Better delay
This commit is contained in:
parent
234b71064c
commit
58ed1a5e1c
14 changed files with 29 additions and 42 deletions
|
@ -70,10 +70,7 @@ mobs:register_mob("fun_caves:dangler", {
|
||||||
--replace_with = "air",
|
--replace_with = "air",
|
||||||
--replace_offset = -1,
|
--replace_offset = -1,
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then
|
if not fun_caves.custom_ready(self) then
|
||||||
self.custom_time = fun_caves.custom_delay - 1
|
|
||||||
else
|
|
||||||
self.custom_time = self.custom_time - 1
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -108,10 +108,7 @@ mobs:register_mob("fun_caves:goblin_coal", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then
|
if not fun_caves.custom_ready(self) then
|
||||||
self.custom_time = fun_caves.custom_delay - 1
|
|
||||||
else
|
|
||||||
self.custom_time = self.custom_time - 1
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -112,10 +112,7 @@ mobs:register_mob("fun_caves:goblin_cobble", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then
|
if not fun_caves.custom_ready(self) then
|
||||||
self.custom_time = fun_caves.custom_delay - 1
|
|
||||||
else
|
|
||||||
self.custom_time = self.custom_time - 1
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -108,10 +108,7 @@ mobs:register_mob("fun_caves:goblin_copper", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then
|
if not fun_caves.custom_ready(self) then
|
||||||
self.custom_time = fun_caves.custom_delay - 1
|
|
||||||
else
|
|
||||||
self.custom_time = self.custom_time - 1
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -110,10 +110,7 @@ mobs:register_mob("fun_caves:goblin_diamond", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then
|
if not fun_caves.custom_ready(self) then
|
||||||
self.custom_time = fun_caves.custom_delay - 1
|
|
||||||
else
|
|
||||||
self.custom_time = self.custom_time - 1
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -204,10 +204,7 @@ mobs:register_mob("fun_caves:goblin_digger", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then
|
if not fun_caves.custom_ready(self) then
|
||||||
self.custom_time = fun_caves.custom_delay - 1
|
|
||||||
else
|
|
||||||
self.custom_time = self.custom_time - 1
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -108,10 +108,7 @@ mobs:register_mob("fun_caves:goblin_gold", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then
|
if not fun_caves.custom_ready(self) then
|
||||||
self.custom_time = fun_caves.custom_delay - 1
|
|
||||||
else
|
|
||||||
self.custom_time = self.custom_time - 1
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -107,10 +107,7 @@ mobs:register_mob("fun_caves:goblin_ice", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then
|
if not fun_caves.custom_ready(self) then
|
||||||
self.custom_time = fun_caves.custom_delay - 1
|
|
||||||
else
|
|
||||||
self.custom_time = self.custom_time - 1
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -110,10 +110,7 @@ mobs:register_mob("fun_caves:goblin_iron", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then
|
if not fun_caves.custom_ready(self) then
|
||||||
self.custom_time = fun_caves.custom_delay - 1
|
|
||||||
else
|
|
||||||
self.custom_time = self.custom_time - 1
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -109,10 +109,7 @@ mobs:register_mob("fun_caves:goblin_king", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then
|
if not fun_caves.custom_ready(self) then
|
||||||
self.custom_time = fun_caves.custom_delay - 1
|
|
||||||
else
|
|
||||||
self.custom_time = self.custom_time - 1
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
local DEBUG = true
|
local DEBUG = false
|
||||||
|
|
||||||
local cave_noise_1 = {offset = 0, scale = 1, seed = 3901, spread = {x = 40, y = 10, z = 40}, octaves = 3, persist = 1, lacunarity = 2}
|
local cave_noise_1 = {offset = 0, scale = 1, seed = 3901, spread = {x = 40, y = 10, z = 40}, octaves = 3, persist = 1, lacunarity = 2}
|
||||||
local cave_noise_2 = {offset = 0, scale = 1, seed = -8402, spread = {x = 40, y = 20, z = 40}, octaves = 3, persist = 1, lacunarity = 2}
|
local cave_noise_2 = {offset = 0, scale = 1, seed = -8402, spread = {x = 40, y = 20, z = 40}, octaves = 3, persist = 1, lacunarity = 2}
|
||||||
|
|
11
mobs.lua
11
mobs.lua
|
@ -48,7 +48,16 @@ fun_caves.surface_damage = function(self, cold_natured)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
fun_caves.custom_delay = 50
|
local custom_delay = 1000000
|
||||||
|
fun_caves.custom_ready = function(self)
|
||||||
|
local time = minetest.get_us_time()
|
||||||
|
if not self.custom_time or time - self.custom_time > custom_delay then
|
||||||
|
self.custom_time = time
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local path = minetest.get_modpath(minetest.get_current_modname())
|
local path = minetest.get_modpath(minetest.get_current_modname())
|
||||||
dofile(path .. "/danglers.lua")
|
dofile(path .. "/danglers.lua")
|
||||||
|
|
|
@ -48,6 +48,10 @@ mobs:register_mob("fun_caves:spider", {
|
||||||
punch_end = 90,
|
punch_end = 90,
|
||||||
},
|
},
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
|
if not fun_caves.custom_ready(self) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
fun_caves.surface_damage(self)
|
fun_caves.surface_damage(self)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
@ -49,6 +49,10 @@ mobs:register_mob("fun_caves:spider_ice", {
|
||||||
punch_end = 90,
|
punch_end = 90,
|
||||||
},
|
},
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
|
if not fun_caves.custom_ready(self) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
fun_caves.surface_damage(self, true)
|
fun_caves.surface_damage(self, true)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue