Make 'spawn_maxlight' local to 'spawn.lua'

This commit is contained in:
AntumDeluge 2017-05-31 11:56:20 -07:00
parent 555110bb82
commit 73b221c13f
2 changed files with 3 additions and 4 deletions

@ -5,6 +5,3 @@ sneeker.debug = minetest.setting_getbool('sneeker.debug') or false
-- Maximum number of spawns active at one time
sneeker.spawn_cap = minetest.setting_get('sneeker.spawn_cap') or 25
-- Maximum light of node for spawn
sneeker.spawn_maxlight = minetest.setting_get('sneeker.spawn_maxlight') or 5

@ -7,11 +7,13 @@ local time_day = time_hr * 24
local spawn_chance = minetest.setting_get('sneeker.spawn_chance') or 2 -- 50% chance of spawn
local spawn_interval = minetest.setting_get('sneeker.spawn_interval') or time_min * 2 -- Default interval is 2 minutes
local spawn_maxlight = minetest.setting_get('sneeker.spawn_maxlight') or 5 -- Maximum light of node for spawn
local spawn_chance_percent = tostring(math.floor(1 / spawn_chance * 100)) .. '%'
sneeker.log('Spawn chance: ' .. spawn_chance_percent)
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({
nodenames = {'default:dirt_with_grass', 'default:stone'},
@ -30,7 +32,7 @@ minetest.register_abm({
-- Debugging spawning
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')
return
end