Make 'spawn_maxlight' local to 'spawn.lua'
This commit is contained in:
parent
555110bb82
commit
73b221c13f
@ -5,6 +5,3 @@ sneeker.debug = minetest.setting_getbool('sneeker.debug') or false
|
|||||||
|
|
||||||
-- Maximum number of spawns active at one time
|
-- Maximum number of spawns active at one time
|
||||||
sneeker.spawn_cap = minetest.setting_get('sneeker.spawn_cap') or 25
|
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_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_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)) .. '%'
|
local spawn_chance_percent = tostring(math.floor(1 / spawn_chance * 100)) .. '%'
|
||||||
|
|
||||||
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 +32,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