Merge pull request 'Add brewing stand and furnace to igloo schematics' (#2776) from igloo_changes into master

Reviewed-on: MineClone2/MineClone2#2776
Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
cora 2022-10-15 22:56:32 +00:00
commit cdca04ed5c
4 changed files with 19 additions and 11 deletions

View File

@ -30,13 +30,17 @@ local function generate_loot(pos, def, pr)
if def.loot then mcl_structures.fill_chests(p1,p2,def.loot,pr) end if def.loot then mcl_structures.fill_chests(p1,p2,def.loot,pr) end
end end
local function construct_nodes(pos,def,pr) function mcl_structures.construct_nodes(p1,p2,nodes)
local nn = minetest.find_nodes_in_area(vector.offset(pos,-def.sidelen/2,0,-def.sidelen/2),vector.offset(pos,def.sidelen/2,def.sidelen,def.sidelen/2),def.construct_nodes) local nn=minetest.find_nodes_in_area(p1,p2,nodes)
for _,p in pairs(nn) do for _,p in pairs(nn) do
mcl_structures.init_node_construct(p) mcl_structures.init_node_construct(p)
end end
end end
local function construct_nodes(pos,def,pr)
return mcl_structures.construct_nodes(vector.offset(pos,-def.sidelen/2,0,-def.sidelen/2),vector.offset(pos,def.sidelen/2,def.sidelen,def.sidelen/2))
end
function mcl_structures.find_lowest_y(pp) function mcl_structures.find_lowest_y(pp)
local y = 31000 local y = 31000

View File

@ -3,22 +3,25 @@ local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname) local modpath = minetest.get_modpath(modname)
function mcl_structures.generate_igloo_top(pos, pr) 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. Need a bit of help with fixing this for furnaces, bookshelves, and brewing stands.
-- Furnace does ot work atm because apparently meta is not set. :-(
local newpos = {x=pos.x,y=pos.y-2,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 path = modpath.."/schematics/mcl_structures_igloo_top.mts"
local rotation = tostring(pr:next(0,3)*90) local rotation = tostring(pr:next(0,3)*90)
return mcl_structures.place_schematic(newpos, path, rotation, nil, true), rotation return mcl_structures.place_schematic(newpos, path, rotation, nil, true, nil, function()
local p1 = vector.offset(pos,-5,-5,-5)
local p2 = vector.offset(pos,5,5,5)
mcl_structures.construct_nodes(p1,p2,{"mcl_furnaces:furnace","mcl_books:bookshelf"})
end), rotation
end end
function mcl_structures.generate_igloo_basement(pos, orientation, loot, pr) function mcl_structures.generate_igloo_basement(pos, orientation, loot, pr)
-- TODO: Add brewing stand
-- 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"
mcl_structures.place_schematic(pos, path, orientation, nil, true, nil, function() mcl_structures.place_schematic(pos, path, orientation, nil, true, nil, function()
local p1 = vector.offset(pos,-5,-5,-5) local p1 = vector.offset(pos,-5,-5,-5)
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"})
local mc = minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_core:stonebrickmossy"}) local mc = minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_core:stonebrickmossy"})
if #mc == 2 then if #mc == 2 then
table.shuffle(mc) table.shuffle(mc)
@ -58,19 +61,19 @@ function mcl_structures.generate_igloo(pos, def, pr)
if rotation == "0" then if rotation == "0" then
dir = {x=-1, y=0, z=0} dir = {x=-1, y=0, z=0}
tdir = {x=1, y=0, z=0} tdir = {x=1, y=0, z=0}
tpos = {x=pos.x+7, y=pos.y-1, z=pos.z+3} tpos = {x=pos.x+7, y=pos.y-2, z=pos.z+3}
elseif rotation == "90" then elseif rotation == "90" then
dir = {x=0, y=0, z=-1} dir = {x=0, y=0, z=-1}
tdir = {x=0, y=0, z=-1} tdir = {x=0, y=0, z=-1}
tpos = {x=pos.x+3, y=pos.y-1, z=pos.z+1} tpos = {x=pos.x+3, y=pos.y-2, z=pos.z+1}
elseif rotation == "180" then elseif rotation == "180" then
dir = {x=1, y=0, z=0} dir = {x=1, y=0, z=0}
tdir = {x=-1, y=0, z=0} tdir = {x=-1, y=0, z=0}
tpos = {x=pos.x+1, y=pos.y-1, z=pos.z+3} tpos = {x=pos.x+1, y=pos.y-2, z=pos.z+3}
elseif rotation == "270" then elseif rotation == "270" then
dir = {x=0, y=0, z=1} dir = {x=0, y=0, z=1}
tdir = {x=0, y=0, z=1} tdir = {x=0, y=0, z=1}
tpos = {x=pos.x+3, y=pos.y-1, z=pos.z+7} tpos = {x=pos.x+3, y=pos.y-2, z=pos.z+7}
else else
return success return success
end end
@ -139,7 +142,7 @@ mcl_structures.register_structure("igloo",{
biomes = { "ColdTaiga", "IcePlainsSpikes", "IcePlains" }, biomes = { "ColdTaiga", "IcePlainsSpikes", "IcePlains" },
place_func = mcl_structures.generate_igloo, place_func = mcl_structures.generate_igloo,
loot = { loot = {
["mcl_chests:chest"] = {{ ["mcl_chests:chest_small"] = {{
stacks_min = 1, stacks_min = 1,
stacks_max = 1, stacks_max = 1,
items = { items = {
@ -157,6 +160,7 @@ mcl_structures.register_structure("igloo",{
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 10 }, { itemstring = "mcl_mobitems:rotten_flesh", weight = 10 },
{ itemstring = "mcl_tools:axe_stone", weight = 2 }, { itemstring = "mcl_tools:axe_stone", weight = 2 },
{ itemstring = "mcl_core:emerald", weight = 1 }, { itemstring = "mcl_core:emerald", weight = 1 },
{ itemstring = "mcl_core:apple_gold", weight = 1 },
} }
}}, }},
} }