BlueGit

timfa questward

Add wood-tiered neighbor-connect fences.

Fences autotile like tables per wood material; magenta placeholder sprites cover all 16 connection masks.

timfa Tim Falken · pushed by timfa

Authored 2026-08-31 · 2 months ago

Hash
2f0bc2de340a878bd2f10ad45e247040f61a6603
Parent
0059064d
20 files changed +229 −5
client/assets/blocks/fence/0.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/1.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/10.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/11.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/12.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/13.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/14.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/15.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/2.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/3.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/4.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/5.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/6.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/7.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/8.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/fence/9.png added Binary file +0 −0

The contents of this binary file are not shown.

client/scripts/generate-fence-sprites.mjs added +190 −0
@@ -0,0 +1,190 @@
1 /**
2 * Generate 16×16 magenta wooden fence PNGs for neighbor-connect masks 0–15.
3 * Top-down posts + dual rails; rails extend to tile edges where connected so
4 * adjacent same-wood fences read as one continuous run (same as tables).
5 */
6 import { mkdirSync, writeFileSync } from "node:fs";
7 import { deflateSync } from "node:zlib";
8 import { fileURLToPath } from "node:url";
9 import { dirname, join } from "node:path";
10 import { NeighborBit } from "../../shared/world/neighborConnect.js";
11
12 const SIZE = 16;
13 const OUT = join(dirname(fileURLToPath(import.meta.url)), "../assets/blocks/fence");
14
15 /** Magenta tint family (R≈B, G<R) — catalog tints per wood tier. */
16 const POST = [120, 28, 120, 255];
17 const POST_LIGHT = [170, 45, 170, 255];
18 const POST_SHADE = [90, 18, 90, 255];
19 const RAIL = [200, 55, 200, 255];
20 const RAIL_LIGHT = [230, 75, 230, 255];
21 const RAIL_SHADE = [150, 35, 150, 255];
22
23 const POST_X0 = 6;
24 const POST_X1 = 9;
25 const POST_Y0 = 4;
26 const POST_Y1 = 12;
27 /** Dual horizontal rail bands (pixel y inclusive). */
28 const H_RAILS = Object.freeze([
29 Object.freeze({ y0: 6, y1: 7 }),
30 Object.freeze({ y0: 9, y1: 10 })
31 ]);
32 /** Dual vertical rail bands (pixel x inclusive). */
33 const V_RAILS = Object.freeze([
34 Object.freeze({ x0: 6, x1: 7 }),
35 Object.freeze({ x0: 9, x1: 10 })
36 ]);
37
38 function crcTable ()
39 {
40 const table = new Uint32Array(256);
41 for (let n = 0; n < 256; n++)
42 {
43 let c = n;
44 for (let k = 0; k < 8; k++)
45 { c = (c & 1) ? (0xedb88320 ^ (c >>> 1)) : (c >>> 1); }
46 table[n] = c >>> 0;
47 }
48 return table;
49 }
50
51 const CRC_TABLE = crcTable();
52
53 function crc32 (buf)
54 {
55 let c = 0xffffffff;
56 for (let i = 0; i < buf.length; i++)
57 { c = CRC_TABLE[(c ^ buf[i]) & 0xff] ^ (c >>> 8); }
58 return (c ^ 0xffffffff) >>> 0;
59 }
60
61 function chunk (type, data)
62 {
63 const len = Buffer.alloc(4);
64 len.writeUInt32BE(data.length);
65 const typeBuf = Buffer.from(type, "ascii");
66 const crcBuf = Buffer.alloc(4);
67 crcBuf.writeUInt32BE(crc32(Buffer.concat([typeBuf, data])));
68 return Buffer.concat([len, typeBuf, data, crcBuf]);
69 }
70
71 function encodePng (rgba)
72 {
73 const raw = Buffer.alloc((SIZE * 4 + 1) * SIZE);
74 for (let y = 0; y < SIZE; y++)
75 {
76 const row = y * (SIZE * 4 + 1);
77 raw[row] = 0;
78 for (let x = 0; x < SIZE; x++)
79 {
80 const i = (y * SIZE + x) * 4;
81 const o = row + 1 + x * 4;
82 raw[o] = rgba[i];
83 raw[o + 1] = rgba[i + 1];
84 raw[o + 2] = rgba[i + 2];
85 raw[o + 3] = rgba[i + 3];
86 }
87 }
88 const ihdr = Buffer.alloc(13);
89 ihdr.writeUInt32BE(SIZE, 0);
90 ihdr.writeUInt32BE(SIZE, 4);
91 ihdr[8] = 8;
92 ihdr[9] = 6;
93 ihdr[10] = 0;
94 ihdr[11] = 0;
95 ihdr[12] = 0;
96 return Buffer.concat([
97 Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]),
98 chunk("IHDR", ihdr),
99 chunk("IDAT", deflateSync(raw, { level: 9 })),
100 chunk("IEND", Buffer.alloc(0))
101 ]);
102 }
103
104 function setPx (rgba, x, y, color)
105 {
106 if (x < 0 || y < 0 || x >= SIZE || y >= SIZE)
107 { return; }
108 const i = (y * SIZE + x) * 4;
109 rgba[i] = color[0];
110 rgba[i + 1] = color[1];
111 rgba[i + 2] = color[2];
112 rgba[i + 3] = color[3];
113 }
114
115 function fillRect (rgba, x0, y0, x1, y1, color)
116 {
117 for (let y = y0; y <= y1; y++)
118 {
119 for (let x = x0; x <= x1; x++)
120 { setPx(rgba, x, y, color); }
121 }
122 }
123
124 function paintHorizontalRails (rgba, x0, x1)
125 {
126 for (const band of H_RAILS)
127 {
128 fillRect(rgba, x0, band.y0, x1, band.y1, RAIL);
129 fillRect(rgba, x0, band.y0, x1, band.y0, RAIL_LIGHT);
130 fillRect(rgba, x0, band.y1, x1, band.y1, RAIL_SHADE);
131 }
132 }
133
134 function paintVerticalRails (rgba, y0, y1)
135 {
136 for (const band of V_RAILS)
137 {
138 fillRect(rgba, band.x0, y0, band.x1, y1, RAIL);
139 fillRect(rgba, band.x0, y0, band.x0, y1, RAIL_LIGHT);
140 fillRect(rgba, band.x1, y0, band.x1, y1, RAIL_SHADE);
141 }
142 }
143
144 function paintPost (rgba)
145 {
146 fillRect(rgba, POST_X0, POST_Y0, POST_X1, POST_Y1, POST);
147 fillRect(rgba, POST_X0, POST_Y0, POST_X1, POST_Y0, POST_LIGHT);
148 fillRect(rgba, POST_X0, POST_Y1, POST_X1, POST_Y1, POST_SHADE);
149 fillRect(rgba, POST_X0, POST_Y0, POST_X0, POST_Y1, POST_SHADE);
150 fillRect(rgba, POST_X1, POST_Y0, POST_X1, POST_Y1, POST_LIGHT);
151 // Cap
152 fillRect(rgba, POST_X0 - 1, POST_Y0 - 1, POST_X1 + 1, POST_Y0 - 1, POST_SHADE);
153 fillRect(rgba, POST_X0, POST_Y0 - 1, POST_X1, POST_Y0 - 1, POST_LIGHT);
154 }
155
156 function paintFence (mask)
157 {
158 const rgba = new Uint8Array(SIZE * SIZE * 4);
159 const connectN = (mask & NeighborBit.n) !== 0;
160 const connectE = (mask & NeighborBit.e) !== 0;
161 const connectS = (mask & NeighborBit.s) !== 0;
162 const connectW = (mask & NeighborBit.w) !== 0;
163 const alone = mask === 0;
164
165 const wantH = alone || connectE || connectW;
166 const wantV = alone || connectN || connectS;
167
168 if (wantH)
169 {
170 const x0 = alone ? POST_X0 - 2 : (connectW ? 0 : POST_X0);
171 const x1 = alone ? POST_X1 + 2 : (connectE ? SIZE - 1 : POST_X1);
172 paintHorizontalRails(rgba, x0, x1);
173 }
174 if (wantV)
175 {
176 const y0 = alone ? POST_Y0 + 1 : (connectN ? 0 : POST_Y0);
177 const y1 = alone ? POST_Y1 - 1 : (connectS ? SIZE - 1 : POST_Y1);
178 paintVerticalRails(rgba, y0, y1);
179 }
180
181 paintPost(rgba);
182 return rgba;
183 }
184
185 mkdirSync(OUT, { recursive: true });
186 for (let mask = 0; mask < 16; mask++)
187 {
188 writeFileSync(join(OUT, `${mask}.png`), encodePng(paintFence(mask)));
189 }
190 console.log(`Wrote magenta fence sprites 0–15 to ${OUT}`);
@@ -0,0 +1,190 @@
1/**
2 * Generate 16×16 magenta wooden fence PNGs for neighbor-connect masks 0–15.
3 * Top-down posts + dual rails; rails extend to tile edges where connected so
4 * adjacent same-wood fences read as one continuous run (same as tables).
5 */
6import { mkdirSync, writeFileSync } from "node:fs";
7import { deflateSync } from "node:zlib";
8import { fileURLToPath } from "node:url";
9import { dirname, join } from "node:path";
10import { NeighborBit } from "../../shared/world/neighborConnect.js";
11
12const SIZE = 16;
13const OUT = join(dirname(fileURLToPath(import.meta.url)), "../assets/blocks/fence");
14
15/** Magenta tint family (R≈B, G<R) — catalog tints per wood tier. */
16const POST = [120, 28, 120, 255];
17const POST_LIGHT = [170, 45, 170, 255];
18const POST_SHADE = [90, 18, 90, 255];
19const RAIL = [200, 55, 200, 255];
20const RAIL_LIGHT = [230, 75, 230, 255];
21const RAIL_SHADE = [150, 35, 150, 255];
22
23const POST_X0 = 6;
24const POST_X1 = 9;
25const POST_Y0 = 4;
26const POST_Y1 = 12;
27/** Dual horizontal rail bands (pixel y inclusive). */
28const H_RAILS = Object.freeze([
29 Object.freeze({ y0: 6, y1: 7 }),
30 Object.freeze({ y0: 9, y1: 10 })
31]);
32/** Dual vertical rail bands (pixel x inclusive). */
33const V_RAILS = Object.freeze([
34 Object.freeze({ x0: 6, x1: 7 }),
35 Object.freeze({ x0: 9, x1: 10 })
36]);
37
38function crcTable ()
39{
40 const table = new Uint32Array(256);
41 for (let n = 0; n < 256; n++)
42 {
43 let c = n;
44 for (let k = 0; k < 8; k++)
45 { c = (c & 1) ? (0xedb88320 ^ (c >>> 1)) : (c >>> 1); }
46 table[n] = c >>> 0;
47 }
48 return table;
49}
50
51const CRC_TABLE = crcTable();
52
53function crc32 (buf)
54{
55 let c = 0xffffffff;
56 for (let i = 0; i < buf.length; i++)
57 { c = CRC_TABLE[(c ^ buf[i]) & 0xff] ^ (c >>> 8); }
58 return (c ^ 0xffffffff) >>> 0;
59}
60
61function chunk (type, data)
62{
63 const len = Buffer.alloc(4);
64 len.writeUInt32BE(data.length);
65 const typeBuf = Buffer.from(type, "ascii");
66 const crcBuf = Buffer.alloc(4);
67 crcBuf.writeUInt32BE(crc32(Buffer.concat([typeBuf, data])));
68 return Buffer.concat([len, typeBuf, data, crcBuf]);
69}
70
71function encodePng (rgba)
72{
73 const raw = Buffer.alloc((SIZE * 4 + 1) * SIZE);
74 for (let y = 0; y < SIZE; y++)
75 {
76 const row = y * (SIZE * 4 + 1);
77 raw[row] = 0;
78 for (let x = 0; x < SIZE; x++)
79 {
80 const i = (y * SIZE + x) * 4;
81 const o = row + 1 + x * 4;
82 raw[o] = rgba[i];
83 raw[o + 1] = rgba[i + 1];
84 raw[o + 2] = rgba[i + 2];
85 raw[o + 3] = rgba[i + 3];
86 }
87 }
88 const ihdr = Buffer.alloc(13);
89 ihdr.writeUInt32BE(SIZE, 0);
90 ihdr.writeUInt32BE(SIZE, 4);
91 ihdr[8] = 8;
92 ihdr[9] = 6;
93 ihdr[10] = 0;
94 ihdr[11] = 0;
95 ihdr[12] = 0;
96 return Buffer.concat([
97 Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]),
98 chunk("IHDR", ihdr),
99 chunk("IDAT", deflateSync(raw, { level: 9 })),
100 chunk("IEND", Buffer.alloc(0))
101 ]);
102}
103
104function setPx (rgba, x, y, color)
105{
106 if (x < 0 || y < 0 || x >= SIZE || y >= SIZE)
107 { return; }
108 const i = (y * SIZE + x) * 4;
109 rgba[i] = color[0];
110 rgba[i + 1] = color[1];
111 rgba[i + 2] = color[2];
112 rgba[i + 3] = color[3];
113}
114
115function fillRect (rgba, x0, y0, x1, y1, color)
116{
117 for (let y = y0; y <= y1; y++)
118 {
119 for (let x = x0; x <= x1; x++)
120 { setPx(rgba, x, y, color); }
121 }
122}
123
124function paintHorizontalRails (rgba, x0, x1)
125{
126 for (const band of H_RAILS)
127 {
128 fillRect(rgba, x0, band.y0, x1, band.y1, RAIL);
129 fillRect(rgba, x0, band.y0, x1, band.y0, RAIL_LIGHT);
130 fillRect(rgba, x0, band.y1, x1, band.y1, RAIL_SHADE);
131 }
132}
133
134function paintVerticalRails (rgba, y0, y1)
135{
136 for (const band of V_RAILS)
137 {
138 fillRect(rgba, band.x0, y0, band.x1, y1, RAIL);
139 fillRect(rgba, band.x0, y0, band.x0, y1, RAIL_LIGHT);
140 fillRect(rgba, band.x1, y0, band.x1, y1, RAIL_SHADE);
141 }
142}
143
144function paintPost (rgba)
145{
146 fillRect(rgba, POST_X0, POST_Y0, POST_X1, POST_Y1, POST);
147 fillRect(rgba, POST_X0, POST_Y0, POST_X1, POST_Y0, POST_LIGHT);
148 fillRect(rgba, POST_X0, POST_Y1, POST_X1, POST_Y1, POST_SHADE);
149 fillRect(rgba, POST_X0, POST_Y0, POST_X0, POST_Y1, POST_SHADE);
150 fillRect(rgba, POST_X1, POST_Y0, POST_X1, POST_Y1, POST_LIGHT);
151 // Cap
152 fillRect(rgba, POST_X0 - 1, POST_Y0 - 1, POST_X1 + 1, POST_Y0 - 1, POST_SHADE);
153 fillRect(rgba, POST_X0, POST_Y0 - 1, POST_X1, POST_Y0 - 1, POST_LIGHT);
154}
155
156function paintFence (mask)
157{
158 const rgba = new Uint8Array(SIZE * SIZE * 4);
159 const connectN = (mask & NeighborBit.n) !== 0;
160 const connectE = (mask & NeighborBit.e) !== 0;
161 const connectS = (mask & NeighborBit.s) !== 0;
162 const connectW = (mask & NeighborBit.w) !== 0;
163 const alone = mask === 0;
164
165 const wantH = alone || connectE || connectW;
166 const wantV = alone || connectN || connectS;
167
168 if (wantH)
169 {
170 const x0 = alone ? POST_X0 - 2 : (connectW ? 0 : POST_X0);
171 const x1 = alone ? POST_X1 + 2 : (connectE ? SIZE - 1 : POST_X1);
172 paintHorizontalRails(rgba, x0, x1);
173 }
174 if (wantV)
175 {
176 const y0 = alone ? POST_Y0 + 1 : (connectN ? 0 : POST_Y0);
177 const y1 = alone ? POST_Y1 - 1 : (connectS ? SIZE - 1 : POST_Y1);
178 paintVerticalRails(rgba, y0, y1);
179 }
180
181 paintPost(rgba);
182 return rgba;
183}
184
185mkdirSync(OUT, { recursive: true });
186for (let mask = 0; mask < 16; mask++)
187{
188 writeFileSync(join(OUT, `${mask}.png`), encodePng(paintFence(mask)));
189}
190console.log(`Wrote magenta fence sprites 0–15 to ${OUT}`);
server/src/assets/spriteCatalog.js +3 −3
@@ -27,7 +27,7 @@ import
27 27 spriteImageName
28 28 } from "../../../shared/definitions/tileSprites.js";
29 29 import { preferredSeasonalDefaultState, typeHasSeasonalStates, isSeasonalOverlayVariant } from "../../../shared/world/season.js";
30 import { composeNeighborConnectState, NEIGHBOR_CONNECT_MASK_COUNT } from "../../../shared/world/neighborConnect.js";
30 import { composeNeighborConnectState, NEIGHBOR_CONNECT_MASK_COUNT, definitionUsesMaterialNeighborConnect } from "../../../shared/world/neighborConnect.js";
31 31
32 32 const CHARACTER_DEFINITIONS = Object.freeze({
33 33 "player-body-male": Object.freeze({ key: "player-body-male", id: "player-body-male" }),
@@ -339,9 +339,9 @@ function scanLayer (layerDir, definitions, layer, urlFolder)
339 339 blooms = nextBlooms;
340 340 }
341 341
342 if (layer === "block" && def.key === "table")
342 if (layer === "block" && definitionUsesMaterialNeighborConnect(def))
343 343 {
344 // Magenta mask sources `0`–`15` (+ optional artist `wood`); expand per wood tier.
344 // Magenta mask sources `0`–`15`; expand per wood tier (`pine-0` …).
345 345 states = [];
346 346 for (const material of WOOD_TIER_ORDER)
347 347 {
@@ -27,7 +27,7 @@ import
27 spriteImageName
27 spriteImageName
28 } from "../../../shared/definitions/tileSprites.js";
28 } from "../../../shared/definitions/tileSprites.js";
29import { preferredSeasonalDefaultState, typeHasSeasonalStates, isSeasonalOverlayVariant } from "../../../shared/world/season.js";
29import { preferredSeasonalDefaultState, typeHasSeasonalStates, isSeasonalOverlayVariant } from "../../../shared/world/season.js";
30import { composeNeighborConnectState, NEIGHBOR_CONNECT_MASK_COUNT } from "../../../shared/world/neighborConnect.js";
30import { composeNeighborConnectState, NEIGHBOR_CONNECT_MASK_COUNT, definitionUsesMaterialNeighborConnect } from "../../../shared/world/neighborConnect.js";
31
31
32const CHARACTER_DEFINITIONS = Object.freeze({
32const CHARACTER_DEFINITIONS = Object.freeze({
33 "player-body-male": Object.freeze({ key: "player-body-male", id: "player-body-male" }),
33 "player-body-male": Object.freeze({ key: "player-body-male", id: "player-body-male" }),
@@ -339,9 +339,9 @@ function scanLayer (layerDir, definitions, layer, urlFolder)
339 blooms = nextBlooms;
339 blooms = nextBlooms;
340 }
340 }
341
341
342 if (layer === "block" && def.key === "table")
342 if (layer === "block" && definitionUsesMaterialNeighborConnect(def))
343 {
343 {
344 // Magenta mask sources `0`–`15` (+ optional artist `wood`); expand per wood tier.
344 // Magenta mask sources `0`–`15`; expand per wood tier (`pine-0` …).
345 states = [];
345 states = [];
346 for (const material of WOOD_TIER_ORDER)
346 for (const material of WOOD_TIER_ORDER)
347 {
347 {
server/tests/central-exchange.test.js +15 −0
@@ -40,6 +40,21 @@ test("material neighbor-connect states keep wood id and only match same material
40 40 assert.equal(neighborConnectBlocksMatch(pine, oakNeighbor, def), false);
41 41 });
42 42
43 test("wooden fences use the same material neighbor-connect as tables", () =>
44 {
45 const def = BLOCK_DEFINITIONS[BlockType.fence];
46 assert.equal(def.neighborConnect, true);
47 assert.equal(def.neighborConnectByMaterial, true);
48 assert.equal(def.passable, false);
49 assert.equal(def.blocksLight, false);
50 assert.equal(composeNeighborConnectState(def, "heartwood", 12), "heartwood-12");
51 const pine = { typeId: BlockType.fence, state: "pine-0" };
52 const pineNeighbor = { typeId: BlockType.fence, state: "pine-4" };
53 const oakNeighbor = { typeId: BlockType.fence, state: "oak-4" };
54 assert.equal(neighborConnectBlocksMatch(pine, pineNeighbor, def), true);
55 assert.equal(neighborConnectBlocksMatch(pine, oakNeighbor, def), false);
56 });
57
43 58 test("CE staff entries include sex labels and pickExchangeClerk returns a name", () =>
44 59 {
45 60 assert.ok(CENTRAL_EXCHANGE_STAFF.length >= 2);
@@ -40,6 +40,21 @@ test("material neighbor-connect states keep wood id and only match same material
40 assert.equal(neighborConnectBlocksMatch(pine, oakNeighbor, def), false);
40 assert.equal(neighborConnectBlocksMatch(pine, oakNeighbor, def), false);
41});
41});
42
42
43test("wooden fences use the same material neighbor-connect as tables", () =>
44{
45 const def = BLOCK_DEFINITIONS[BlockType.fence];
46 assert.equal(def.neighborConnect, true);
47 assert.equal(def.neighborConnectByMaterial, true);
48 assert.equal(def.passable, false);
49 assert.equal(def.blocksLight, false);
50 assert.equal(composeNeighborConnectState(def, "heartwood", 12), "heartwood-12");
51 const pine = { typeId: BlockType.fence, state: "pine-0" };
52 const pineNeighbor = { typeId: BlockType.fence, state: "pine-4" };
53 const oakNeighbor = { typeId: BlockType.fence, state: "oak-4" };
54 assert.equal(neighborConnectBlocksMatch(pine, pineNeighbor, def), true);
55 assert.equal(neighborConnectBlocksMatch(pine, oakNeighbor, def), false);
56});
57
43test("CE staff entries include sex labels and pickExchangeClerk returns a name", () =>
58test("CE staff entries include sex labels and pickExchangeClerk returns a name", () =>
44{
59{
45 assert.ok(CENTRAL_EXCHANGE_STAFF.length >= 2);
60 assert.ok(CENTRAL_EXCHANGE_STAFF.length >= 2);
shared/definitions/tiles.js +21 −2
@@ -74,7 +74,8 @@ export const BlockType = Object.freeze({
74 74 fishingSpot: 33,
75 75 jeweleringStation: 34,
76 76 flaxPlant: 35,
77 silkCocoon: 36
77 silkCocoon: 36,
78 fence: 37
78 79 });
79 80
80 81 export const GROUND_DEFINITIONS = Object.freeze({
@@ -401,6 +402,23 @@ export const BLOCK_DEFINITIONS = Object.freeze({
401 402 neighborConnectByMaterial: true,
402 403 defaultNeighborMaterial: WoodTier.pine
403 404 }),
405 [BlockType.fence]: Object.freeze({
406 id: BlockType.fence,
407 key: "fence",
408 displayName: "Fence",
409 passable: false,
410 blocksLight: false,
411 blocksRangedAttacks: false,
412 lightRangeTiles: 0,
413 frames: 1,
414 framesPerRow: 1,
415 animationSpeed: 0,
416 outdoor: true,
417 /** Magenta base `0`–`15`; catalog expands `${wood}-${mask}` like tables. */
418 neighborConnect: true,
419 neighborConnectByMaterial: true,
420 defaultNeighborMaterial: WoodTier.pine
421 }),
404 422 [BlockType.flower]: Object.freeze({
405 423 id: BlockType.flower,
406 424 key: "flower",
@@ -763,11 +781,12 @@ export function listPlaceableBlockPaletteEntries (catalog = null)
763 781 {
764 782 const state = composeNeighborConnectState(def, material, 0);
765 783 const label = MATERIAL_DISPLAY_NAME[material] ?? material;
784 const noun = String(def.displayName ?? def.key).toLowerCase();
766 785 entries.push({
767 786 typeId: def.id,
768 787 state,
769 788 key: def.key,
770 displayName: `${label} table`,
789 displayName: `${label} ${noun}`,
771 790 spriteName: spriteImageName("block", def.key, state)
772 791 });
773 792 }
@@ -74,7 +74,8 @@ export const BlockType = Object.freeze({
74 fishingSpot: 33,
74 fishingSpot: 33,
75 jeweleringStation: 34,
75 jeweleringStation: 34,
76 flaxPlant: 35,
76 flaxPlant: 35,
77 silkCocoon: 36
77 silkCocoon: 36,
78 fence: 37
78});
79});
79
80
80export const GROUND_DEFINITIONS = Object.freeze({
81export const GROUND_DEFINITIONS = Object.freeze({
@@ -401,6 +402,23 @@ export const BLOCK_DEFINITIONS = Object.freeze({
401 neighborConnectByMaterial: true,
402 neighborConnectByMaterial: true,
402 defaultNeighborMaterial: WoodTier.pine
403 defaultNeighborMaterial: WoodTier.pine
403 }),
404 }),
405 [BlockType.fence]: Object.freeze({
406 id: BlockType.fence,
407 key: "fence",
408 displayName: "Fence",
409 passable: false,
410 blocksLight: false,
411 blocksRangedAttacks: false,
412 lightRangeTiles: 0,
413 frames: 1,
414 framesPerRow: 1,
415 animationSpeed: 0,
416 outdoor: true,
417 /** Magenta base `0`–`15`; catalog expands `${wood}-${mask}` like tables. */
418 neighborConnect: true,
419 neighborConnectByMaterial: true,
420 defaultNeighborMaterial: WoodTier.pine
421 }),
404 [BlockType.flower]: Object.freeze({
422 [BlockType.flower]: Object.freeze({
405 id: BlockType.flower,
423 id: BlockType.flower,
406 key: "flower",
424 key: "flower",
@@ -763,11 +781,12 @@ export function listPlaceableBlockPaletteEntries (catalog = null)
763 {
781 {
764 const state = composeNeighborConnectState(def, material, 0);
782 const state = composeNeighborConnectState(def, material, 0);
765 const label = MATERIAL_DISPLAY_NAME[material] ?? material;
783 const label = MATERIAL_DISPLAY_NAME[material] ?? material;
784 const noun = String(def.displayName ?? def.key).toLowerCase();
766 entries.push({
785 entries.push({
767 typeId: def.id,
786 typeId: def.id,
768 state,
787 state,
769 key: def.key,
788 key: def.key,
770 displayName: `${label} table`,
789 displayName: `${label} ${noun}`,
771 spriteName: spriteImageName("block", def.key, state)
790 spriteName: spriteImageName("block", def.key, state)
772 });
791 });
773 }
792 }