Add setting to customize spawning nodes
This commit is contained in:
parent
4b8452538e
commit
12e6bd79db
@ -4,6 +4,7 @@ v1.1
|
|||||||
- added sound when hit
|
- added sound when hit
|
||||||
- fixed entity vertical positioning
|
- fixed entity vertical positioning
|
||||||
- fixed tnt:boom node left after explosion
|
- fixed tnt:boom node left after explosion
|
||||||
|
- added setting to customize spawn nodes
|
||||||
|
|
||||||
v1.0
|
v1.0
|
||||||
----
|
----
|
||||||
|
@ -106,3 +106,11 @@ sneeker.spawn_maxheight = tonumber(core.settings:get("sneeker.spawn_maxheight")
|
|||||||
-- @settype int
|
-- @settype int
|
||||||
-- @default 1
|
-- @default 1
|
||||||
sneeker.spawn_mapblock_limit = tonumber(core.settings:get("sneeker.spawn_mapblock_limit") or 1)
|
sneeker.spawn_mapblock_limit = tonumber(core.settings:get("sneeker.spawn_mapblock_limit") or 1)
|
||||||
|
|
||||||
|
--- Comma-separated list of nodes on which sneeker can spawn.
|
||||||
|
--
|
||||||
|
-- @setting sneeker.spawn_nodes
|
||||||
|
-- @settype string
|
||||||
|
-- @default default:dirt_with_dry_grass,default:dry_dirt,default:dry_dirt_with_dry_grass,default:desert_sand,nether:rack
|
||||||
|
sneeker.spawn_nodes = core.settings:get("sneeker.spawn_nodes") or "default:dirt_with_dry_grass,default:dry_dirt,default:dry_dirt_with_dry_grass,default:desert_sand,nether:rack"
|
||||||
|
sneeker.spawn_nodes = sneeker.spawn_nodes:trim()
|
||||||
|
@ -50,3 +50,6 @@ sneeker.spawn_maxheight (Sneeker max spawn height) int 31000
|
|||||||
|
|
||||||
# Limits the number of entities that can spawn per mapblock (16x16x16).
|
# Limits the number of entities that can spawn per mapblock (16x16x16).
|
||||||
sneeker.spawn_mapblock_limit (Sneeker spawn limit) int 1
|
sneeker.spawn_mapblock_limit (Sneeker spawn limit) int 1
|
||||||
|
|
||||||
|
# Comma-separated list of nodes on which sneeker can spawn.
|
||||||
|
sneeker.spawn_nodes (Sneeker spawn nodes) string default:dirt_with_dry_grass,default:dry_dirt,default:dry_dirt_with_dry_grass,default:desert_sand,nether:rack
|
||||||
|
27
spawn.lua
27
spawn.lua
@ -1,19 +1,20 @@
|
|||||||
|
|
||||||
local spawn_nodes = {
|
local spawn_nodes = {}
|
||||||
"default:dirt_with_dry_grass",
|
if sneeker.spawn_nodes ~= "" then
|
||||||
"default:dry_dirt",
|
if not sneeker.spawn_nodes:find(",") then
|
||||||
"default:dry_dirt_with_dry_grass",
|
table.insert(spawn_nodes, sneeker.spawn_nodes)
|
||||||
"default:desert_sand",
|
else
|
||||||
}
|
for _, node in ipairs(sneeker.spawn_nodes:split(",")) do
|
||||||
|
local node = node:trim()
|
||||||
if core.global_exists("nether") then
|
if node ~= "" then
|
||||||
table.insert(spawn_nodes, "nether:rack")
|
table.insert(spawn_nodes, node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, node_name in ipairs(spawn_nodes) do
|
if #spawn_nodes == 0 then
|
||||||
if not core.registered_nodes[node_name] then
|
sneeker.log("warning", "no spawning nodes set, cannot spawn")
|
||||||
sneeker.log("warning", "Invalid node for spawn: " .. node_name)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user