Improve Showroom Walls, Round 1

master
benrob0329 2020-01-30 21:35:08 -05:00
parent aa45537794
commit fb26f15e27
3 changed files with 44 additions and 29 deletions

View File

@ -1,5 +1,5 @@
ikea = {} ikea = {}
ikea.mapgen_options = {departments = {}, min_size = 8, max_size = 16} ikea.mapgen_options = {departments = {}, min_size = 3, max_size = 8}
ikea.registered_furniture = {} ikea.registered_furniture = {}
local apipath = minetest.get_modpath("ikea") .. "/api" local apipath = minetest.get_modpath("ikea") .. "/api"

View File

@ -32,8 +32,8 @@ ikea.register_department({
name = "showroom", name = "showroom",
get_schematic = function(edges, x, z) get_schematic = function(edges, x, z)
if edges.e or edges.w or edges.n or edges.s then if edges.e or edges.w or edges.n or edges.s then
--return schems.get_outer(Perlin, edges, x, z), nil return schems.get_outer(Perlin, edges, x, z), nil
return schems.floor, nil --return schems.floor, nil
else else
return schems.get_inner(Perlin, x, z), nil return schems.get_inner(Perlin, x, z), nil
end end

View File

@ -1,5 +1,6 @@
local schems = {} local schems = {}
schems.floor = schematic.new({x=16,y=1,z=16}, "showroom:floor") schems.floor = schematic.new({x=16,y=1,z=16}, "showroom:floor")
local place_opening = util.every_n_mapblocks(4)
-- Corner North/South East/West Top/Bottom -- Corner North/South East/West Top/Bottom
local corner_swb = {x=0,y=0,z=0} local corner_swb = {x=0,y=0,z=0}
@ -14,36 +15,50 @@ local corner_net = {x=15,y=10,z=15}
function schems.get_outer(Perlin, edges, x, z) function schems.get_outer(Perlin, edges, x, z)
local schem = schematic.new({x=16,y=16,z=16}, "air") local schem = schematic.new({x=16,y=16,z=16}, "air")
local has_opening = util.bound_perlin(Perlin, 8, x, 4, z) + 1 == 1 --local has_opening = util.bound_perlin(Perlin, 3, x, 4, z) == 1
-- Corners First -- Corners First
if edges.n and edges.e then if edges.s and edges.w then
schematic.fill_area(schem, "showroom:wall", corner_swb, corner_swt)
elseif edges.n and edges.w then
schematic.fill_area(schem, "showroom:wall", corner_seb, corner_set)
elseif edges.s and edges.w then
schematic.fill_area(schem, "showroom:wall", corner_neb, corner_net)
elseif edges.s and edges.e then
schematic.fill_area(schem, "showroom:wall", corner_nwb, corner_nwt)
elseif edges.n then
schematic.fill_area(schem, "showroom:wall", corner_swb, corner_set) schematic.fill_area(schem, "showroom:wall", corner_swb, corner_set)
if has_opening then
schematic.fill_area(schem, "air", {x=7,y=0,z=0}, {x=8,y=4,z=0})
end
elseif edges.s then
schematic.fill_area(schem, "showroom:wall", corner_nwb, corner_net)
if has_opening then
schematic.fill_area(schem, "air", {x=7,y=0,z=15}, {x=8,y=4,z=15})
end
elseif edges.w then
schematic.fill_area(schem, "showroom:wall", corner_seb, corner_net)
if has_opening then
schematic.fill_area(schem, "air", {x=15,y=0,z=7}, {x=15,y=4,z=8})
end
elseif edges.e then
schematic.fill_area(schem, "showroom:wall", corner_swb, corner_nwt) schematic.fill_area(schem, "showroom:wall", corner_swb, corner_nwt)
if has_opening then elseif edges.s and edges.e then
schematic.fill_area(schem, "air", {x=0,y=0,z=7}, {x=0,y=4,z=8}) schematic.fill_area(schem, "showroom:wall", corner_seb, corner_swt)
schematic.fill_area(schem, "showroom:wall", corner_seb, corner_net)
elseif edges.n and edges.e then
schematic.fill_area(schem, "showroom:wall", corner_neb, corner_nwt)
schematic.fill_area(schem, "showroom:wall", corner_neb, corner_set)
elseif edges.n and edges.w then
schematic.fill_area(schem, "showroom:wall", corner_nwb, corner_net)
schematic.fill_area(schem, "showroom:wall", corner_nwb, corner_swt)
elseif edges.s then
schematic.fill_area(schem, "showroom:wall", corner_swb, corner_set)
elseif edges.n then
schematic.fill_area(schem, "showroom:wall", corner_nwb, corner_net)
elseif edges.e then
schematic.fill_area(schem, "showroom:wall", corner_seb, corner_net)
elseif edges.w then
schematic.fill_area(schem, "showroom:wall", corner_swb, corner_nwt)
end
-- Doorways
if edges.s then
if place_opening(x) then
schematic.fill_area(schem, "air", {x=6,y=0,z=0}, {x=9,y=4,z=0})
end
end
if edges.n then
if place_opening(x) then
schematic.fill_area(schem, "air", {x=6,y=0,z=15}, {x=9,y=4,z=15})
end
end
if edges.e then
if place_opening(z) then
schematic.fill_area(schem, "air", {x=15,y=0,z=3}, {x=15,y=4,z=6})
end
end
if edges.w then
if place_opening(z) then
schematic.fill_area(schem, "air", {x=0,y=0,z=3}, {x=0,y=4,z=6})
end end
end end