From a5025cdfb89a3b42d87297e64e597ecb73b6b361 Mon Sep 17 00:00:00 2001 From: AntumDeluge Date: Mon, 29 May 2017 01:00:39 -0700 Subject: [PATCH] Use setting 'sneeker.spawn_maxlight' to determine node light for spawn --- settings.lua | 5 +++++ settingtypes.txt | 3 +++ spawn.lua | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/settings.lua b/settings.lua index 254b487..ad764d1 100644 --- a/settings.lua +++ b/settings.lua @@ -2,4 +2,9 @@ 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 + +-- Maximum light of node for spawn +sneeker.spawn_maxlight = tonumber(minetest.settings:get("sneeker.spawn_maxlight")) or 5 diff --git a/settingtypes.txt b/settingtypes.txt index 9aeb756..2f7cafc 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -10,3 +10,6 @@ sneeker.spawn_chance (Spawn chance) int 18000 # Sets frequency of spawn chance. # Default 1200 is equivalent to 20 minutes (60 * 40). sneeker.spawn_interval (Spawn interval) int 2400 + +# Sets the maximum light that a node can have for spawn to occur. +sneeker.spawn_maxlight (Max light for spawn) int 5 diff --git a/spawn.lua b/spawn.lua index 090e419..28ad62b 100644 --- a/spawn.lua +++ b/spawn.lua @@ -26,7 +26,7 @@ minetest.register_abm({ if not minetest.get_node_light(pos) then return end - if minetest.get_node_light(pos) > 5 then + if minetest.get_node_light(pos) > sneeker.spawn_maxlight then return end if minetest.get_node_light(pos) < -1 then