fix: barracks, stable, workshop and academy in the client: models, icons, colours, names
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0c02723b00
commit
3e96a70f69
|
|
@ -53,6 +53,25 @@ defineProps<{ type: BuildingType }>()
|
|||
<path d="M8 20c0-4 1.8-7 4-7s4 3 4 7" />
|
||||
<path d="M2 20h20" />
|
||||
</g>
|
||||
<g v-else-if="type === 'barracks'">
|
||||
<path d="M5 4l10 10M4 5l1-1 3 0-3 3zM15 14l-2 2 3 3 2-2z" />
|
||||
<path d="M19 4L9 14M20 5l-1-1-3 0 3 3zM9 14l2 2-3 3-2-2z" />
|
||||
</g>
|
||||
<g v-else-if="type === 'stable'">
|
||||
<path d="M7 20V9a5 5 0 0 1 10 0v11" />
|
||||
<path d="M5 20h4M15 20h4" />
|
||||
<path d="M9.5 10h.01M14.5 10h.01M9.5 14h.01M14.5 14h.01" />
|
||||
</g>
|
||||
<g v-else-if="type === 'workshop'">
|
||||
<path d="M4 20h16" />
|
||||
<path d="M6 20v-3h12v3" />
|
||||
<path d="M8 17v-3h8v3" />
|
||||
<path d="M13 4l5 5-2 2-5-5zM11.5 8.5L5 15" />
|
||||
</g>
|
||||
<g v-else-if="type === 'academy'">
|
||||
<path d="M4 18h16l1-10-5 4-4-7-4 7-5-4z" />
|
||||
<path d="M4 21h16" />
|
||||
</g>
|
||||
<g v-else-if="type === 'wall'">
|
||||
<path d="M3 20V8h3v3h3V8h3v3h3V8h3v3h3V8v12z" />
|
||||
<path d="M3 15.5h18M9 15.5V20M15 15.5V20M6 11v4.5M12 11v4.5M18 11v4.5" />
|
||||
|
|
|
|||
|
|
@ -468,6 +468,131 @@ const models: Record<BuildingType, (s: number, t: number) => 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 }),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ export const CATALOG: Record<BuildingType, CatalogEntry> = {
|
|||
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[]
|
||||
|
|
|
|||
|
|
@ -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.<reason>`; no_space means not enough free building space. */
|
||||
export type BlockedReason = 'max_per_village' | 'no_space' | 'max_level' | 'requires'
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ export const BUILDING_COLORS: Record<BuildingType, { fill: string; line: string
|
|||
hiding_place: { fill: '#d4c2a8', line: '#4b3622' },
|
||||
wall: { fill: '#cfc7b6', line: '#4f4a42' },
|
||||
rally_point: { fill: '#e2b8a6', line: '#7b1e16' },
|
||||
barracks: { fill: '#d9b9a0', line: '#5c140f' },
|
||||
stable: { fill: '#d8c49a', line: '#5a3d24' },
|
||||
workshop: { fill: '#cbbfa8', line: '#3e2b1a' },
|
||||
academy: { fill: '#e6d29a', line: '#6e5a1f' },
|
||||
}
|
||||
|
||||
export const buildingTileStyle = (type: BuildingType) => ({
|
||||
|
|
|
|||
|
|
@ -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.',
|
||||
|
|
|
|||
Loading…
Reference in New Issue