mirror of
https://github.com/Poikilos/mobs.git
synced 2023-10-03 07:28:50 -07:00
Add a table with booleans for each spawing mob that sets whether the mob spawns
This commit is contained in:
parent
aae3120fe7
commit
843009965f
5
api.lua
5
api.lua
@ -333,13 +333,18 @@ function mobs:register_mob(name, def)
|
||||
})
|
||||
end
|
||||
|
||||
mobs.spawning_mobs = {}
|
||||
function mobs:register_spawn(name, nodes, max_light, min_light, chance, mobs_per_30_block_radius, max_height)
|
||||
mobs.spawning_mobs[name] = true
|
||||
minetest.register_abm({
|
||||
nodenames = nodes,
|
||||
neighbors = nodes,
|
||||
interval = 30,
|
||||
chance = chance,
|
||||
action = function(pos, node)
|
||||
if not mobs.spawning_mobs[name] then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
if not minetest.env:get_node_light(pos) then
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user