igloo fixes, mobspawns, move geode to mcl_structs
This commit is contained in:
parent
a09226c370
commit
7945de1324
|
@ -1,3 +0,0 @@
|
|||
name = mcl_geodes
|
||||
author = cora
|
||||
depends = mcl_init, mcl_structures
|
|
@ -1,13 +1,11 @@
|
|||
mcl_structures.registered_structures = {}
|
||||
|
||||
local function generate_loot(pos, def, pr)
|
||||
local hl = def.sidelen / 2
|
||||
local p1 = vector.offset(pos,-hl,-hl,-hl)
|
||||
local p2 = vector.offset(pos,hl,hl,hl)
|
||||
for it,lt in pairs(def.loot) do
|
||||
|
||||
function mcl_structures.fill_chests(p1,p2,loot,pr)
|
||||
for it,lt in pairs(loot) do
|
||||
local nodes = minetest.find_nodes_in_area(p1, p2, it)
|
||||
for _,p in pairs(nodes) do
|
||||
local lootitems = mcl_loot.get_multi_loot( lt, pr)
|
||||
local lootitems = mcl_loot.get_multi_loot(lt, pr)
|
||||
mcl_structures.init_node_construct(p)
|
||||
local meta = minetest.get_meta(p)
|
||||
local inv = meta:get_inventory()
|
||||
|
@ -16,6 +14,14 @@ local function generate_loot(pos, def, pr)
|
|||
end
|
||||
end
|
||||
|
||||
local function generate_loot(pos, def, pr)
|
||||
local hl = def.sidelen / 2
|
||||
local p1 = vector.offset(pos,-hl,-hl,-hl)
|
||||
local p2 = vector.offset(pos,hl,hl,hl)
|
||||
if def.loot then mcl_structures.fill_chests(p1,p2,def.loot,pr) end
|
||||
end
|
||||
|
||||
|
||||
function mcl_structures.find_lowest_y(pp)
|
||||
local y = 31000
|
||||
for _,p in pairs(pp) do
|
||||
|
@ -43,26 +49,31 @@ function mcl_structures.place_structure(pos, def, pr)
|
|||
end
|
||||
local pp = vector.offset(pos,0,y_offset,0)
|
||||
if def.solid_ground and def.sidelen then
|
||||
local node_stone = "mcl_core:stone"
|
||||
local node_filler = "mcl_core:dirt"
|
||||
local node_top = "mcl_core:dirt_with_grass"
|
||||
|
||||
if minetest.get_mapgen_setting("mg_name") ~= "v6" then
|
||||
local b = minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)]
|
||||
if b.node_top then node_top = b.node_top end
|
||||
if b.node_filler then node_filler = b.node_filler end
|
||||
if b.node_stone then node_stone = b.node_stone end
|
||||
end
|
||||
|
||||
local ground_p1 = vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2)
|
||||
local ground_p2 = vector.offset(pos,def.sidelen/2,-1,def.sidelen/2)
|
||||
|
||||
local solid = minetest.find_nodes_in_area(ground_p1,ground_p2,{"group:solid"})
|
||||
if #solid < ( def.sidelen * def.sidelen ) then
|
||||
if def.make_foundation then
|
||||
minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,ground_p2,{"air","group:liquid"}),{name=node_top})
|
||||
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-4,0),{"air","group:liquid"}),{name=node_filler})
|
||||
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-5,0),vector.offset(ground_p2,0,-30,0),{"air","group:liquid"}),{name=node_stone})
|
||||
local node_stone = "mcl_core:stone"
|
||||
local node_filler = "mcl_core:dirt"
|
||||
local node_top = "mcl_core:dirt_with_grass" or minetest.get_node(ground_p1).name
|
||||
local node_dust = nil
|
||||
|
||||
if minetest.get_mapgen_setting("mg_name") ~= "v6" then
|
||||
local b = minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)]
|
||||
--minetest.log(dump(b.node_top))
|
||||
if b.node_top then node_top = b.node_top end
|
||||
if b.node_filler then node_filler = b.node_filler end
|
||||
if b.node_stone then node_stone = b.node_stone end
|
||||
if b.node_dust then node_dust = b.node_dust end
|
||||
end
|
||||
minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,ground_p2,{"air","group:liquid","mcl_core:snow"}),{name=node_top})
|
||||
if node_dust then
|
||||
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,1,0),vector.offset(ground_p2,0,1,0),{"air"}),{name=node_dust})
|
||||
end
|
||||
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-4,0),{"air","group:liquid","mcl_core:snow"}),{name=node_filler})
|
||||
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-5,0),vector.offset(ground_p2,0,-30,0),{"air","group:liquid","mcl_core:snow"}),{name=node_stone})
|
||||
else
|
||||
if logging then
|
||||
minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. No solid ground.")
|
||||
|
|
|
@ -65,7 +65,7 @@ local function makegeode(pos,def,pr)
|
|||
end
|
||||
|
||||
mcl_structures.register_structure("geode",{
|
||||
place_on = {"mcl_core:stone"},
|
||||
place_on = {"group:material_stone"},
|
||||
noise_params = {
|
||||
offset = 0,
|
||||
scale = 0.00022,
|
||||
|
@ -75,7 +75,7 @@ mcl_structures.register_structure("geode",{
|
|||
persist = 0.001,
|
||||
flags = "absvalue",
|
||||
},
|
||||
flags = "place_center_x, place_center_z, force_placement",
|
||||
flags = "force_placement",
|
||||
terrain_feature = true,
|
||||
y_max = -24,
|
||||
y_min = mcl_vars.mg_overworld_min,
|
|
@ -5,18 +5,27 @@ local modpath = minetest.get_modpath(modname)
|
|||
function mcl_structures.generate_igloo_top(pos, pr)
|
||||
-- FIXME: This spawns bookshelf instead of furnace. Fix this!
|
||||
-- Furnace does ot work atm because apparently meta is not set. :-(
|
||||
local newpos = {x=pos.x,y=pos.y-1,z=pos.z}
|
||||
local newpos = {x=pos.x,y=pos.y-2,z=pos.z}
|
||||
local path = modpath.."/schematics/mcl_structures_igloo_top.mts"
|
||||
local rotation = tostring(pr:next(0,3)*90)
|
||||
return mcl_structures.place_schematic(newpos, path, rotation, nil, true), rotation
|
||||
end
|
||||
|
||||
function mcl_structures.generate_igloo_basement(pos, orientation, pr)
|
||||
function mcl_structures.generate_igloo_basement(pos, orientation, loot, pr)
|
||||
-- TODO: Add brewing stand
|
||||
-- TODO: Add monster eggs
|
||||
-- TODO: Spawn villager and zombie villager
|
||||
local path = modpath.."/schematics/mcl_structures_igloo_basement.mts"
|
||||
mcl_structures.place_schematic(pos, path, orientation, nil, true, nil, igloo_placement_callback, pr)
|
||||
mcl_structures.place_schematic(pos, path, orientation, nil, true, nil, function()
|
||||
local p1 = vector.offset(pos,-5,-5,-5)
|
||||
local p2 = vector.offset(pos,5,5,5)
|
||||
mcl_structures.fill_chests(p1,p2,loot,pr)
|
||||
local mc = minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_core:stonebrickmossy"})
|
||||
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
|
||||
|
||||
function mcl_structures.generate_igloo(pos, def, pr)
|
||||
|
@ -108,7 +117,7 @@ function mcl_structures.generate_igloo(pos, def, pr)
|
|||
minetest.set_node({x=tpos.x,y=tpos.y-y,z=tpos.z}, {name="mcl_core:ladder", param2=ladder_param2})
|
||||
end
|
||||
-- Place basement
|
||||
mcl_structures.generate_igloo_basement(bpos, rotation, pr)
|
||||
mcl_structures.generate_igloo_basement(bpos, rotation, def.loot, pr)
|
||||
-- Place hidden trapdoor
|
||||
minetest.after(5, function(tpos, dir)
|
||||
minetest.set_node(tpos, {name="mcl_doors:trapdoor", param2=20+minetest.dir_to_facedir(dir)}) -- TODO: more reliable param2
|
||||
|
@ -122,6 +131,8 @@ mcl_structures.register_structure("igloo",{
|
|||
fill_ratio = 0.01,
|
||||
sidelen = 16,
|
||||
chunk_probability = 4400,
|
||||
solid_ground = true,
|
||||
make_foundation = true,
|
||||
y_max = mcl_vars.mg_overworld_max,
|
||||
y_min = 0,
|
||||
y_offset = 0,
|
||||
|
|
|
@ -39,6 +39,7 @@ function mcl_structures.place_schematic(pos, schematic, rotation, replacements,
|
|||
minetest.log("verbose", "[mcl_structures] size=" ..minetest.pos_to_string(s.size) .. ", rotation=" .. tostring(rotation) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2))
|
||||
local param = {pos=vector.new(pos), schematic=s, rotation=rotation, replacements=replacements, force_placement=force_placement, flags=flags, p1=p1, p2=p2, after_placement_callback = after_placement_callback, size=vector.new(s.size), pr=pr, callback_param=callback_param}
|
||||
minetest.emerge_area(p1, p2, ecb_place, param)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -236,6 +237,7 @@ dofile(modpath.."/jungle_temple.lua")
|
|||
dofile(modpath.."/ocean_ruins.lua")
|
||||
dofile(modpath.."/witch_hut.lua")
|
||||
dofile(modpath.."/igloo.lua")
|
||||
dofile(modpath.."/geode.lua")
|
||||
|
||||
|
||||
mcl_structures.register_structure("desert_well",{
|
||||
|
|
|
@ -4,7 +4,7 @@ local modpath = minetest.get_modpath(modname)
|
|||
|
||||
mcl_structures.register_structure("jungle_temple",{
|
||||
place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"},
|
||||
fill_ratio = 0.1,
|
||||
fill_ratio = 0.01,
|
||||
flags = "place_center_x, place_center_z",
|
||||
solid_ground = true,
|
||||
make_foundation = true,
|
||||
|
|
|
@ -74,7 +74,7 @@ local cold = {
|
|||
place_on = {"group:sand","mcl_core:gravel","mcl_core:dirt","mcl_core:clay","group:material_stone"},
|
||||
spawn_by = {"mcl_core:water_source"},
|
||||
num_spawn_by = 2,
|
||||
fill_ratio = 0.001,
|
||||
fill_ratio = 0.01,
|
||||
flags = "place_center_x, place_center_z, force_placement",
|
||||
solid_ground = true,
|
||||
make_foundation = true,
|
||||
|
@ -82,7 +82,7 @@ local cold = {
|
|||
y_min = mcl_vars.mg_overworld_min,
|
||||
y_max = -2,
|
||||
biomes = cold_oceans,
|
||||
chunk_probability = 128,
|
||||
chunk_probability = 256,
|
||||
sidelen = 20,
|
||||
filenames = {
|
||||
modpath.."/schematics/mcl_structures_ocean_ruins_cold_1.mts",
|
||||
|
|
|
@ -39,7 +39,7 @@ mcl_structures.register_structure("witch_hut",{
|
|||
fill_ratio = 0.01,
|
||||
flags = "place_center_x, place_center_z, liquid_surface, force_placement",
|
||||
sidelen = 5,
|
||||
chunk_probability = 128,
|
||||
chunk_probability = 256,
|
||||
y_max = mcl_vars.mg_overworld_max,
|
||||
y_min = -4,
|
||||
y_offset = 0,
|
||||
|
|
Loading…
Reference in New Issue