diff --git a/danglers.lua b/danglers.lua index ba0a2f4..64b86d4 100644 --- a/danglers.lua +++ b/danglers.lua @@ -70,8 +70,15 @@ mobs:register_mob("fun_caves:dangler", { --replace_with = "air", --replace_offset = -1, do_custom = function(self) + if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then + self.custom_time = fun_caves.custom_delay - 1 + else + self.custom_time = self.custom_time - 1 + return + end + fun_caves.climb(self) - fun_caves.search_replace(self.object:getpos(), 200, {"air"}, "mobs:cobweb") + fun_caves.search_replace(self.object:getpos(), 100, {"air"}, "mobs:cobweb") fun_caves.surface_damage(self) end, diff --git a/goblin_coal.lua b/goblin_coal.lua index df9d1df..70dcde8 100644 --- a/goblin_coal.lua +++ b/goblin_coal.lua @@ -108,6 +108,13 @@ mobs:register_mob("fun_caves:goblin_coal", { end, do_custom = function(self) + if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then + self.custom_time = fun_caves.custom_delay - 1 + else + self.custom_time = self.custom_time - 1 + return + end + fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:stone"}, "default:mossycobble") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_coal_trap") diff --git a/goblin_cobbler.lua b/goblin_cobbler.lua index b8b8ced..ddb9939 100644 --- a/goblin_cobbler.lua +++ b/goblin_cobbler.lua @@ -112,6 +112,13 @@ mobs:register_mob("fun_caves:goblin_cobble", { end, do_custom = function(self) + if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then + self.custom_time = fun_caves.custom_delay - 1 + else + self.custom_time = self.custom_time - 1 + return + end + fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:stone", "default:desert_stone", "default:sandstone"}, "default:mossycobble") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:mossycobble"}, "fun_caves:mossycobble_trap") diff --git a/goblin_copper.lua b/goblin_copper.lua index fc57b13..067f346 100644 --- a/goblin_copper.lua +++ b/goblin_copper.lua @@ -108,6 +108,13 @@ mobs:register_mob("fun_caves:goblin_copper", { end, do_custom = function(self) + if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then + self.custom_time = fun_caves.custom_delay - 1 + else + self.custom_time = self.custom_time - 1 + return + end + fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:stone"}, "default:mossycobble") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_copper_trap") diff --git a/goblin_diamond.lua b/goblin_diamond.lua index 1dc5561..7c607ce 100644 --- a/goblin_diamond.lua +++ b/goblin_diamond.lua @@ -110,6 +110,13 @@ mobs:register_mob("fun_caves:goblin_diamond", { end, do_custom = function(self) + if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then + self.custom_time = fun_caves.custom_delay - 1 + else + self.custom_time = self.custom_time - 1 + return + end + fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:stone"}, "default:mossycobble") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_diamond_trap") diff --git a/goblin_digger.lua b/goblin_digger.lua index c730ce0..6a72e86 100644 --- a/goblin_digger.lua +++ b/goblin_digger.lua @@ -87,7 +87,7 @@ local goblin_tunneling = function(self, type) end end - if self.state == "stand" and math.random() < 0.05 then + if self.state == "stand" and math.random() < 0.5 then self.state = "tunnel" elseif self.state == "tunnel" and math.random() < 0.05 then self.state = "room" @@ -204,6 +204,13 @@ mobs:register_mob("fun_caves:goblin_digger", { end, do_custom = function(self) + if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then + self.custom_time = fun_caves.custom_delay - 1 + else + self.custom_time = self.custom_time - 1 + return + end + goblin_tunneling(self, "digger") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") diff --git a/goblin_gold.lua b/goblin_gold.lua index 388163d..4eda469 100644 --- a/goblin_gold.lua +++ b/goblin_gold.lua @@ -108,6 +108,13 @@ mobs:register_mob("fun_caves:goblin_gold", { end, do_custom = function(self) + if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then + self.custom_time = fun_caves.custom_delay - 1 + else + self.custom_time = self.custom_time - 1 + return + end + fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:stone"}, "default:mossycobble") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_gold_trap") diff --git a/goblin_ice.lua b/goblin_ice.lua index 158fe4a..6093943 100644 --- a/goblin_ice.lua +++ b/goblin_ice.lua @@ -107,6 +107,13 @@ mobs:register_mob("fun_caves:goblin_ice", { end, do_custom = function(self) + if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then + self.custom_time = fun_caves.custom_delay - 1 + else + self.custom_time = self.custom_time - 1 + return + end + fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") --fun_caves.search_replace(self.object:getpos(), 20, {"default:stone"}, "default:mossycobble") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:ice"}, "fun_caves:ice_trap") diff --git a/goblin_iron.lua b/goblin_iron.lua index 0349e40..a4a00bd 100644 --- a/goblin_iron.lua +++ b/goblin_iron.lua @@ -110,6 +110,13 @@ mobs:register_mob("fun_caves:goblin_iron", { end, do_custom = function(self) + if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then + self.custom_time = fun_caves.custom_delay - 1 + else + self.custom_time = self.custom_time - 1 + return + end + fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:stone"}, "default:mossycobble") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_iron_trap") diff --git a/goblin_king.lua b/goblin_king.lua index a862712..550e74d 100644 --- a/goblin_king.lua +++ b/goblin_king.lua @@ -109,6 +109,13 @@ mobs:register_mob("fun_caves:goblin_king", { end, do_custom = function(self) + if not self.custom_time or self.custom_time % fun_caves.custom_delay == 0 then + self.custom_time = fun_caves.custom_delay - 1 + else + self.custom_time = self.custom_time - 1 + return + end + fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:stone"}, "default:mossycobble") fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:mossycobble"}, "fun_caves:mossycobble_trap") diff --git a/mobs.lua b/mobs.lua index 1dbb26d..44a50f8 100644 --- a/mobs.lua +++ b/mobs.lua @@ -17,13 +17,13 @@ fun_caves.search_replace = function(pos, search_rate, replace_what, replace_with end fun_caves.surface_damage = function(self, cold_natured) - if not self.fun_caves_damage_timer then - self.fun_caves_damage_timer = 0 - end + --if not self.fun_caves_damage_timer then + -- self.fun_caves_damage_timer = 0 + --end - self.fun_caves_damage_timer = self.fun_caves_damage_timer + 1 - if self.fun_caves_damage_timer > 30 then - self.fun_caves_damage_timer = 0 + --self.fun_caves_damage_timer = self.fun_caves_damage_timer + 1 + --if self.fun_caves_damage_timer > 30 then + -- self.fun_caves_damage_timer = 0 local pos = self.object:getpos() local minp = vector.subtract(pos, 1.5) local maxp = vector.add(pos, 1.5) @@ -44,10 +44,12 @@ fun_caves.surface_damage = function(self, cold_natured) end check_for_death(self) - end + --end end +fun_caves.custom_delay = 50 + local path = minetest.get_modpath(minetest.get_current_modname()) dofile(path .. "/danglers.lua") dofile(path .. "/spider.lua") @@ -88,8 +90,8 @@ end fun_caves.goblin_spawn_frequency = 150 -fun_caves.goblin_trap_freq = 500 -fun_caves.goblin_torch_freq = 10 +fun_caves.goblin_trap_freq = 25 +fun_caves.goblin_torch_freq = 2 fun_caves.goblin_drops = { "default:pick_steel", "default:sword_steel", "default:shovel_steel", "farming:bread", "bucket:bucket_water", "default:pick_stone", "default:sword_stone" } --{"group:stone"} = { "default:stone", "default:mossycobble", "default:sandstone", "default:desert_stone", "default:stone_with_coal", "default:stone_with_iron", "default:stone_with_copper", "default:stone_with_gold", "default:stone_with_diamond" } diff --git a/spider.lua b/spider.lua index 959b4c9..2e0bd7e 100644 --- a/spider.lua +++ b/spider.lua @@ -48,10 +48,6 @@ mobs:register_mob("fun_caves:spider", { punch_end = 90, }, do_custom = function(self) - if not self.fun_caves_damage_timer then - self.fun_caves_damage_timer = 0 - end - fun_caves.surface_damage(self) end, })