Tune mob spawning further

This commit is contained in:
oilboi 2020-06-08 13:38:06 -04:00
parent 4ab472495a
commit 7c6b1dd79c
2 changed files with 11 additions and 3 deletions

View File

@ -2,7 +2,6 @@
--this is going to be used to set an active mob limit
global_mob_amount = 0
mob_limit = 100
local path = minetest.get_modpath(minetest.get_current_modname())

View File

@ -3,7 +3,9 @@
--spawn mob in a square doughnut shaped radius
local timer = 6
--the amount of mobs that the game will try to spawn
local spawn_goal = 14
local spawn_goal = 10
--the amount of mobs that the spawner will cap out at
local mob_limit = 100
--inner and outer part of square donut radius
local inner = 24
local outer = 80
@ -82,7 +84,14 @@ local function spawn_mobs()
end
end
end
minetest.after(global_mob_amount/spawn_goal, function()
--fine tune mobs
local after_timer = global_mob_amount/spawn_goal
if after_timer > timer then
after_timer = timer
end
minetest.after(after_timer, function()
spawn_mobs()
end)
end