Make them spawn at (somewhat) random positions

This commit is contained in:
cora 2022-07-12 01:30:41 +02:00
parent 571c57e891
commit 2b835221a7
2 changed files with 14 additions and 9 deletions

View File

@ -18,16 +18,21 @@ mcl_structures.register_structure("woodland_cabin",{
modpath.."/schematics/mcl_structures_woodland_outpost.mts", modpath.."/schematics/mcl_structures_woodland_outpost.mts",
}, },
after_place = function(p,def,pr) after_place = function(p,def,pr)
local spawnon = {"mcl_deepslate:deepslate","mcl_wool:white_carpet","mcl_wool:white_carpet"} local spawnon = {"mcl_deepslate:deepslate","mcl_core:birchwood","mcl_wool:red_carpet","mcl_wool:brown_carpet"}
local p1=vector.offset(p,-def.sidelen,-1,-def.sidelen)
local p2=vector.offset(p,def.sidelen,def.sidelen,def.sidelen)
local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon)
if sp and #sp > 0 then
for i=1,5 do for i=1,5 do
local vindicator = minetest.find_node_near(p,25,spawnon) local pos = sp[pr:next(1,#sp)]
if vindicator then if pos then
minetest.add_entity(vindicator,"mobs_mc:vindicator") minetest.add_entity(pos,"mobs_mc:vindicator")
end end
end end
local evoker = minetest.find_node_near(p,25,spawnon) local pos = sp[pr:next(1,#sp)]
if evoker then if pos then
minetest.add_entity(evoker,"mobs_mc:evoker") minetest.add_entity(pos,"mobs_mc:evoker")
end
end end
local parrot = minetest.find_node_near(p,25,{"mcl_heads:wither_skeleton"}) local parrot = minetest.find_node_near(p,25,{"mcl_heads:wither_skeleton"})
if parrot then if parrot then