Files

52 lines
3.4 KiB
JavaScript

// Типовий проект «Житловий будинок» (магазин держави, будівельні тендери): the state quarter's brick style on a
// family scale. 10 x 8, two storeys, gable roof with the ridge along the street; ground floor = kitchen and dining,
// upper floor = bedroom under the roof. The schematic starts at the plinth (y 1): the plot's ground is the buyer's.
const K = require('../civic/kit')
const { P } = K
function build () {
const ctx = K.start(); const { w, R } = ctx
const B = K.body(ctx, { x1: 3, z1: 4, x2: 12, z2: 11, storeys: 2, name: 'home' })
// front: double door in the middle, a window either side, three windows above
B.door('south', 7, 0); K.steps(w, 7, 8, 12)
for (const a of [4, 11]) { B.window('south', a, 0, { width: 1 }); B.window('south', a, 1, { width: 1 }) }
B.window('south', 7, 1)
for (const side of ['east', 'west']) { B.window(side, 7, 0); B.window(side, 7, 1) }
for (const a of [5, 10]) { B.window('north', a, 0, { width: 1 }); B.window('north', a, 1, { width: 1 }) }
for (const a of [4, 11]) B.lantern('south', a + (a === 4 ? 1 : -1))
// stair along the east wall, from the door side up toward the back
B.stair(0, 11, 10, -1)
for (let z = 6; z <= 9; z++) w.set(10, 7, z, 'dark_oak_fence') // rail along the stair hole
// ground floor: kitchen along the back wall, a table with chairs, lanterns under the upper floor
const kitchen = [['barrel', { facing: 'up' }], ['smoker', { facing: 'south' }], ['crafting_table'], ['water_cauldron', { level: 3 }], ['furnace', { facing: 'south' }]]
kitchen.forEach(([n, p], i) => w.set(4 + i, 2, 5, n, p || {}))
for (let x = 4; x <= 8; x++) w.set(x, 4, 5, 'spruce_trapdoor', { facing: 'south', half: 'top', open: false }) // shelf
w.set(5, 5, 5, 'flower_pot'); w.set(7, 5, 5, 'decorated_pot', { facing: 'south' })
w.set(5, 2, 8, 'dark_oak_fence'); w.set(5, 3, 8, 'dark_oak_pressure_plate')
w.set(6, 2, 8, 'dark_oak_fence'); w.set(6, 3, 8, 'dark_oak_pressure_plate')
w.set(4, 2, 8, 'spruce_stairs', { facing: 'west', half: 'bottom', shape: 'straight' })
w.set(7, 2, 8, 'spruce_stairs', { facing: 'east', half: 'bottom', shape: 'straight' })
for (const [x, z] of [[5, 7], [8, 9]]) w.set(x, 5, z, 'lantern', { hanging: true })
w.set(4, 2, 10, 'barrel', { facing: 'up' })
// upper floor: double bed with nightstands, chest, bookshelves, rug
for (const x of [4, 5]) { w.set(x, 7, 5, 'red_bed', { part: 'head', facing: 'north' }); w.set(x, 7, 6, 'red_bed', { part: 'foot', facing: 'north' }) }
w.set(6, 7, 5, 'barrel', { facing: 'up' }); w.set(6, 8, 5, 'lantern', { hanging: false })
w.set(4, 7, 10, 'chest', { facing: 'north' })
for (const x of [7, 8]) w.set(x, 7, 5, 'bookshelf')
w.set(8, 8, 5, 'lantern', { hanging: false })
for (let x = 4; x <= 8; x++) for (let z = 7; z <= 8; z++) w.set(x, 7, z, 'red_carpet')
w.set(9, 7, 10, 'lantern', { hanging: false })
R.gable(B.x1, B.z1, B.x2, B.z2, B.top, { axis: 'x', pitch: '1:1', overhang: 1, mat: 'spruce' })
const { roofCells, needCeiling } = R.finish(ctx.interiors)
K.trimRoof(w, roofCells, { axis: 'x', from: 2, to: 13, step: 4 })
B.gable('east', { width: 2, rows: 2 }); B.gable('west', { width: 2, rows: 2 })
return K.finish(ctx, { roofCells, needCeiling, entrance: { outside: [7, 2, 12], door: [7, 2, 11], side: 'south' },
reach: { kitchen: [6, 2, 6], table: [6, 2, 9], bed: [5, 7, 7], chest: [4, 7, 9] } })
}
module.exports = { build }