X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=mods%2Fmob%2Fspawning.lua;h=0d66c26be9a8120a19122a555c3eaf62ee18c57a;hb=e98beca706de79126ae6a439a4663081cfd9e47f;hp=c93b10e1639070b4080f341b68329eacb2bf4cb2;hpb=a2bd86376c27bd0a26efd5a4807a90479a96f67c;p=Crafter.git diff --git a/mods/mob/spawning.lua b/mods/mob/spawning.lua index c93b10e..0d66c26 100644 --- a/mods/mob/spawning.lua +++ b/mods/mob/spawning.lua @@ -1,7 +1,11 @@ --this is where mob spawning is defined --spawn mob in a square doughnut shaped radius -local chance = 20 +local timer = 6 +--the amount of mobs that the game will try to spawn +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 @@ -11,9 +15,9 @@ local find_node_height = 32 --for debug testing to isolate mobs local spawn = true -local spawn_table = {"pig","chicken"} -local snow_spawn_table = {"snowman","creeper","spider",} -local dark_spawn_table = {"creeper","spider","big_slime","medium_slime","small_slime"} +local spawn_table = {"pig","chicken","sheep"} +local snow_spawn_table = {"snowman","snoider","sneeper",} +local dark_spawn_table = {"creeper","creeper","creeper","spider","spider","spider","big_slime","medium_slime","small_slime"} local nether_spawn_table = {"nitro_creeper"} local aether_spawn_table = {"phyg"} @@ -80,12 +84,21 @@ local function spawn_mobs() end end end - minetest.after(6, 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 -minetest.register_on_mods_loaded(function() - minetest.after(0,function() - spawn_mobs() +if spawn then + minetest.register_on_mods_loaded(function() + minetest.after(0,function() + spawn_mobs() + end) end) -end) \ No newline at end of file +end