forked from Mirrorlandia_minetest/mod-sneeker
Change spawn rate:
- Use settings file to set 'chance' & 'interval' - Set spawn chance to 1/18000 (18000) - Set spawn interval to 40 minutes (2400)
This commit is contained in:
parent
beaff3d886
commit
0b7e8b89c6
6
settingtypes.txt
Normal file
6
settingtypes.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Sets possibility for spawn.
|
||||||
|
sneaker_spawn_chance (Spawn chance) int 18000
|
||||||
|
|
||||||
|
# Sets frequency of spawn chance.
|
||||||
|
# Default 1200 is equivalent to 20 minutes (60 * 40).
|
||||||
|
sneaker_spawn_interval (Spawn interval) int 2400
|
@ -5,11 +5,14 @@ local time_min = 60
|
|||||||
local time_hr = time_min * 60
|
local time_hr = time_min * 60
|
||||||
local time_day = time_hr * 24
|
local time_day = time_hr * 24
|
||||||
|
|
||||||
|
local spawn_chance = tonumber(minetest.settings:get("sneaker_spawn_chance")) or 18000
|
||||||
|
local spawn_interval = tonumber(minetest.settings:get("sneaker_spawn_interval")) or time_min * 40 -- Default interval is 40 minutes
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"default:dirt_with_grass","default:stone"},
|
nodenames = {"default:dirt_with_grass","default:stone"},
|
||||||
neighbors = {"air"},
|
neighbors = {"air"},
|
||||||
interval = time_min * 20, -- Run spawn function every 20 minutes
|
interval = spawn_interval,
|
||||||
chance = 9000,
|
chance = spawn_chance,
|
||||||
action = function(pos, node, _, active_object_count_wider)
|
action = function(pos, node, _, active_object_count_wider)
|
||||||
if active_object_count_wider > 5 then
|
if active_object_count_wider > 5 then
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user