Make 'spawn_maxlight' local to 'spawn.lua'
This commit is contained in:
parent
41bf1ae241
commit
87dec04c58
@ -5,6 +5,3 @@ sneeker.debug = minetest.settings:get_bool("sneeker.debug", false)
|
|||||||
|
|
||||||
-- Maximum number of spawns active at one time
|
-- Maximum number of spawns active at one time
|
||||||
sneeker.spawn_cap = tonumber(minetest.settings:get("sneeker.spawn_cap")) or 25
|
sneeker.spawn_cap = tonumber(minetest.settings:get("sneeker.spawn_cap")) or 25
|
||||||
|
|
||||||
-- Maximum light of node for spawn
|
|
||||||
sneeker.spawn_maxlight = tonumber(minetest.settings:get("sneeker.spawn_maxlight")) or 5
|
|
||||||
|
@ -7,11 +7,14 @@ local time_day = time_hr * 24
|
|||||||
|
|
||||||
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_chance_percent = tostring(math.floor(1 / spawn_chance * 100)) .. "%"
|
local spawn_chance_percent = tostring(math.floor(1 / spawn_chance * 100)) .. "%"
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
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))
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"default:dirt_with_grass", "default:stone"},
|
nodenames = {"default:dirt_with_grass", "default:stone"},
|
||||||
@ -30,7 +33,7 @@ minetest.register_abm({
|
|||||||
-- Debugging spawning
|
-- Debugging spawning
|
||||||
sneeker.log_debug("Node light level at " .. sneeker.get_pos_string(pos) .. ": " .. tostring(node_light))
|
sneeker.log_debug("Node light level at " .. sneeker.get_pos_string(pos) .. ": " .. tostring(node_light))
|
||||||
|
|
||||||
if not node_light or node_light > sneeker.spawn_maxlight or node_light < -1 then
|
if not node_light or node_light > spawn_maxlight or node_light < -1 then
|
||||||
sneeker.log_debug("Node not dark enough for spawn")
|
sneeker.log_debug("Node not dark enough for spawn")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user