Merge pull request 'Don't spawn structure mobs in peaceful mode' (#2629) from fix_peaceful_structmobs into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2629 Reviewed-by: PrairieWind <prairie.astronomer1@gmail.com>
This commit is contained in:
commit
e5f966067c
|
@ -434,7 +434,7 @@ local function spawn_check(pos,spawn_def)
|
|||
is_ground = minetest.get_item_group(gotten_node,"solid") ~= 0
|
||||
end
|
||||
pos.y = pos.y + 1
|
||||
|
||||
local has_room = #minetest.find_nodes_in_area(pos,vector.offset(pos,0,1,0),{"air"}) or 0 >= 2
|
||||
local is_water = get_item_group(gotten_node, "water") ~= 0
|
||||
local is_lava = get_item_group(gotten_node, "lava") ~= 0
|
||||
local is_leaf = get_item_group(gotten_node, "leaves") ~= 0
|
||||
|
@ -452,6 +452,7 @@ local function spawn_check(pos,spawn_def)
|
|||
and biome_check(spawn_def.biomes, gotten_biome)
|
||||
and (is_ground or spawn_def.type_of_spawning ~= "ground")
|
||||
and (spawn_def.type_of_spawning ~= "ground" or not is_leaf)
|
||||
and (spawn_def.type_of_spawning ~= "ground" or has_room)
|
||||
and (spawn_def.check_position and spawn_def.check_position(pos) or true)
|
||||
and (not is_farm_animal(spawn_def.name) or is_grass)
|
||||
and (spawn_def.type_of_spawning ~= "water" or is_water)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
|
||||
mcl_structures.register_structure("pillager_outpost",{
|
||||
place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass","group:sand"},
|
||||
|
@ -65,17 +66,19 @@ mcl_structures.register_structure("pillager_outpost",{
|
|||
def.on_construct(n)
|
||||
end
|
||||
end
|
||||
if sp and #sp > 0 then
|
||||
for i=1,5 do
|
||||
if not peaceful then
|
||||
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:pillager")
|
||||
end
|
||||
end
|
||||
local pos = sp[pr:next(1,#sp)]
|
||||
if pos then
|
||||
minetest.add_entity(pos,"mobs_mc:pillager")
|
||||
minetest.add_entity(pos,"mobs_mc:evoker")
|
||||
end
|
||||
end
|
||||
local pos = sp[pr:next(1,#sp)]
|
||||
if pos then
|
||||
minetest.add_entity(pos,"mobs_mc:evoker")
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
|
@ -2,14 +2,19 @@ local modname = minetest.get_current_modname()
|
|||
local S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
|
||||
local function spawn_witch(p1,p2)
|
||||
local c = minetest.find_node_near(p1,15,{"mcl_cauldrons:cauldron"})
|
||||
if c then
|
||||
local nn = minetest.find_nodes_in_area_under_air(vector.new(p1.x,c.y-1,p1.z),vector.new(p2.x,c.y-1,p2.z),{"mcl_core:sprucewood"})
|
||||
local witch = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch"):get_luaentity()
|
||||
local witch
|
||||
if not peaceful then
|
||||
witch = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch"):get_luaentity()
|
||||
witch._home = c
|
||||
witch.can_despawn = false
|
||||
end
|
||||
local cat = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat"):get_luaentity()
|
||||
witch._home = c
|
||||
witch.can_despawn = false
|
||||
cat.object:set_properties({textures = {"mobs_mc_cat_black.png"}})
|
||||
cat.owner = "!witch!" --so it's not claimable by player
|
||||
cat._home = c
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
|
||||
mcl_structures.register_structure("woodland_cabin",{
|
||||
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 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
|
||||
if not peaceful then
|
||||
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)]
|
||||
if pos then
|
||||
minetest.add_entity(pos,"mobs_mc:vindicator")
|
||||
minetest.add_entity(pos,"mobs_mc:evoker")
|
||||
end
|
||||
end
|
||||
local pos = sp[pr:next(1,#sp)]
|
||||
if pos then
|
||||
minetest.add_entity(pos,"mobs_mc:evoker")
|
||||
end
|
||||
end
|
||||
local parrot = minetest.find_node_near(p,25,{"mcl_heads:wither_skeleton"})
|
||||
if parrot then
|
||||
|
|
Loading…
Reference in New Issue
Block a user