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:
AntumDeluge 2017-05-27 19:13:47 -07:00
parent 85ca164e14
commit 46a23df877
2 changed files with 11 additions and 2 deletions

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 = minetest.setting_get('sneaker_spawn_chance') or 18000
local spawn_interval = minetest.setting_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