Add setting to chance spawn mapblock limit
This commit is contained in:
parent
94c22a5406
commit
0cb069edeb
@ -42,6 +42,10 @@ Settings:
|
||||
- Sets the lowest position at which sneeker can spawn.
|
||||
- type: int
|
||||
- default 31000
|
||||
- ***sneeker.spawn_mapblock_limit***
|
||||
- Limits the number of entities that can spawn per mapblock (16x16x16).
|
||||
- type: int
|
||||
- default: 1
|
||||
|
||||
---
|
||||
### Links:
|
||||
|
@ -44,3 +44,8 @@ sneeker.spawn_minheight = tonumber(core.settings:get("sneeker.spawn_minheight")
|
||||
--
|
||||
-- @setting sneeker.spawn_maxheight
|
||||
sneeker.spawn_maxheight = tonumber(core.settings:get("sneeker.spawn_maxheight") or 31000)
|
||||
|
||||
--- Limits the number of entities that can spawn per mapblock (16x16x16).
|
||||
--
|
||||
-- Default: 1
|
||||
sneeker.spawn_mapblock_limit = tonumber(core.settings:get("sneeker.spawn_mapblock_limit") or 1)
|
||||
|
@ -21,3 +21,6 @@ sneeker.spawn_minheight (Sneeker min spawn height) int -31000
|
||||
|
||||
# Sets the highest position at which sneeker can spawn.
|
||||
sneeker.spawn_maxheight (Sneeker max spawn height) int 31000
|
||||
|
||||
# Limits the number of entities that can spawn per mapblock (16x16x16).
|
||||
sneeker.spawn_mapblock_limit (Sneeker spawn limit) int 1
|
||||
|
14
spawn.lua
14
spawn.lua
@ -22,15 +22,13 @@ core.register_abm({
|
||||
neighbors = {"air"},
|
||||
interval = sneeker.spawn_interval,
|
||||
chance = sneeker.spawn_chance,
|
||||
action = function(pos, node, _, active_object_count_wider)
|
||||
if active_object_count_wider > 5 then
|
||||
return
|
||||
end
|
||||
action = function(pos, node, aoc, aocw)
|
||||
if aoc >= sneeker.spawn_mapblock_limit then return end
|
||||
|
||||
if pos.y > sneeker.spawn_maxheight then
|
||||
return
|
||||
end
|
||||
if pos.y < sneeker.spawn_minheight then
|
||||
-- check above target node
|
||||
pos.y = pos.y+1
|
||||
|
||||
if pos.y > sneeker.spawn_maxheight or pos.y < sneeker.spawn_minheight then
|
||||
return
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user