forked from VoxeLibre/VoxeLibre
Don't spawn structure mobs in peaceful mode
This commit is contained in:
parent
6675f9fd40
commit
962425faa5
|
@ -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"},
|
||||
|
@ -55,6 +56,7 @@ mcl_structures.register_structure("pillager_outpost",{
|
|||
}}
|
||||
},
|
||||
after_place = function(p,def,pr)
|
||||
if not peaceful then
|
||||
local p1 = vector.offset(p,-7,0,-7)
|
||||
local p2 = vector.offset(p,7,14,7)
|
||||
local spawnon = {"mcl_core:stripped_oak"}
|
||||
|
@ -78,4 +80,5 @@ mcl_structures.register_structure("pillager_outpost",{
|
|||
end
|
||||
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 cat = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat"):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()
|
||||
cat.object:set_properties({textures = {"mobs_mc_cat_black.png"}})
|
||||
cat.owner = "!witch!" --so it's not claimable by player
|
||||
cat._home = c
|
||||
|
|
Loading…
Reference in New Issue