mirror of
https://github.com/ElCeejo/creatura.git
synced 2025-03-15 04:11:24 +00:00
Biome support for ABM spawning
This commit is contained in:
parent
b090238df0
commit
d0143e74c2
1 changed files with 15 additions and 0 deletions
15
spawning.lua
15
spawning.lua
|
@ -520,6 +520,7 @@ function creatura.register_abm_spawn(mob, def)
|
|||
local min_group = def.min_group or 1
|
||||
local max_group = def.max_group or 4
|
||||
local block_protected = def.block_protected_spawn or false
|
||||
local biomes = def.biomes or {}
|
||||
local nodes = def.nodes or {"group:soil", "group:stone"}
|
||||
local neighbors = def.neighbors or {"air"}
|
||||
local spawn_on_load = def.spawn_on_load or false
|
||||
|
@ -566,6 +567,20 @@ function creatura.register_abm_spawn(mob, def)
|
|||
return
|
||||
end
|
||||
|
||||
if biomes
|
||||
and #biomes > 0 then
|
||||
local biome_id = minetest.get_biome_data(pos).biome
|
||||
local biome_name = minetest.get_biome_name(biome_id)
|
||||
local is_spawn_biome = false
|
||||
for _, biome in ipairs(biomes) do
|
||||
if biome:match("^" .. biome_name) then
|
||||
is_spawn_biome = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not is_spawn_biome then return end
|
||||
end
|
||||
|
||||
local mob_count = 0
|
||||
local plyr_found = false
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue