From 73b221c13f6cd2e52d3c215fcc59fe1cc99e554d Mon Sep 17 00:00:00 2001 From: AntumDeluge Date: Wed, 31 May 2017 11:56:20 -0700 Subject: [PATCH] Make 'spawn_maxlight' local to 'spawn.lua' --- settings.lua | 3 --- spawn.lua | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/settings.lua b/settings.lua index 16164b0..67debc9 100644 --- a/settings.lua +++ b/settings.lua @@ -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 diff --git a/spawn.lua b/spawn.lua index fd4e7d2..5985642 100644 --- a/spawn.lua +++ b/spawn.lua @@ -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