More fixes, make shulkers spawn on the floor.
This commit is contained in:
parent
1b5598f527
commit
0c4a120191
|
@ -114,10 +114,9 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
|||
for n=1, math.min(64, #nodes) do
|
||||
local r = pr:next(1, #nodes)
|
||||
local nodepos = nodes[r]
|
||||
local tg = vector.offset(nodepos,0,1,0)
|
||||
local tg = vector.offset(nodepos,0,0.5,0)
|
||||
if check_spot(tg) then
|
||||
telepos = tg
|
||||
node_ok = true
|
||||
end
|
||||
end
|
||||
if telepos then
|
||||
|
|
|
@ -7,14 +7,14 @@ local function spawn_shulkers(pos,def,pr,p1,p2)
|
|||
vl_structures.spawn_mobs("mobs_mc:shulker",spawnon,p1,p2,pr,1)
|
||||
local guard = minetest.find_nodes_in_area(p1,p2,{"mcl_itemframes:item_frame"})
|
||||
if #guard > 0 then
|
||||
minetest.add_entity(vector.offset(guard[1],0,-0.5,0),"mobs_mc:shulker") -- fixme: MCLA uses -0.5?
|
||||
minetest.add_entity(vector.offset(guard[1],0,-1.5,0),"mobs_mc:shulker")
|
||||
end
|
||||
end
|
||||
|
||||
vl_structures.register_structure("end_shipwreck",{
|
||||
place_on = {"mcl_end:end_stone"},
|
||||
flags = "place_center_x, place_center_z, all_floors",
|
||||
y_offset = function(pr) return pr:next(20,50) end,
|
||||
y_offset = function(pr) return pr:next(15,40) end,
|
||||
force_placement = false,
|
||||
prepare = { foundation = false, clear = false },
|
||||
chunk_probability = 25,
|
||||
|
@ -83,7 +83,7 @@ vl_structures.register_structure("end_shipwreck",{
|
|||
vl_structures.register_structure("end_boat",{
|
||||
place_on = {"mcl_end:end_stone"},
|
||||
flags = "place_center_x, place_center_z, all_floors",
|
||||
y_offset = function(pr) return pr:next(15,30) end,
|
||||
y_offset = function(pr) return pr:next(10,20) end,
|
||||
force_placement = false,
|
||||
prepare = { foundation = false, clear = false },
|
||||
chunk_probability = 10,
|
||||
|
@ -143,7 +143,7 @@ vl_structures.register_structure("small_end_city",{
|
|||
flags = "place_center_x, place_center_z, all_floors",
|
||||
y_offset = 0,
|
||||
chunk_probability = 30,
|
||||
prepare = { foundation = 2 },
|
||||
prepare = { foundation = -1, tolerance = 15 },
|
||||
biomes = { "End", "EndHighlands", "EndMidlands", "EndBarrens", "EndSmallIslands" },
|
||||
sidelen = 20,
|
||||
filenames = {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
-- todo: move this mostly to the mcl_mobs module?
|
||||
local mob_cap_player = tonumber(minetest.settings:get("mcl_mob_cap_player")) or 75
|
||||
local mob_cap_animal = tonumber(minetest.settings:get("mcl_mob_cap_animal")) or 10
|
||||
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
local vector_offset = vector.offset
|
||||
|
||||
|
@ -43,8 +44,41 @@ function vl_structures.register_structure_spawn(def)
|
|||
end
|
||||
local mobdef = minetest.registered_entities[def.name]
|
||||
if mobdef.can_spawn and not mobdef.can_spawn(p) then return end
|
||||
minetest.add_entity(p, def.name)
|
||||
minetest.add_entity(vector_offset(p, 0, -0.5, 0), def.name)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
--- Spawn mobs for a structure
|
||||
-- @param mob string: mob to spawn
|
||||
-- @param spawnon string or table: nodes to spawn on
|
||||
-- @param p1 vector: Lowest coordinates of range
|
||||
-- @param p2 vector: Highest coordinates of range
|
||||
-- @param pr PseudoRandom: random generator
|
||||
-- @param n number: Number of mobs to spawn
|
||||
-- @param water boolean: Spawn water mobs
|
||||
function vl_structures.spawn_mobs(mob,spawnon,p1,p2,pr,n,water)
|
||||
n = n or 1
|
||||
local sp = {}
|
||||
if water then
|
||||
local nn = minetest.find_nodes_in_area(p1,p2,spawnon)
|
||||
for k,v in pairs(nn) do
|
||||
if minetest.get_item_group(minetest.get_node(vector_offset(v,0,1,0)).name,"water") > 0 then
|
||||
table.insert(sp,v)
|
||||
end
|
||||
end
|
||||
else
|
||||
sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon)
|
||||
end
|
||||
table.shuffle(sp)
|
||||
local count = 0
|
||||
local mob_def = minetest.registered_entities[mob]
|
||||
local enabled = (not peaceful) or (mob_def and mob_spawn_class ~= "hostile")
|
||||
for _, node in pairs(sp) do
|
||||
if enabled and count < n and minetest.add_entity(vector_offset(node, 0, 0.5, 0), mob) then
|
||||
count = count + 1
|
||||
end
|
||||
minetest.get_meta(node):set_string("spawnblock", "yes") -- note: also in peaceful mode!
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
|
||||
local floor = math.floor
|
||||
local vector_offset = vector.offset
|
||||
|
||||
|
@ -97,36 +95,3 @@ function vl_structures.fill_chests(p1,p2,loot,pr)
|
|||
end
|
||||
end
|
||||
|
||||
--- Spawn mobs for a structure
|
||||
-- @param mob string: mob to spawn
|
||||
-- @param spawnon string or table: nodes to spawn on
|
||||
-- @param p1 vector: Lowest coordinates of range
|
||||
-- @param p2 vector: Highest coordinates of range
|
||||
-- @param pr PseudoRandom: random generator
|
||||
-- @param n number: Number of mobs to spawn
|
||||
-- @param water boolean: Spawn water mobs
|
||||
function vl_structures.spawn_mobs(mob,spawnon,p1,p2,pr,n,water)
|
||||
n = n or 1
|
||||
local sp = {}
|
||||
if water then
|
||||
local nn = minetest.find_nodes_in_area(p1,p2,spawnon)
|
||||
for k,v in pairs(nn) do
|
||||
if minetest.get_item_group(minetest.get_node(vector_offset(v,0,1,0)).name,"water") > 0 then
|
||||
table.insert(sp,v)
|
||||
end
|
||||
end
|
||||
else
|
||||
sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon)
|
||||
end
|
||||
table.shuffle(sp)
|
||||
local count = 0
|
||||
local mob_def = minetest.registered_entities[mob]
|
||||
local enabled = (not peaceful) or (mob_def and mob_spawn_class ~= "hostile")
|
||||
for _, node in pairs(sp) do
|
||||
if enabled and count < n and minetest.add_entity(vector_offset(node, 0, 1, 0), mob) then
|
||||
count = count + 1
|
||||
end
|
||||
minetest.get_meta(node):set_string("spawnblock", "yes") -- note: also in peaceful mode!
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue