Files

59 lines
3.5 KiB
JavaScript

// Типовий проект «Цех» (магазин держави, будівельні тендери): a small version of the state factory's hall.
// 14 x 14, one tall room (clear height 9) for machines, the gable to the street with a gate 4 x 5 in an iron frame,
// windows in two rows, girder trusses with lanterns. A workbench line along the west wall; the floor in the middle is
// left free for the owner's machinery. The schematic starts at the plinth (y 1).
const K = require('../civic/kit')
const { C, P, beam } = K
const stairs = (facing, mat) => [mat + '_stairs', { facing, half: 'bottom', shape: 'straight' }]
const girderX = [P.girder, { x: true, z: false, top: false, bottom: false }]
function build () {
const ctx = K.start(); const { w, R } = ctx
const B = K.body(ctx, { x1: 1, z1: 1, x2: 14, z2: 14, storeys: 2, name: 'hall', floor: 'smooth_stone', facade: ['south', 'north'] })
w.box(2, 6, 2, 13, 6, 13, 'air') // one tall room, no upper floor
ctx.rooms.length = 1; ctx.interiors.length = 0; ctx.interiors.push([2, 2, 2, 13, 10, 13])
// gate: 4 wide, 5 high, industrial iron frame, girder lintel; a ramp in front instead of steps
for (let x = 6; x <= 9; x++) {
for (let y = 2; y <= 6; y++) w.clear(x, y, 14)
w.clear(x, 2, 15); w.set(x, 1, 15, ...stairs('north', 'stone_brick')); w.set(x, 7, 14, ...girderX)
}
for (const x of [5, 10]) for (let y = 2; y <= 7; y++) w.set(x, y, 14, P.iron)
for (const a of [2, 12]) { B.window('south', a, 0, { width: 2 }); B.window('south', a, 1, { width: 2 }) }
// back door and windows
B.door('north', 7, 0); for (let x = 7; x <= 8; x++) w.set(x, 1, 0, ...stairs('south', 'stone_brick'))
for (const a of [3, 11]) { B.window('north', a, 0); B.window('north', a, 1) }
// long sides: two rows of windows in three bays, lanterns under the eaves
for (const side of ['east', 'west']) {
for (const a of [3, 7, 11]) { B.window(side, a, 0); B.window(side, a, 1) }
for (const a of [5, 10]) B.lantern(side, a)
}
// trusses: girders across the hall, lanterns hanging from them
for (const z of [4, 8, 12]) {
for (let x = 2; x <= 13; x++) w.set(x, 10, z, ...girderX)
for (const x of [5, 10]) w.set(x, 9, z, 'lantern', { hanging: true })
}
// workbench line along the west wall: tools on an andesite casing counter
const bench = [['crafting_table'], ['smithing_table'], ['stonecutter', { facing: 'east' }], ['anvil', { facing: 'north' }], ['grindstone', { face: 'floor', facing: 'east' }],
[C('andesite_casing')], [C('andesite_casing')], ['barrel', { facing: 'up' }], ['barrel', { facing: 'up' }]]
bench.forEach(([n, p], i) => w.set(2, 2, 3 + i, n, p || {}))
for (const z of [8, 9]) w.set(2, 3, z, C('depot'))
w.set(2, 3, 10, 'barrel', { facing: 'up' })
// storage corner by the back door: chests and a toolbox
for (const x of [11, 12]) w.set(x, 2, 2, 'chest', { facing: 'south' })
w.set(13, 2, 2, C('brown_toolbox'), { facing: 'south' })
w.set(13, 2, 4, 'barrel', { facing: 'up' }); w.set(13, 2, 5, 'barrel', { facing: 'up' })
R.gable(B.x1, B.z1, B.x2, B.z2, B.top, { axis: 'z', pitch: '1:1', overhang: 1, mat: 'spruce' })
const { roofCells, needCeiling } = R.finish(ctx.interiors)
K.trimRoof(w, roofCells, { axis: 'z', from: 0, to: 15, step: 4 })
B.gable('south', { width: 4, rows: 3 }); B.gable('north', { width: 4, rows: 3 })
return K.finish(ctx, { roofCells, needCeiling, entrance: { outside: [7, 2, 15], door: [7, 2, 14], side: 'south' },
reach: { bench: [3, 2, 6], storage: [12, 2, 3], backdoor: [7, 2, 2] } })
}
module.exports = { build }