Make 'spawn_cap' local to 'spawn.lua'
This commit is contained in:
parent
87dec04c58
commit
f26ca5c2b9
2
init.lua
2
init.lua
@ -17,8 +17,6 @@ sneeker.log_debug("Debugging is on")
|
|||||||
sneeker.mob_name = sneeker.modname .. ":" .. sneeker.modname
|
sneeker.mob_name = sneeker.modname .. ":" .. sneeker.modname
|
||||||
sneeker.spawnegg_name = sneeker.modname .. ":spawnegg"
|
sneeker.spawnegg_name = sneeker.modname .. ":spawnegg"
|
||||||
|
|
||||||
sneeker.log("Spawn cap: " .. tostring(sneeker.spawn_cap))
|
|
||||||
|
|
||||||
local scripts = {
|
local scripts = {
|
||||||
"tnt_function",
|
"tnt_function",
|
||||||
"spawn",
|
"spawn",
|
||||||
|
@ -2,6 +2,3 @@
|
|||||||
|
|
||||||
|
|
||||||
sneeker.debug = minetest.settings:get_bool("sneeker.debug", false)
|
sneeker.debug = minetest.settings:get_bool("sneeker.debug", false)
|
||||||
|
|
||||||
-- Maximum number of spawns active at one time
|
|
||||||
sneeker.spawn_cap = tonumber(minetest.settings:get("sneeker.spawn_cap")) or 25
|
|
||||||
|
@ -5,13 +5,14 @@ local time_min = 60
|
|||||||
local time_hr = time_min * 60
|
local time_hr = time_min * 60
|
||||||
local time_day = time_hr * 24
|
local time_day = time_hr * 24
|
||||||
|
|
||||||
|
local spawn_cap = tonumber(minetest.settings:get("sneeker.spawn_cap")) or 25 -- Maximum number of spawns active at one time
|
||||||
local spawn_chance = tonumber(minetest.settings:get("sneeker.spawn_chance")) or 2 -- 50% chance of spawn
|
local spawn_chance = tonumber(minetest.settings:get("sneeker.spawn_chance")) or 2 -- 50% chance of spawn
|
||||||
local spawn_interval = tonumber(minetest.settings:get("sneeker.spawn_interval")) or time_min * 2 -- Default interval is 2 minutes
|
local spawn_interval = tonumber(minetest.settings:get("sneeker.spawn_interval")) or time_min * 2 -- Default interval is 2 minutes
|
||||||
local spawn_maxlight = tonumber(minetest.settings:get("sneeker.spawn_maxlight")) or 5 -- Maximum light of node for spawn
|
local spawn_maxlight = tonumber(minetest.settings:get("sneeker.spawn_maxlight")) or 5 -- Maximum light of node for spawn
|
||||||
|
|
||||||
local spawn_chance_percent = tostring(math.floor(1 / spawn_chance * 100)) .. "%"
|
local spawn_chance_percent = tostring(math.floor(1 / spawn_chance * 100)) .. "%"
|
||||||
|
|
||||||
<<<<<<< HEAD
|
sneeker.log("Spawn cap: " .. tostring(sneeker.spawn_cap))
|
||||||
sneeker.log("Spawn chance: " .. spawn_chance_percent)
|
sneeker.log("Spawn chance: " .. spawn_chance_percent)
|
||||||
sneeker.log("Spawn interval: " .. tostring(spawn_interval) .. " (" .. tostring(spawn_interval/60) .. " minute(s))")
|
sneeker.log("Spawn interval: " .. tostring(spawn_interval) .. " (" .. tostring(spawn_interval/60) .. " minute(s))")
|
||||||
sneeker.log("Maximum light value for spawn: " .. tostring(spawn_maxlight))
|
sneeker.log("Maximum light value for spawn: " .. tostring(spawn_maxlight))
|
||||||
@ -60,9 +61,9 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
sneeker.log_debug("Current active spawns: " .. tostring(count) .. "/" .. tostring(sneeker.spawn_cap))
|
sneeker.log_debug("Current active spawns: " .. tostring(count) .. "/" .. tostring(spawn_cap))
|
||||||
|
|
||||||
if count >= sneeker.spawn_cap then
|
if count >= spawn_cap then
|
||||||
sneeker.log_debug("Max spawns reached")
|
sneeker.log_debug("Max spawns reached")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user