add nether bridge fragment

This commit is contained in:
cora 2022-10-28 02:46:06 +02:00
parent 6bc12ec5ec
commit 8aedd6a761
2 changed files with 39 additions and 18 deletions

View File

@ -3,6 +3,21 @@ 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 function spawn_mobs(mob,spawnon,p1,p2,pr,n)
if peaceful then return end
n = n or 1
local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon)
if sp and #sp > 0 then
for i=1,n do
local pos = vector.offset(sp[pr:next(1,#sp)],0,1,0)
if pos then
minetest.add_entity(pos,mob)
end
end
end
end
mcl_structures.register_structure("nether_outpost",{ mcl_structures.register_structure("nether_outpost",{
place_on = {"mcl_nether:netherrack","mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium","mcl_blackstone:basalt","mcl_blackstone:soul_soil","mcl_blackstone:blackstone","mcl_nether:soul_sand"}, place_on = {"mcl_nether:netherrack","mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium","mcl_blackstone:basalt","mcl_blackstone:soul_soil","mcl_blackstone:blackstone","mcl_nether:soul_sand"},
fill_ratio = 0.01, fill_ratio = 0.01,
@ -23,18 +38,26 @@ mcl_structures.register_structure("nether_outpost",{
end end
}) })
local function spawn_mobs(mob,spawnon,p1,p2,pr,n) mcl_structures.register_structure("nether_bridge",{
n = n or 1 place_on = {"mcl_nether:nether_lava_source"},
local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon) fill_ratio = 0.01,
if sp and #sp > 0 then chunk_probability = 100,
for i=1,n do flags = "all_floors liquid_surface",
local pos = vector.offset(sp[pr:next(1,#sp)],0,1,0) --biomes = {"Nether","SoulsandValley","WarpedForest","CrimsonForest","BasaltDelta"},
if pos then sidelen = 38,
minetest.add_entity(pos,mob) solid_ground = false,
make_foundation = false,
y_min = mcl_vars.mg_lava_nether_max - 5,
y_max = mcl_vars.mg_lava_nether_max + 5,
filenames = { modpath.."/schematics/mcl_nether_fortresses_nether_bridge_1.mts" },
y_offset = 0,
after_place = function(pos,def,pr)
local p1 = vector.offset(pos,-14,0,-14)
local p2 = vector.offset(pos,14,24,14)
spawn_mobs("mobs_mc:witherskeleton",{"mcl_blackstone:blackstone_chiseled_polished"},p1,p2,pr,5)
end end
end })
end
end
mcl_structures.register_structure("nether_bulwark",{ mcl_structures.register_structure("nether_bulwark",{
place_on = {"mcl_nether:netherrack","mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium","mcl_blackstone:basalt","mcl_blackstone:soul_soil","mcl_blackstone:blackstone","mcl_nether:soul_sand"}, place_on = {"mcl_nether:netherrack","mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium","mcl_blackstone:basalt","mcl_blackstone:soul_soil","mcl_blackstone:blackstone","mcl_nether:soul_sand"},
fill_ratio = 0.01, fill_ratio = 0.01,
@ -62,13 +85,11 @@ mcl_structures.register_structure("nether_bulwark",{
y_offset = 0, y_offset = 0,
construct_nodes = {"group:wall"}, construct_nodes = {"group:wall"},
after_place = function(pos,def,pr) after_place = function(pos,def,pr)
if not peaceful then
local p1 = vector.offset(pos,-14,0,-14) local p1 = vector.offset(pos,-14,0,-14)
local p2 = vector.offset(pos,14,24,14) local p2 = vector.offset(pos,14,24,14)
spawn_mobs("mobs_mc:piglin",{"mcl_blackstone:blackstone_brick_polished","mcl_stairs:slab_blackstone_polished"},p1,p2,pr,5) spawn_mobs("mobs_mc:piglin",{"mcl_blackstone:blackstone_brick_polished","mcl_stairs:slab_blackstone_polished"},p1,p2,pr,5)
spawn_mobs("mobs_mc:piglin_brute",{"mcl_blackstone:blackstone_brick_polished","mcl_stairs:slab_blackstone_polished"},p1,p2,pr) spawn_mobs("mobs_mc:piglin_brute",{"mcl_blackstone:blackstone_brick_polished","mcl_stairs:slab_blackstone_polished"},p1,p2,pr)
spawn_mobs("mobs_mc:hoglin",{"mcl_blackstone:nether_gold"},p1,p2,pr,4) spawn_mobs("mobs_mc:hoglin",{"mcl_blackstone:nether_gold"},p1,p2,pr,4)
end
end, end,
loot = { loot = {
["mcl_chests:chest_small" ] ={ ["mcl_chests:chest_small" ] ={