mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 10:31:06 +01:00
Add structure spawning to other structures
This commit is contained in:
parent
27a434641d
commit
0f01a28c93
6 changed files with 109 additions and 56 deletions
|
@ -51,6 +51,9 @@ mcl_structures.register_structure_spawn({
|
||||||
name = "mobs_mc:witherskeleton",
|
name = "mobs_mc:witherskeleton",
|
||||||
y_min = mcl_vars.mg_lava_nether_max,
|
y_min = mcl_vars.mg_lava_nether_max,
|
||||||
y_max = mcl_vars.mg_lava_nether_max + 32,
|
y_max = mcl_vars.mg_lava_nether_max + 32,
|
||||||
|
chance = 15,
|
||||||
|
interval = 60,
|
||||||
|
limit = 4,
|
||||||
spawnon = { "mcl_blackstone:blackstone_chiseled_polished" },
|
spawnon = { "mcl_blackstone:blackstone_chiseled_polished" },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -130,3 +133,23 @@ mcl_structures.register_structure("nether_bulwark",{
|
||||||
}}
|
}}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mcl_structures.register_structure_spawn({
|
||||||
|
name = "mobs_mc:piglin",
|
||||||
|
y_min = mcl_vars.mg_nether_min,
|
||||||
|
y_max = mcl_vars.mg_nether_max,
|
||||||
|
chance = 10,
|
||||||
|
interval = 60,
|
||||||
|
limit = 9,
|
||||||
|
spawnon = {"mcl_blackstone:blackstone_brick_polished","mcl_stairs:slab_blackstone_polished"},
|
||||||
|
})
|
||||||
|
|
||||||
|
mcl_structures.register_structure_spawn({
|
||||||
|
name = "mobs_mc:piglin_brute",
|
||||||
|
y_min = mcl_vars.mg_nether_min,
|
||||||
|
y_max = mcl_vars.mg_nether_max,
|
||||||
|
chance = 20,
|
||||||
|
interval = 60,
|
||||||
|
limit = 4,
|
||||||
|
spawnon = {"mcl_blackstone:blackstone_brick_polished","mcl_stairs:slab_blackstone_polished"},
|
||||||
|
})
|
||||||
|
|
|
@ -7,6 +7,7 @@ else disabled_structures = {} end
|
||||||
|
|
||||||
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||||
local mob_cap_player = tonumber(minetest.settings:get("mcl_mob_cap_player")) or 75
|
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 logging = minetest.settings:get_bool("mcl_logging_structures",true)
|
local logging = minetest.settings:get_bool("mcl_logging_structures",true)
|
||||||
|
|
||||||
|
@ -378,7 +379,7 @@ function mcl_structures.register_structure_spawn(def)
|
||||||
chance = def.chance or 5,
|
chance = def.chance or 5,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local limit = def.limit or 7
|
local limit = def.limit or 7
|
||||||
if active_object_count > limit then return end
|
if active_object_count_wider > limit + mob_cap_animal then return end
|
||||||
if active_object_count_wider > mob_cap_player then return end
|
if active_object_count_wider > mob_cap_player then return end
|
||||||
local p = vector.offset(pos,0,1,0)
|
local p = vector.offset(pos,0,1,0)
|
||||||
if minetest.get_node(p).name ~= "air" then return end
|
if minetest.get_node(p).name ~= "air" then return end
|
||||||
|
|
|
@ -2,14 +2,13 @@ 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 spawnon = {"mcl_end:purpur_block"}
|
||||||
|
|
||||||
local function spawn_shulkers(pos,def,pr)
|
local function spawn_shulkers(pos,def,pr)
|
||||||
local nn = minetest.find_nodes_in_area_under_air(vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2),vector.offset(pos,def.sidelen/2,def.sidelen,def.sidelen/2),{"mcl_end:purpur_block"})
|
local p1 = vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2)
|
||||||
if nn and #nn > 0 then
|
local p2 = vector.offset(pos,def.sidelen/2,def.sidelen,def.sidelen/2)
|
||||||
table.shuffle(nn)
|
mcl_structures.spawn_mobs("mobs_mc:shulker",spawnon,p1,p2,pr,1)
|
||||||
for i = 1,pr:next(1,math.min(6,#nn)) do
|
|
||||||
minetest.add_entity(vector.offset(nn[i],0,0.5,0),"mobs_mc:shulker")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local guard = minetest.find_node_near(pos,def.sidelen,{"mcl_itemframes:item_frame"})
|
local guard = minetest.find_node_near(pos,def.sidelen,{"mcl_itemframes:item_frame"})
|
||||||
if guard then
|
if guard then
|
||||||
minetest.add_entity(vector.offset(guard,0,-1.5,0),"mobs_mc:shulker")
|
minetest.add_entity(vector.offset(guard,0,-1.5,0),"mobs_mc:shulker")
|
||||||
|
@ -133,3 +132,13 @@ mcl_structures.register_structure("end_boat",{
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mcl_structures.register_structure_spawn({
|
||||||
|
name = "mobs_mc:shulker",
|
||||||
|
y_min = mcl_vars.mg_end_min,
|
||||||
|
y_max = mcl_vars.mg_end_max,
|
||||||
|
chance = 10,
|
||||||
|
interval = 60,
|
||||||
|
limit = 6,
|
||||||
|
spawnon = spawnon,
|
||||||
|
})
|
||||||
|
|
|
@ -14,6 +14,24 @@ function mcl_structures.generate_igloo_top(pos, pr)
|
||||||
end), rotation
|
end), rotation
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function spawn_mobs(p1,p2,vi,zv)
|
||||||
|
local mc = minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_core:stonebrickmossy"})
|
||||||
|
if #mc == 2 then
|
||||||
|
local vp = mc[1]
|
||||||
|
local zp = mc[2]
|
||||||
|
if not vi and zv and zv:get_pos() and vector.distance(mc[1],zv:get_pos()) < 2 then
|
||||||
|
vp = mc[2]
|
||||||
|
elseif not zv and vi and vi:get_pos() and vector.distance(mc[2],vi:get_pos()) < 2 then
|
||||||
|
zp = mc[1]
|
||||||
|
elseif zv and vi then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
vi = minetest.add_entity(vector.offset(mc[1],0,1,0),"mobs_mc:villager")
|
||||||
|
zv = minetest.add_entity(vector.offset(mc[2],0,1,0),"mobs_mc:villager_zombie")
|
||||||
|
minetest.after(1,spawn_mobs,p1,p2,vi,zv)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function mcl_structures.generate_igloo_basement(pos, orientation, loot, pr)
|
function mcl_structures.generate_igloo_basement(pos, orientation, loot, pr)
|
||||||
-- TODO: Add monster eggs
|
-- TODO: Add monster eggs
|
||||||
local path = modpath.."/schematics/mcl_structures_igloo_basement.mts"
|
local path = modpath.."/schematics/mcl_structures_igloo_basement.mts"
|
||||||
|
@ -22,12 +40,7 @@ function mcl_structures.generate_igloo_basement(pos, orientation, loot, pr)
|
||||||
local p2 = vector.offset(pos,5,5,5)
|
local p2 = vector.offset(pos,5,5,5)
|
||||||
mcl_structures.fill_chests(p1,p2,loot,pr)
|
mcl_structures.fill_chests(p1,p2,loot,pr)
|
||||||
mcl_structures.construct_nodes(p1,p2,{"mcl_brewing:stand_000","mcl_books:bookshelf"})
|
mcl_structures.construct_nodes(p1,p2,{"mcl_brewing:stand_000","mcl_books:bookshelf"})
|
||||||
local mc = minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_core:stonebrickmossy"})
|
spawn_mobs(p1,p2)
|
||||||
if #mc == 2 then
|
|
||||||
table.shuffle(mc)
|
|
||||||
minetest.add_entity(vector.offset(mc[1],0,1,0),"mobs_mc:villager")
|
|
||||||
minetest.add_entity(vector.offset(mc[2],0,1,0),"mobs_mc:villager_zombie")
|
|
||||||
end
|
|
||||||
end, pr)
|
end, pr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ 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)
|
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||||
|
|
||||||
|
local spawnon = {"mcl_core:stripped_oak"}
|
||||||
|
|
||||||
mcl_structures.register_structure("pillager_outpost",{
|
mcl_structures.register_structure("pillager_outpost",{
|
||||||
place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass","group:sand"},
|
place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass","group:sand"},
|
||||||
fill_ratio = 0.01,
|
fill_ratio = 0.01,
|
||||||
|
@ -58,27 +60,27 @@ mcl_structures.register_structure("pillager_outpost",{
|
||||||
after_place = function(p,def,pr)
|
after_place = function(p,def,pr)
|
||||||
local p1 = vector.offset(p,-7,0,-7)
|
local p1 = vector.offset(p,-7,0,-7)
|
||||||
local p2 = vector.offset(p,7,14,7)
|
local p2 = vector.offset(p,7,14,7)
|
||||||
local spawnon = {"mcl_core:stripped_oak"}
|
mcl_structures.spawn_mobs("mobs_mc:pillager",spawnon,p1,p2,pr,5)
|
||||||
local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon)
|
mcl_structures.spawn_mobs("mobs_mc:evoker",spawnon,p1,p2,pr,1)
|
||||||
for _,n in pairs(minetest.find_nodes_in_area(p1,p2,{"group:wall"})) do
|
|
||||||
local def = minetest.registered_nodes[minetest.get_node(n).name:gsub("_%d+$","")]
|
|
||||||
if def and def.on_construct then
|
|
||||||
def.on_construct(n)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if not peaceful then
|
|
||||||
if sp and #sp > 0 then
|
|
||||||
for i=1,5 do
|
|
||||||
local pos = vector.offset(sp[pr:next(1,#sp)],0,1,0)
|
|
||||||
if pos then
|
|
||||||
minetest.add_entity(pos,"mobs_mc:pillager")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local pos = vector.offset(sp[pr:next(1,#sp)],0,1,0)
|
|
||||||
if pos then
|
|
||||||
minetest.add_entity(pos,"mobs_mc:evoker")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mcl_structures.register_structure_spawn({
|
||||||
|
name = "mobs_mc:pillager",
|
||||||
|
y_min = mcl_vars.mg_overworld_min,
|
||||||
|
y_max = mcl_vars.mg_overworld_max,
|
||||||
|
chance = 10,
|
||||||
|
interval = 60,
|
||||||
|
limit = 9,
|
||||||
|
spawnon = spawnon,
|
||||||
|
})
|
||||||
|
|
||||||
|
mcl_structures.register_structure_spawn({
|
||||||
|
name = "mobs_mc:evoker",
|
||||||
|
y_min = mcl_vars.mg_overworld_min,
|
||||||
|
y_max = mcl_vars.mg_overworld_max,
|
||||||
|
chance = 100,
|
||||||
|
interval = 60,
|
||||||
|
limit = 4,
|
||||||
|
spawnon = spawnon,
|
||||||
|
})
|
||||||
|
|
|
@ -3,6 +3,8 @@ 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)
|
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||||
|
|
||||||
|
local spawnon = {"mcl_deepslate:deepslate","mcl_core:birchwood","mcl_wool:red_carpet","mcl_wool:brown_carpet"}
|
||||||
|
|
||||||
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"},
|
||||||
fill_ratio = 0.01,
|
fill_ratio = 0.01,
|
||||||
|
@ -20,28 +22,11 @@ mcl_structures.register_structure("woodland_cabin",{
|
||||||
},
|
},
|
||||||
construct_nodes = {"mcl_barrels:barrel_closed"},
|
construct_nodes = {"mcl_barrels:barrel_closed"},
|
||||||
after_place = function(p,def,pr)
|
after_place = function(p,def,pr)
|
||||||
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 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)
|
mcl_structures.spawn_mobs("mobs_mc:vindicator",spawnon,p1,p2,pr,5)
|
||||||
if not peaceful then
|
mcl_structures.spawn_mobs("mobs_mc:evoker",spawnon,p1,p2,pr,1)
|
||||||
if sp and #sp > 0 then
|
mcl_structures.spawn_mobs("mobs_mc:parrot",{"mcl_heads:wither_skeleton"},p1,p2,pr,1)
|
||||||
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:evoker")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local parrot = minetest.find_node_near(p,25,{"mcl_heads:wither_skeleton"})
|
|
||||||
if parrot then
|
|
||||||
minetest.add_entity(parrot,"mobs_mc:parrot")
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
loot = {
|
loot = {
|
||||||
["mcl_chests:chest_small" ] ={{
|
["mcl_chests:chest_small" ] ={{
|
||||||
|
@ -82,3 +67,23 @@ mcl_structures.register_structure("woodland_cabin",{
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mcl_structures.register_structure_spawn({
|
||||||
|
name = "mobs_mc:vindicator",
|
||||||
|
y_min = mcl_vars.mg_overworld_min,
|
||||||
|
y_max = mcl_vars.mg_overworld_max,
|
||||||
|
chance = 10,
|
||||||
|
interval = 60,
|
||||||
|
limit = 6,
|
||||||
|
spawnon = spawnon,
|
||||||
|
})
|
||||||
|
|
||||||
|
mcl_structures.register_structure_spawn({
|
||||||
|
name = "mobs_mc:evoker",
|
||||||
|
y_min = mcl_vars.mg_overworld_min,
|
||||||
|
y_max = mcl_vars.mg_overworld_max,
|
||||||
|
chance = 50,
|
||||||
|
interval = 60,
|
||||||
|
limit = 6,
|
||||||
|
spawnon = spawnon,
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in a new issue