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.
|
- Sets the lowest position at which sneeker can spawn.
|
||||||
- type: int
|
- type: int
|
||||||
- default 31000
|
- default 31000
|
||||||
|
- ***sneeker.spawn_mapblock_limit***
|
||||||
|
- Limits the number of entities that can spawn per mapblock (16x16x16).
|
||||||
|
- type: int
|
||||||
|
- default: 1
|
||||||
|
|
||||||
---
|
---
|
||||||
### Links:
|
### Links:
|
||||||
|
@ -44,3 +44,8 @@ sneeker.spawn_minheight = tonumber(core.settings:get("sneeker.spawn_minheight")
|
|||||||
--
|
--
|
||||||
-- @setting sneeker.spawn_maxheight
|
-- @setting sneeker.spawn_maxheight
|
||||||
sneeker.spawn_maxheight = tonumber(core.settings:get("sneeker.spawn_maxheight") or 31000)
|
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.
|
# Sets the highest position at which sneeker can spawn.
|
||||||
sneeker.spawn_maxheight (Sneeker max spawn height) int 31000
|
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"},
|
neighbors = {"air"},
|
||||||
interval = sneeker.spawn_interval,
|
interval = sneeker.spawn_interval,
|
||||||
chance = sneeker.spawn_chance,
|
chance = sneeker.spawn_chance,
|
||||||
action = function(pos, node, _, active_object_count_wider)
|
action = function(pos, node, aoc, aocw)
|
||||||
if active_object_count_wider > 5 then
|
if aoc >= sneeker.spawn_mapblock_limit then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if pos.y > sneeker.spawn_maxheight then
|
-- check above target node
|
||||||
return
|
pos.y = pos.y+1
|
||||||
end
|
|
||||||
if pos.y < sneeker.spawn_minheight then
|
if pos.y > sneeker.spawn_maxheight or pos.y < sneeker.spawn_minheight then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user