Run Formatter
parent
36b5c6b856
commit
c6d360109e
|
@ -32,25 +32,25 @@ function bsp.pick_department(options, x_min, x_max, z_min, z_max, x, z, check_in
|
|||
-- Check for inner edges
|
||||
if check_inner then
|
||||
if edges.n then
|
||||
local adjacent_dept, _ = bsp.get_department(options, x, z+1, false)
|
||||
local adjacent_dept, _ = bsp.get_department(options, x, z + 1, false)
|
||||
if adjacent_dept.name == department.name then
|
||||
edges.inner.n = true
|
||||
end
|
||||
end
|
||||
if edges.s then
|
||||
local adjacent_dept, _ = bsp.get_department(options, x, z-1, false)
|
||||
local adjacent_dept, _ = bsp.get_department(options, x, z - 1, false)
|
||||
if adjacent_dept.name == department.name then
|
||||
edges.inner.s = true
|
||||
end
|
||||
end
|
||||
if edges.e then
|
||||
local adjacent_dept, _ = bsp.get_department(options, x+1, z, false)
|
||||
local adjacent_dept, _ = bsp.get_department(options, x + 1, z, false)
|
||||
if adjacent_dept.name == department.name then
|
||||
edges.inner.e = true
|
||||
end
|
||||
end
|
||||
if edges.w then
|
||||
local adjacent_dept, _ = bsp.get_department(options, x-1, z, false)
|
||||
local adjacent_dept, _ = bsp.get_department(options, x - 1, z, false)
|
||||
if adjacent_dept.name == department.name then
|
||||
edges.inner.w = true
|
||||
end
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
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)
|
||||
local wall_height = 10
|
||||
|
||||
-- Corner North/South East/West Top/Bottom
|
||||
local corner_swb = {x=0,y=0,z=0}
|
||||
local corner_seb = {x=15,y=0,z=0}
|
||||
local corner_nwb = {x=0,y=0,z=15}
|
||||
local corner_neb = {x=15,y=0,z=15}
|
||||
local corner_swb = {x = 0, y = 0, z = 0}
|
||||
local corner_seb = {x = 15, y = 0, z = 0}
|
||||
local corner_nwb = {x = 0, y = 0, z = 15}
|
||||
local corner_neb = {x = 15, y = 0, z = 15}
|
||||
|
||||
local corner_swt = {x=0,y=wall_height,z=0}
|
||||
local corner_set = {x=15,y=wall_height,z=0}
|
||||
local corner_nwt = {x=0,y=wall_height,z=15}
|
||||
local corner_net = {x=15,y=wall_height,z=15}
|
||||
local corner_swt = {x = 0, y = wall_height, z = 0}
|
||||
local corner_set = {x = 15, y = wall_height, z = 0}
|
||||
local corner_nwt = {x = 0, y = wall_height, z = 15}
|
||||
local corner_net = {x = 15, y = wall_height, z = 15}
|
||||
|
||||
local rooms = {"lounge", "kitchen", "bedroom"}
|
||||
local display_tables = {
|
||||
|
@ -30,19 +30,12 @@ local display_tables = {
|
|||
nodes = {{pos = {x = 1, y = 0, z = 2}, type = "sofa"}, {pos = {x = 1, y = 0, z = 1}, type = "table"}},
|
||||
rooms = {"lounge"},
|
||||
},
|
||||
{
|
||||
name = "Bed",
|
||||
nodes = {
|
||||
{pos = {x = 2, y = 0, z = 1}, type = "bed"},
|
||||
},
|
||||
rooms = {"bedroom"},
|
||||
},
|
||||
{name = "Bed", nodes = {{pos = {x = 2, y = 0, z = 1}, type = "bed"}}, rooms = {"bedroom"}},
|
||||
}
|
||||
|
||||
|
||||
function schems.get(Perlin, edges, x, z)
|
||||
local schem = schematic.new({x=16,y=16,z=16}, "air")
|
||||
--local has_opening = util.bound_perlin(Perlin, 3, x, 4, z) == 1
|
||||
local schem = schematic.new({x = 16, y = 16, z = 16}, "air")
|
||||
-- local has_opening = util.bound_perlin(Perlin, 3, x, 4, z) == 1
|
||||
|
||||
-- Walls
|
||||
-- Corners First
|
||||
|
@ -90,26 +83,26 @@ function schems.get(Perlin, edges, x, z)
|
|||
|
||||
-- Inner Walls
|
||||
if (util.bound_perlin(Perlin, 10, x, 5, z) > 3) and not place_opening(x) then
|
||||
schematic.fill_area(schem, "showroom:wall", {x=0,y=0,z=0}, {x=0,y=wall_height,z=15})
|
||||
schematic.fill_area(schem, "showroom:wall", {x = 0, y = 0, z = 0}, {x = 0, y = wall_height, z = 15})
|
||||
end
|
||||
if (util.bound_perlin(Perlin, 10, x, 6, z) > 7) and not place_opening(z) then
|
||||
schematic.fill_area(schem, "showroom:wall", {x=0,y=0,z=0}, {x=15,y=wall_height,z=0})
|
||||
schematic.fill_area(schem, "showroom:wall", {x = 0, y = 0, z = 0}, {x = 15, y = wall_height, z = 0})
|
||||
end
|
||||
|
||||
-- Doorways
|
||||
if place_opening(x) then
|
||||
if edges.s then
|
||||
if edges.inner.s then
|
||||
schematic.fill_area(schem, "air", {x=3,y=0,z=0}, {x=12,y=4,z=0})
|
||||
schematic.fill_area(schem, "air", {x = 3, y = 0, z = 0}, {x = 12, y = 4, z = 0})
|
||||
else
|
||||
schematic.fill_area(schem, "air", {x=6,y=0,z=0}, {x=9,y=4,z=0})
|
||||
schematic.fill_area(schem, "air", {x = 6, y = 0, z = 0}, {x = 9, y = 4, z = 0})
|
||||
end
|
||||
end
|
||||
if edges.n then
|
||||
if edges.inner.n then
|
||||
schematic.fill_area(schem, "air", {x=3,y=0,z=15}, {x=12,y=4,z=15})
|
||||
schematic.fill_area(schem, "air", {x = 3, y = 0, z = 15}, {x = 12, y = 4, z = 15})
|
||||
else
|
||||
schematic.fill_area(schem, "air", {x=6,y=0,z=15}, {x=9,y=4,z=15})
|
||||
schematic.fill_area(schem, "air", {x = 6, y = 0, z = 15}, {x = 9, y = 4, z = 15})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -117,16 +110,16 @@ function schems.get(Perlin, edges, x, z)
|
|||
if place_opening(z) then
|
||||
if edges.e then
|
||||
if edges.inner.e then
|
||||
schematic.fill_area(schem, "air", {x=15,y=0,z=1}, {x=15,y=4,z=10})
|
||||
schematic.fill_area(schem, "air", {x = 15, y = 0, z = 1}, {x = 15, y = 4, z = 10})
|
||||
else
|
||||
schematic.fill_area(schem, "air", {x=15,y=0,z=3}, {x=15,y=4,z=6})
|
||||
schematic.fill_area(schem, "air", {x = 15, y = 0, z = 3}, {x = 15, y = 4, z = 6})
|
||||
end
|
||||
end
|
||||
if edges.w then
|
||||
if edges.inner.w then
|
||||
schematic.fill_area(schem, "air", {x=0,y=0,z=1}, {x=0,y=4,z=10})
|
||||
schematic.fill_area(schem, "air", {x = 0, y = 0, z = 1}, {x = 0, y = 4, z = 10})
|
||||
else
|
||||
schematic.fill_area(schem, "air", {x=0,y=0,z=3}, {x=0,y=4,z=6})
|
||||
schematic.fill_area(schem, "air", {x = 0, y = 0, z = 3}, {x = 0, y = 4, z = 6})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,12 +30,12 @@ end
|
|||
|
||||
-- Returns The Decimal Places Of A Random Number
|
||||
function util.tail_perlin(Perlin, x, y, z)
|
||||
local num = Perlin:get_3d({x=x, y=y, z=z})
|
||||
local num = Perlin:get_3d({x = x, y = y, z = z})
|
||||
return num - math.floor(num)
|
||||
end
|
||||
|
||||
-- Returns A Random Number From 1 to limit
|
||||
function util.bound_perlin(Perlin, limit, x, y, z)
|
||||
local num = util.tail_perlin(Perlin, x, y, z)
|
||||
return math.floor((num * (limit-1)) + 0.5) + 1
|
||||
return math.floor((num * (limit - 1)) + 0.5) + 1
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue