1
0
Fork 0

Don't spawn illagers in cabins in peaceful

This commit is contained in:
cora 2022-09-07 11:53:22 +02:00
parent 89f3bb5aa6
commit 9449cdfd88
1 changed files with 10 additions and 7 deletions

View File

@ -1,6 +1,7 @@
local modname = minetest.get_current_modname() local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname) local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname) local modpath = minetest.get_modpath(modname)
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
mcl_structures.register_structure("woodland_cabin",{ mcl_structures.register_structure("woodland_cabin",{
place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"}, place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"},
@ -22,17 +23,19 @@ mcl_structures.register_structure("woodland_cabin",{
local p1=vector.offset(p,-def.sidelen,-1,-def.sidelen) local p1=vector.offset(p,-def.sidelen,-1,-def.sidelen)
local p2=vector.offset(p,def.sidelen,def.sidelen,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) local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon)
if sp and #sp > 0 then if not peaceful then
for i=1,5 do if sp and #sp > 0 then
for i=1,5 do
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mobs_mc:vindicator")
end
end
local pos = sp[pr:next(1,#sp)] local pos = sp[pr:next(1,#sp)]
if pos then if pos then
minetest.add_entity(pos,"mobs_mc:vindicator") minetest.add_entity(pos,"mobs_mc:evoker")
end end
end end
local pos = sp[pr:next(1,#sp)]
if pos then
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