From 3e96a70f691b649158ce0c7196822803943ed106 Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Wed, 28 Oct 2026 21:44:41 +0100 Subject: [PATCH] fix: barracks, stable, workshop and academy in the client: models, icons, colours, names Co-Authored-By: Claude Opus 5.5 --- app/components/icon/Building.vue | 19 +++++ app/diorama/models.ts | 125 +++++++++++++++++++++++++++++++ app/mock/catalog.ts | 4 + app/types/game.ts | 4 + app/utils/palette.ts | 4 + i18n/locales/en.ts | 4 + 6 files changed, 160 insertions(+) diff --git a/app/components/icon/Building.vue b/app/components/icon/Building.vue index 938cde4..7424d33 100644 --- a/app/components/icon/Building.vue +++ b/app/components/icon/Building.vue @@ -53,6 +53,25 @@ defineProps<{ type: BuildingType }>() + + + + + + + + + + + + + + + + + + + diff --git a/app/diorama/models.ts b/app/diorama/models.ts index cd0bc69..364eefd 100644 --- a/app/diorama/models.ts +++ b/app/diorama/models.ts @@ -468,6 +468,131 @@ const models: Record Model> = { } }, + // Military: tents and a weapon rack at first, then a long hall that grows into stone. + barracks(s, t) { + if (t === 0) { + return { + faces: [ + ...pyramid(ngon(-s * 0.4, -s * 0.25, s * 0.42, 6, 0.3), 0, s * 0.75, C.canvas), + ...pyramid(ngon(s * 0.35, s * 0.3, s * 0.38, 6, 0.3), 0, s * 0.7, C.canvasDark), + ...post(s * 0.55, -s * 0.6, s * 0.55, s * 0.04), + ...post(s * 0.85, -s * 0.35, s * 0.55, s * 0.04), + ...box(s * 0.7, -s * 0.48, s * 0.42, s * 0.06, s * 0.45, s * 0.05, C.woodDark), + ...banner(-s * 0.8, s * 0.6, s * 1.15, s * 0.5), + ], + height: s * 1.15, + } + } + if (t === 1) { + return { + faces: [ + ...house(0, 0, s * 1.7, s * 0.9, s * 0.5, s * 0.45, C.wood, C.woodDark), + ...post(s * 0.8, s * 0.72, s * 0.5, s * 0.05), + ...banner(-s * 0.85, s * 0.6, s * 1.2, s * 0.5), + ], + height: s * 1.2, + } + } + if (t === 2) { + return { + faces: [ + ...house(0, 0, s * 1.85, s * 1.0, s * 0.6, s * 0.5, C.plank, C.roofRed), + ...banner(-s * 0.9, s * 0.65, s * 1.35, s * 0.55), + ...banner(s * 0.9, s * 0.65, s * 1.35, s * 0.55), + ], + height: s * 1.35, + } + } + return { + faces: [ + ...box(0, 0, s * 1.9, s * 1.1, 0, s * 0.75, C.stone, C.stoneDark), + ...pyramid(rect(0, 0, s * 2.0, s * 1.2), s * 0.75, s * 0.45, C.slate), + ...prism(ngon(s * 0.85, -s * 0.5, s * 0.25, 6), 0, s * 1.3, C.stone), + ...pyramid(ngon(s * 0.85, -s * 0.5, s * 0.3, 6), s * 1.3, s * 0.4, C.slate), + ...banner(-s * 0.95, s * 0.65, s * 1.6, s * 0.6), + ], + height: s * 1.7, + } + }, + + stable(s, t) { + const fence: Face[] = [ + [-0.9, 0.55], [-0.45, 0.85], [0, 0.85], [0.45, 0.85], [0.9, 0.55], + ].flatMap(([x, y]) => post(s * x!, s * y!, s * 0.3, s * 0.035)) + const hay = box(-s * 0.75, -s * 0.55, s * 0.32, s * 0.28, 0, s * 0.22, C.hay) + if (t === 0) { + return { + faces: [ + ...fence, + ...hay, + ...post(-s * 0.3, -s * 0.4, s * 0.55, s * 0.04), + ...post(s * 0.5, -s * 0.4, s * 0.55, s * 0.04), + plane([[-s * 0.45, -s * 0.75, s * 0.6], [s * 0.65, -s * 0.75, s * 0.6], [s * 0.65, -s * 0.05, s * 0.45], [-s * 0.45, -s * 0.05, s * 0.45]], C.thatch), + ], + height: s * 0.6, + } + } + const [walls, roof] = t === 1 ? [C.wood, C.thatch] : t === 2 ? [C.plank, C.roofRed] : [C.stone, C.slate] + return { + faces: [...house(0, -s * 0.2, s * 1.9, s * 0.85, s * 0.45, s * 0.4, walls, roof), ...fence, ...hay], + height: s * 0.9, + } + }, + + workshop(s, t) { + const logs: Face[] = [ + ...log(s * 0.55, s * 0.7, 0, s * 0.7, s * 0.08, C.wood, C.plank), + ...log(s * 0.55, s * 0.55, 0, s * 0.7, s * 0.08, C.woodDark, C.plank), + ] + if (t === 0) { + return { + faces: [ + ...post(-s * 0.6, -s * 0.5, s * 0.7, s * 0.04), + ...post(s * 0.6, -s * 0.5, s * 0.7, s * 0.04), + ...post(-s * 0.6, s * 0.3, s * 0.55, s * 0.04), + ...post(s * 0.6, s * 0.3, s * 0.55, s * 0.04), + plane([[-s * 0.75, -s * 0.65, s * 0.72], [s * 0.75, -s * 0.65, s * 0.72], [s * 0.75, s * 0.45, s * 0.56], [-s * 0.75, s * 0.45, s * 0.56]], C.plank), + ...crate(-s * 0.15, -s * 0.1, 0, s * 0.3), + ...logs, + ], + height: s * 0.75, + } + } + const [walls, roof] = t === 1 ? [C.wood, C.thatch] : t === 2 ? [C.plank, C.roofRed] : [C.stone, C.slate] + return { + faces: [ + ...house(-s * 0.1, -s * 0.15, s * 1.5, s * 1.0, s * 0.55, s * 0.45, walls, roof), + ...box(s * 0.45, -s * 0.45, s * 0.2, s * 0.2, s * 0.55, s * 0.55, C.stoneDark), + ...logs, + ], + height: s * 1.2, + } + }, + + // The academy (Adelshof): a stone manor with towers. + academy(s, t) { + const tower = (x: number, y: number, h: number): Face[] => [ + ...prism(ngon(x, y, s * 0.24, 6), 0, h, C.stone), + ...pyramid(ngon(x, y, s * 0.3, 6), h, s * 0.4, C.slate), + ] + if (t === 0) { + return { + faces: [...house(0, 0, s * 1.4, s * 1.0, s * 0.65, s * 0.5, C.stone, C.slate), ...tower(s * 0.7, -s * 0.5, s * 1.2)], + height: s * 1.6, + } + } + return { + faces: [ + ...box(0, 0, s * 1.6, s * 1.3, 0, s * 0.9, C.stone, C.stoneDark), + ...pyramid(rect(0, 0, s * 1.75, s * 1.45), s * 0.9, s * 0.6, C.slate), + ...tower(-s * 0.85, -s * 0.7, s * 1.5), + ...tower(s * 0.85, s * 0.7, s * 1.5), + ...banner(0, s * 0.75, s * 1.9, s * 0.6), + ], + height: s * 1.9, + } + }, + // The wall is drawn as the ring around the village, see scene.ts. wall: () => ({ faces: [], height: 0 }), } diff --git a/app/mock/catalog.ts b/app/mock/catalog.ts index 49dbc30..c5b0c2f 100644 --- a/app/mock/catalog.ts +++ b/app/mock/catalog.ts @@ -35,6 +35,10 @@ export const CATALOG: Record = { hiding_place: { space: 1, max_per_village: null, cost: { wood: 50, clay: 60, iron: 50 }, seconds: 10, workers: 0, production: null }, wall: { space: 0, max_per_village: 1, cost: { wood: 50, clay: 100, iron: 20 }, seconds: 20, workers: 1, production: null }, rally_point: { space: 1, max_per_village: 1, cost: { wood: 10, clay: 40, iron: 30 }, seconds: 10, workers: 0, production: null }, + barracks: { space: 6, max_per_village: null, cost: { wood: 200, clay: 170, iron: 90 }, seconds: 30, workers: 3, production: null }, + stable: { space: 6, max_per_village: null, cost: { wood: 270, clay: 240, iron: 260 }, seconds: 40, workers: 3, production: null }, + workshop: { space: 6, max_per_village: null, cost: { wood: 300, clay: 240, iron: 260 }, seconds: 50, workers: 4, production: null }, + academy: { space: 9, max_per_village: 1, cost: { wood: 1500, clay: 2500, iron: 1000 }, seconds: 60, workers: 5, production: null }, } export const BUILDING_TYPES = Object.keys(CATALOG) as BuildingType[] diff --git a/app/types/game.ts b/app/types/game.ts index 8f88425..606f89d 100644 --- a/app/types/game.ts +++ b/app/types/game.ts @@ -15,6 +15,10 @@ export type BuildingType = | 'hiding_place' | 'wall' | 'rally_point' + | 'barracks' + | 'stable' + | 'workshop' + | 'academy' /** Why the server refuses an offer. The client shows `village.blocked.`; no_space means not enough free building space. */ export type BlockedReason = 'max_per_village' | 'no_space' | 'max_level' | 'requires' diff --git a/app/utils/palette.ts b/app/utils/palette.ts index 5123d26..a51ca65 100644 --- a/app/utils/palette.ts +++ b/app/utils/palette.ts @@ -11,6 +11,10 @@ export const BUILDING_COLORS: Record ({ diff --git a/i18n/locales/en.ts b/i18n/locales/en.ts index a57b803..24ca049 100644 --- a/i18n/locales/en.ts +++ b/i18n/locales/en.ts @@ -29,6 +29,10 @@ export default { hiding_place: 'Hiding place', wall: 'Wall', rally_point: 'Rally point', + barracks: 'Barracks', + stable: 'Stable', + workshop: 'Workshop', + academy: 'Academy', }, errors: { unknown: 'Something went wrong.',