From 46f24f6d5bef7d9dcf279fa9e0aaf77e5e2ef0f1 Mon Sep 17 00:00:00 2001 From: Pascal Garber Date: Mon, 23 Nov 2026 20:33:53 +0100 Subject: [PATCH] feat(starter): add twelve Roguelike terrain groups --- .../src/widgets/scene-editor-view.ts | 3 +- docs/design/ui-redesign/TERRAIN.md | 6 +- games/blank-starter/spritesets/roguelike.json | 1542 +++++++++++++++-- .../src/resource/terrain-presets.spec.ts | 30 + packages/gjs/src/widgets/editor/index.ts | 1 + .../gjs/src/widgets/editor/terrain-label.ts | 34 + .../widgets/tiles/terrain-define-dialog.ts | 3 +- packages/translations/de.po | 39 + packages/translations/org.pixelrpg.maker.pot | 39 + scripts/import-kenney-roguelike.mjs | 37 +- 10 files changed, 1595 insertions(+), 139 deletions(-) create mode 100644 packages/gjs/src/widgets/editor/terrain-label.ts diff --git a/apps/maker-gjs/src/widgets/scene-editor-view.ts b/apps/maker-gjs/src/widgets/scene-editor-view.ts index 675a3dc1..380ca53a 100644 --- a/apps/maker-gjs/src/widgets/scene-editor-view.ts +++ b/apps/maker-gjs/src/widgets/scene-editor-view.ts @@ -41,6 +41,7 @@ import { sheetGridOf, type SheetStampPick, type TerrainChipDescriptor, + terrainLabel, type TileDescriptor, type TilesetChipDescriptor, type Tile, @@ -1226,7 +1227,7 @@ export class SceneEditorView extends ResponsiveEditorView { terrain.id, { id: terrain.id, - name: terrain.name ?? terrain.id, + name: terrainLabel(terrain.name ?? terrain.id), tiles: terrainPreviewSpriteIds(terrain).map((id) => (id == null ? null : (byId.get(id)?.paintable ?? null))), tilePx, } satisfies TerrainChipDescriptor, diff --git a/docs/design/ui-redesign/TERRAIN.md b/docs/design/ui-redesign/TERRAIN.md index 0cb0b22e..05d78f61 100644 --- a/docs/design/ui-redesign/TERRAIN.md +++ b/docs/design/ui-redesign/TERRAIN.md @@ -578,8 +578,10 @@ A tap touches at most 9 cells (16 for a 2×2 footprint); a fill of *n* cells tou retrieval date. CC0 asks for no credit; the About page credits Kenney anyway. - **Terrains:** Path (dirt, `ground-29` at (5,7)), Stone (5,13), Sand (5,19), Water (`patch-13`, block (2,0), corners (0,1), members (0,0) (1,0)), Grass (block (2,15), - corners (0,15)). Pool, flower beds and leaves are one dialog each and can follow; five - chips is what fits a phone row without scrolling. + corners (0,15)). The starter has since grown to 17: autumn and purple leaves, the pool, + three flower beds (red, white, blue; the rim is solid, the centre tile walkable) and six + rugs and carpets (`block-9`, walkable). The chip row scrolls sideways, so the count is + not bound by the phone's width. - **Walls:** water Wall; the four ground terrains Free; everything else set by a table in the import script (trees, walls, furniture Wall; floors, rugs, doors Free). - **Names and tags** for the terrains, the fills and the §6.5 list (trees, house, door, diff --git a/games/blank-starter/spritesets/roguelike.json b/games/blank-starter/spritesets/roguelike.json index 466230ea..52e86ef3 100644 --- a/games/blank-starter/spritesets/roguelike.json +++ b/games/blank-starter/spritesets/roguelike.json @@ -1234,31 +1234,71 @@ "id": 171, "col": 0, "row": 3, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 172, "col": 1, "row": 3, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 173, "col": 2, "row": 3, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 174, "col": 3, "row": 3, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 175, "col": 4, "row": 3, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 176, @@ -1571,31 +1611,71 @@ "id": 228, "col": 0, "row": 4, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 229, "col": 1, "row": 4, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 230, "col": 2, "row": 4, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 231, "col": 3, "row": 4, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 232, "col": 4, "row": 4, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 233, @@ -1916,19 +1996,43 @@ "id": 287, "col": 2, "row": 5, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 288, "col": 3, "row": 5, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 289, "col": 4, "row": 5, - "solid": true + "name": "Pool", + "tags": [ + "terrain", + "pool" + ], + "solid": true, + "tileProperties": { + "surface": "water" + } }, { "id": 290, @@ -2240,27 +2344,72 @@ { "id": 342, "col": 0, - "row": 6 + "row": 6, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 343, "col": 1, - "row": 6 + "row": 6, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 344, "col": 2, - "row": 6 + "row": 6, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 345, "col": 3, - "row": 6 + "row": 6, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 346, "col": 4, - "row": 6 + "row": 6, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 347, @@ -2571,27 +2720,71 @@ { "id": 399, "col": 0, - "row": 7 + "row": 7, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 400, "col": 1, - "row": 7 + "row": 7, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 401, "col": 2, - "row": 7 + "row": 7, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 402, "col": 3, - "row": 7 + "row": 7, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 403, "col": 4, - "row": 7 + "row": 7, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 404, @@ -2661,17 +2854,32 @@ { "id": 409, "col": 10, - "row": 7 + "row": 7, + "name": "Teal rug", + "tags": [ + "terrain", + "rug-teal" + ] }, { "id": 410, "col": 11, - "row": 7 + "row": 7, + "name": "Teal rug", + "tags": [ + "terrain", + "rug-teal" + ] }, { "id": 411, "col": 12, - "row": 7 + "row": 7, + "name": "Teal rug", + "tags": [ + "terrain", + "rug-teal" + ] }, { "id": 412, @@ -2979,17 +3187,44 @@ { "id": 458, "col": 2, - "row": 8 + "row": 8, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 459, "col": 3, - "row": 8 + "row": 8, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 460, "col": 4, - "row": 8 + "row": 8, + "name": "Red flower bed", + "tags": [ + "terrain", + "bed-red" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 461, @@ -3059,17 +3294,32 @@ { "id": 466, "col": 10, - "row": 8 + "row": 8, + "name": "Teal rug", + "tags": [ + "terrain", + "rug-teal" + ] }, { "id": 467, "col": 11, - "row": 8 + "row": 8, + "name": "Teal rug", + "tags": [ + "terrain", + "rug-teal" + ] }, { "id": 468, "col": 12, - "row": 8 + "row": 8, + "name": "Teal rug", + "tags": [ + "terrain", + "rug-teal" + ] }, { "id": 469, @@ -3331,27 +3581,72 @@ { "id": 513, "col": 0, - "row": 9 + "row": 9, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 514, "col": 1, - "row": 9 + "row": 9, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 515, "col": 2, - "row": 9 + "row": 9, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 516, "col": 3, - "row": 9 + "row": 9, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 517, "col": 4, - "row": 9 + "row": 9, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 518, @@ -3421,17 +3716,32 @@ { "id": 523, "col": 10, - "row": 9 + "row": 9, + "name": "Teal rug", + "tags": [ + "terrain", + "rug-teal" + ] }, { "id": 524, "col": 11, - "row": 9 + "row": 9, + "name": "Teal rug", + "tags": [ + "terrain", + "rug-teal" + ] }, { "id": 525, "col": 12, - "row": 9 + "row": 9, + "name": "Teal rug", + "tags": [ + "terrain", + "rug-teal" + ] }, { "id": 526, @@ -3770,27 +4080,71 @@ { "id": 570, "col": 0, - "row": 10 + "row": 10, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 571, "col": 1, - "row": 10 + "row": 10, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 572, "col": 2, - "row": 10 + "row": 10, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 573, "col": 3, - "row": 10 + "row": 10, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 574, "col": 4, - "row": 10 + "row": 10, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 575, @@ -3860,17 +4214,32 @@ { "id": 580, "col": 10, - "row": 10 + "row": 10, + "name": "Green rug", + "tags": [ + "terrain", + "rug-green" + ] }, { "id": 581, "col": 11, - "row": 10 + "row": 10, + "name": "Green rug", + "tags": [ + "terrain", + "rug-green" + ] }, { "id": 582, "col": 12, - "row": 10 + "row": 10, + "name": "Green rug", + "tags": [ + "terrain", + "rug-green" + ] }, { "id": 583, @@ -4217,17 +4586,44 @@ { "id": 629, "col": 2, - "row": 11 + "row": 11, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 630, "col": 3, - "row": 11 + "row": 11, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 631, "col": 4, - "row": 11 + "row": 11, + "name": "White flower bed", + "tags": [ + "terrain", + "bed-white" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 632, @@ -4297,17 +4693,32 @@ { "id": 637, "col": 10, - "row": 11 + "row": 11, + "name": "Green rug", + "tags": [ + "terrain", + "rug-green" + ] }, { "id": 638, "col": 11, - "row": 11 + "row": 11, + "name": "Green rug", + "tags": [ + "terrain", + "rug-green" + ] }, { "id": 639, "col": 12, - "row": 11 + "row": 11, + "name": "Green rug", + "tags": [ + "terrain", + "rug-green" + ] }, { "id": 640, @@ -4642,27 +5053,72 @@ { "id": 684, "col": 0, - "row": 12 + "row": 12, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 685, "col": 1, - "row": 12 + "row": 12, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 686, "col": 2, - "row": 12 + "row": 12, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 687, "col": 3, - "row": 12 + "row": 12, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 688, "col": 4, - "row": 12 + "row": 12, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 689, @@ -4724,17 +5180,32 @@ { "id": 694, "col": 10, - "row": 12 + "row": 12, + "name": "Green rug", + "tags": [ + "terrain", + "rug-green" + ] }, { "id": 695, "col": 11, - "row": 12 + "row": 12, + "name": "Green rug", + "tags": [ + "terrain", + "rug-green" + ] }, { "id": 696, "col": 12, - "row": 12 + "row": 12, + "name": "Green rug", + "tags": [ + "terrain", + "rug-green" + ] }, { "id": 697, @@ -5140,27 +5611,71 @@ { "id": 741, "col": 0, - "row": 13 + "row": 13, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 742, "col": 1, - "row": 13 + "row": 13, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 743, "col": 2, - "row": 13 + "row": 13, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 744, "col": 3, - "row": 13 + "row": 13, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 745, "col": 4, - "row": 13 + "row": 13, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 746, @@ -5230,17 +5745,32 @@ { "id": 751, "col": 10, - "row": 13 + "row": 13, + "name": "Orange rug", + "tags": [ + "terrain", + "rug-orange" + ] }, { "id": 752, "col": 11, - "row": 13 + "row": 13, + "name": "Orange rug", + "tags": [ + "terrain", + "rug-orange" + ] }, { "id": 753, "col": 12, - "row": 13 + "row": 13, + "name": "Orange rug", + "tags": [ + "terrain", + "rug-orange" + ] }, { "id": 754, @@ -5656,17 +6186,44 @@ { "id": 800, "col": 2, - "row": 14 + "row": 14, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 801, "col": 3, - "row": 14 + "row": 14, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 802, "col": 4, - "row": 14 + "row": 14, + "name": "Blue flower bed", + "tags": [ + "terrain", + "bed-blue" + ], + "solid": true, + "tileProperties": { + "surface": "grass" + } }, { "id": 803, @@ -5736,17 +6293,32 @@ { "id": 808, "col": 10, - "row": 14 + "row": 14, + "name": "Orange rug", + "tags": [ + "terrain", + "rug-orange" + ] }, { "id": 809, "col": 11, - "row": 14 + "row": 14, + "name": "Orange rug", + "tags": [ + "terrain", + "rug-orange" + ] }, { "id": 810, "col": 12, - "row": 14 + "row": 14, + "name": "Orange rug", + "tags": [ + "terrain", + "rug-orange" + ] }, { "id": 811, @@ -6282,17 +6854,32 @@ { "id": 865, "col": 10, - "row": 15 + "row": 15, + "name": "Orange rug", + "tags": [ + "terrain", + "rug-orange" + ] }, { "id": 866, "col": 11, - "row": 15 + "row": 15, + "name": "Orange rug", + "tags": [ + "terrain", + "rug-orange" + ] }, { "id": 867, "col": 12, - "row": 15 + "row": 15, + "name": "Orange rug", + "tags": [ + "terrain", + "rug-orange" + ] }, { "id": 868, @@ -6815,17 +7402,32 @@ { "id": 922, "col": 10, - "row": 16 + "row": 16, + "name": "Green carpet", + "tags": [ + "terrain", + "carpet-green" + ] }, { "id": 923, "col": 11, - "row": 16 + "row": 16, + "name": "Green carpet", + "tags": [ + "terrain", + "carpet-green" + ] }, { "id": 924, "col": 12, - "row": 16 + "row": 16, + "name": "Green carpet", + "tags": [ + "terrain", + "carpet-green" + ] }, { "id": 925, @@ -7332,17 +7934,32 @@ { "id": 979, "col": 10, - "row": 17 + "row": 17, + "name": "Green carpet", + "tags": [ + "terrain", + "carpet-green" + ] }, { "id": 980, "col": 11, - "row": 17 + "row": 17, + "name": "Green carpet", + "tags": [ + "terrain", + "carpet-green" + ] }, { "id": 981, "col": 12, - "row": 17 + "row": 17, + "name": "Green carpet", + "tags": [ + "terrain", + "carpet-green" + ] }, { "id": 982, @@ -7723,27 +8340,67 @@ { "id": 1026, "col": 0, - "row": 18 + "row": 18, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1027, "col": 1, - "row": 18 + "row": 18, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1028, "col": 2, - "row": 18 + "row": 18, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1029, "col": 3, - "row": 18 + "row": 18, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1030, "col": 4, - "row": 18 + "row": 18, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1031, @@ -7805,17 +8462,32 @@ { "id": 1036, "col": 10, - "row": 18 + "row": 18, + "name": "Green carpet", + "tags": [ + "terrain", + "carpet-green" + ] }, { "id": 1037, "col": 11, - "row": 18 + "row": 18, + "name": "Green carpet", + "tags": [ + "terrain", + "carpet-green" + ] }, { "id": 1038, "col": 12, - "row": 18 + "row": 18, + "name": "Green carpet", + "tags": [ + "terrain", + "carpet-green" + ] }, { "id": 1039, @@ -8212,27 +8884,67 @@ { "id": 1083, "col": 0, - "row": 19 + "row": 19, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1084, "col": 1, - "row": 19 + "row": 19, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1085, "col": 2, - "row": 19 + "row": 19, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1086, "col": 3, - "row": 19 + "row": 19, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1087, "col": 4, - "row": 19 + "row": 19, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1088, @@ -8302,17 +9014,32 @@ { "id": 1093, "col": 10, - "row": 19 + "row": 19, + "name": "Orange carpet", + "tags": [ + "terrain", + "carpet-orange" + ] }, { "id": 1094, "col": 11, - "row": 19 + "row": 19, + "name": "Orange carpet", + "tags": [ + "terrain", + "carpet-orange" + ] }, { "id": 1095, "col": 12, - "row": 19 + "row": 19, + "name": "Orange carpet", + "tags": [ + "terrain", + "carpet-orange" + ] }, { "id": 1096, @@ -8722,17 +9449,41 @@ { "id": 1142, "col": 2, - "row": 20 + "row": 20, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1143, "col": 3, - "row": 20 + "row": 20, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1144, "col": 4, - "row": 20 + "row": 20, + "name": "Autumn leaves", + "tags": [ + "terrain", + "autumn-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1145, @@ -8802,17 +9553,32 @@ { "id": 1150, "col": 10, - "row": 20 + "row": 20, + "name": "Orange carpet", + "tags": [ + "terrain", + "carpet-orange" + ] }, { "id": 1151, "col": 11, - "row": 20 + "row": 20, + "name": "Orange carpet", + "tags": [ + "terrain", + "carpet-orange" + ] }, { "id": 1152, "col": 12, - "row": 20 + "row": 20, + "name": "Orange carpet", + "tags": [ + "terrain", + "carpet-orange" + ] }, { "id": 1153, @@ -9212,27 +9978,67 @@ { "id": 1197, "col": 0, - "row": 21 + "row": 21, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1198, "col": 1, - "row": 21 + "row": 21, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1199, "col": 2, - "row": 21 + "row": 21, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1200, "col": 3, - "row": 21 + "row": 21, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1201, "col": 4, - "row": 21 + "row": 21, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1202, @@ -9302,17 +10108,32 @@ { "id": 1207, "col": 10, - "row": 21 + "row": 21, + "name": "Orange carpet", + "tags": [ + "terrain", + "carpet-orange" + ] }, { "id": 1208, "col": 11, - "row": 21 + "row": 21, + "name": "Orange carpet", + "tags": [ + "terrain", + "carpet-orange" + ] }, { "id": 1209, "col": 12, - "row": 21 + "row": 21, + "name": "Orange carpet", + "tags": [ + "terrain", + "carpet-orange" + ] }, { "id": 1210, @@ -9712,27 +10533,67 @@ { "id": 1254, "col": 0, - "row": 22 + "row": 22, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1255, "col": 1, - "row": 22 + "row": 22, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1256, "col": 2, - "row": 22 + "row": 22, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1257, "col": 3, - "row": 22 + "row": 22, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1258, "col": 4, - "row": 22 + "row": 22, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1259, @@ -9802,17 +10663,32 @@ { "id": 1264, "col": 10, - "row": 22 + "row": 22, + "name": "Teal carpet", + "tags": [ + "terrain", + "carpet-teal" + ] }, { "id": 1265, "col": 11, - "row": 22 + "row": 22, + "name": "Teal carpet", + "tags": [ + "terrain", + "carpet-teal" + ] }, { "id": 1266, "col": 12, - "row": 22 + "row": 22, + "name": "Teal carpet", + "tags": [ + "terrain", + "carpet-teal" + ] }, { "id": 1267, @@ -10222,17 +11098,41 @@ { "id": 1313, "col": 2, - "row": 23 + "row": 23, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1314, "col": 3, - "row": 23 + "row": 23, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1315, "col": 4, - "row": 23 + "row": 23, + "name": "Purple leaves", + "tags": [ + "terrain", + "purple-leaves" + ], + "tileProperties": { + "surface": "grass" + } }, { "id": 1316, @@ -10302,17 +11202,32 @@ { "id": 1321, "col": 10, - "row": 23 + "row": 23, + "name": "Teal carpet", + "tags": [ + "terrain", + "carpet-teal" + ] }, { "id": 1322, "col": 11, - "row": 23 + "row": 23, + "name": "Teal carpet", + "tags": [ + "terrain", + "carpet-teal" + ] }, { "id": 1323, "col": 12, - "row": 23 + "row": 23, + "name": "Teal carpet", + "tags": [ + "terrain", + "carpet-teal" + ] }, { "id": 1324, @@ -10844,17 +11759,32 @@ { "id": 1378, "col": 10, - "row": 24 + "row": 24, + "name": "Teal carpet", + "tags": [ + "terrain", + "carpet-teal" + ] }, { "id": 1379, "col": 11, - "row": 24 + "row": 24, + "name": "Teal carpet", + "tags": [ + "terrain", + "carpet-teal" + ] }, { "id": 1380, "col": 12, - "row": 24 + "row": 24, + "name": "Teal carpet", + "tags": [ + "terrain", + "carpet-teal" + ] }, { "id": 1381, @@ -13168,6 +14098,354 @@ } } } + }, + { + "id": "autumn-leaves", + "name": "Autumn leaves", + "tiles": { + "7": 1142, + "28": 1028, + "31": 1085, + "112": 1030, + "124": 1029, + "127": 1084, + "193": 1144, + "199": 1143, + "223": 1027, + "241": 1087, + "247": 1026, + "253": 1083, + "255": 1086 + }, + "overlay": true, + "layout": { + "preset": "patch-13", + "parts": { + "block": { + "col": 2, + "row": 18 + }, + "corners": { + "col": 0, + "row": 18 + } + } + } + }, + { + "id": "purple-leaves", + "name": "Purple leaves", + "tiles": { + "7": 1313, + "28": 1199, + "31": 1256, + "112": 1201, + "124": 1200, + "127": 1255, + "193": 1315, + "199": 1314, + "223": 1198, + "241": 1258, + "247": 1197, + "253": 1254, + "255": 1257 + }, + "overlay": true, + "layout": { + "preset": "patch-13", + "parts": { + "block": { + "col": 2, + "row": 21 + }, + "corners": { + "col": 0, + "row": 21 + } + } + } + }, + { + "id": "bed-red", + "name": "Red flower bed", + "tiles": { + "7": 458, + "28": 344, + "31": 401, + "112": 346, + "124": 345, + "127": 400, + "193": 460, + "199": 459, + "223": 343, + "241": 403, + "247": 342, + "253": 399, + "255": 402 + }, + "overlay": true, + "layout": { + "preset": "patch-13", + "parts": { + "block": { + "col": 2, + "row": 6 + }, + "corners": { + "col": 0, + "row": 6 + } + } + } + }, + { + "id": "bed-white", + "name": "White flower bed", + "tiles": { + "7": 629, + "28": 515, + "31": 572, + "112": 517, + "124": 516, + "127": 571, + "193": 631, + "199": 630, + "223": 514, + "241": 574, + "247": 513, + "253": 570, + "255": 573 + }, + "overlay": true, + "layout": { + "preset": "patch-13", + "parts": { + "block": { + "col": 2, + "row": 9 + }, + "corners": { + "col": 0, + "row": 9 + } + } + } + }, + { + "id": "bed-blue", + "name": "Blue flower bed", + "tiles": { + "7": 800, + "28": 686, + "31": 743, + "112": 688, + "124": 687, + "127": 742, + "193": 802, + "199": 801, + "223": 685, + "241": 745, + "247": 684, + "253": 741, + "255": 744 + }, + "overlay": true, + "layout": { + "preset": "patch-13", + "parts": { + "block": { + "col": 2, + "row": 12 + }, + "corners": { + "col": 0, + "row": 12 + } + } + } + }, + { + "id": "pool", + "name": "Pool", + "tiles": { + "7": 287, + "28": 173, + "31": 230, + "112": 175, + "124": 174, + "127": 229, + "193": 289, + "199": 288, + "223": 172, + "241": 232, + "247": 171, + "253": 228, + "255": 231 + }, + "overlay": true, + "layout": { + "preset": "patch-13", + "parts": { + "block": { + "col": 2, + "row": 3 + }, + "corners": { + "col": 0, + "row": 3 + } + } + } + }, + { + "id": "rug-teal", + "name": "Teal rug", + "tiles": { + "7": 523, + "28": 409, + "31": 466, + "112": 411, + "124": 410, + "193": 525, + "199": 524, + "241": 468, + "255": 467 + }, + "overlay": true, + "layout": { + "preset": "block-9", + "parts": { + "block": { + "col": 10, + "row": 7 + } + } + } + }, + { + "id": "rug-green", + "name": "Green rug", + "tiles": { + "7": 694, + "28": 580, + "31": 637, + "112": 582, + "124": 581, + "193": 696, + "199": 695, + "241": 639, + "255": 638 + }, + "overlay": true, + "layout": { + "preset": "block-9", + "parts": { + "block": { + "col": 10, + "row": 10 + } + } + } + }, + { + "id": "rug-orange", + "name": "Orange rug", + "tiles": { + "7": 865, + "28": 751, + "31": 808, + "112": 753, + "124": 752, + "193": 867, + "199": 866, + "241": 810, + "255": 809 + }, + "overlay": true, + "layout": { + "preset": "block-9", + "parts": { + "block": { + "col": 10, + "row": 13 + } + } + } + }, + { + "id": "carpet-green", + "name": "Green carpet", + "tiles": { + "7": 1036, + "28": 922, + "31": 979, + "112": 924, + "124": 923, + "193": 1038, + "199": 1037, + "241": 981, + "255": 980 + }, + "overlay": true, + "layout": { + "preset": "block-9", + "parts": { + "block": { + "col": 10, + "row": 16 + } + } + } + }, + { + "id": "carpet-orange", + "name": "Orange carpet", + "tiles": { + "7": 1207, + "28": 1093, + "31": 1150, + "112": 1095, + "124": 1094, + "193": 1209, + "199": 1208, + "241": 1152, + "255": 1151 + }, + "overlay": true, + "layout": { + "preset": "block-9", + "parts": { + "block": { + "col": 10, + "row": 19 + } + } + } + }, + { + "id": "carpet-teal", + "name": "Teal carpet", + "tiles": { + "7": 1378, + "28": 1264, + "31": 1321, + "112": 1266, + "124": 1265, + "193": 1380, + "199": 1379, + "241": 1323, + "255": 1322 + }, + "overlay": true, + "layout": { + "preset": "block-9", + "parts": { + "block": { + "col": 10, + "row": 22 + } + } + } } ], "floorSpriteId": 5, diff --git a/packages/engine/src/resource/terrain-presets.spec.ts b/packages/engine/src/resource/terrain-presets.spec.ts index c4b44a73..c7c5fb4b 100644 --- a/packages/engine/src/resource/terrain-presets.spec.ts +++ b/packages/engine/src/resource/terrain-presets.spec.ts @@ -16,6 +16,7 @@ import { describe, expect, it } from '@gjsify/unit' +import roguelike from '../../../../games/blank-starter/spritesets/roguelike.json' with { type: 'json' } import { TerrainPreset } from '../types/data/index.ts' import { isNormalisedTerrainMask, resolveTerrainTile, terrainFootprint } from './terrain.ts' import { @@ -246,3 +247,32 @@ export default async () => { }) }) } + +describe('the Roguelike starter tileset', () => { + const sprites = roguelike.sprites as ReadonlyArray<{ id: number; solid?: boolean }> + const solid = (id: number): boolean => sprites[id]?.solid === true + const terrain = (id: string) => roguelike.terrains.find((t) => t.id === id) + + it('ships complete brushes for beds, pool, leaves and rugs', () => { + const patches = ['grass', 'autumn-leaves', 'purple-leaves', 'bed-red', 'bed-white', 'bed-blue', 'pool'] + for (const id of patches) expect(Object.keys(terrain(id)?.tiles ?? {}).length).toBe(13) + const rugs = ['rug-teal', 'rug-green', 'rug-orange', 'carpet-green', 'carpet-orange', 'carpet-teal'] + for (const id of rugs) expect(Object.keys(terrain(id)?.tiles ?? {}).length).toBe(9) + }) + + it('makes every flower-bed rim solid and leaves the flowers walkable', () => { + for (const id of ['bed-red', 'bed-white', 'bed-blue']) { + const tiles = terrain(id)?.tiles as Record + for (const [mask, sprite] of Object.entries(tiles)) { + expect(solid(sprite)).toBe(mask !== '255') + } + } + }) + + it('keeps rugs and leaves walkable', () => { + for (const id of ['rug-teal', 'carpet-green', 'autumn-leaves']) { + for (const sprite of Object.values(terrain(id)?.tiles as Record)) + expect(solid(sprite)).toBe(false) + } + }) +}) diff --git a/packages/gjs/src/widgets/editor/index.ts b/packages/gjs/src/widgets/editor/index.ts index 4c1cc82f..c0e9e76b 100644 --- a/packages/gjs/src/widgets/editor/index.ts +++ b/packages/gjs/src/widgets/editor/index.ts @@ -78,6 +78,7 @@ export * from './sheet-detents' export * from './starter-pack-shelf' export * from './teleport-overlay.geometry' export * from './teleport-overlay' +export * from './terrain-label' export * from './terrain-sample' export * from './terrain-thumbnail.geometry' export * from './terrain-thumbnail' diff --git a/packages/gjs/src/widgets/editor/terrain-label.ts b/packages/gjs/src/widgets/editor/terrain-label.ts new file mode 100644 index 00000000..67ff65e7 --- /dev/null +++ b/packages/gjs/src/widgets/editor/terrain-label.ts @@ -0,0 +1,34 @@ +import { gettext as _ } from 'gettext' + +/** Identity marker: the brush names below are translated at the use site. */ +const N_ = (msgid: string): string => msgid + +/** + * The ground brushes the bundled starter tileset ships. Their names live + * in the tileset's JSON as plain English, so the catalogue has to be told + * about them here; a brush an author defines themselves is shown as typed. + */ +const SHIPPED_TERRAIN_NAMES: readonly string[] = [ + N_('Path'), + N_('Stone'), + N_('Sand'), + N_('Water'), + N_('Grass'), + N_('Autumn leaves'), + N_('Purple leaves'), + N_('Red flower bed'), + N_('White flower bed'), + N_('Blue flower bed'), + N_('Pool'), + N_('Teal rug'), + N_('Green rug'), + N_('Orange rug'), + N_('Green carpet'), + N_('Orange carpet'), + N_('Teal carpet'), +] + +/** What a brush chip or list row shows for a brush called `name`. */ +export function terrainLabel(name: string): string { + return SHIPPED_TERRAIN_NAMES.includes(name) ? _(name) : name +} diff --git a/packages/gjs/src/widgets/tiles/terrain-define-dialog.ts b/packages/gjs/src/widgets/tiles/terrain-define-dialog.ts index 507de6d7..45c91421 100644 --- a/packages/gjs/src/widgets/tiles/terrain-define-dialog.ts +++ b/packages/gjs/src/widgets/tiles/terrain-define-dialog.ts @@ -17,6 +17,7 @@ import { import { gettext as _ } from 'gettext' import { readSheetAlpha, type SheetAlpha } from '../editor/sheet-alpha.ts' +import { terrainLabel } from '../editor/terrain-label.ts' import { TerrainSample } from '../editor/terrain-sample.ts' import { TileSheet } from '../editor/tile-sheet.ts' import { type SheetFrame, type SheetGrid, spanOfIndex } from '../editor/tile-sheet.geometry.ts' @@ -358,7 +359,7 @@ export class TerrainDefineDialog extends Adw.Dialog { this._rows = [] for (const terrain of this._terrains) { const row = new Adw.ActionRow({ - title: terrain.name || terrain.id, + title: terrainLabel(terrain.name || terrain.id), subtitle: terrain.layout ? (PRESET_COPY[terrain.layout.preset]?.().title ?? '') : '', activatable: true, }) diff --git a/packages/translations/de.po b/packages/translations/de.po index 3142c946..45136033 100644 --- a/packages/translations/de.po +++ b/packages/translations/de.po @@ -389,6 +389,9 @@ msgstr "Automatisch" msgid "Auto (on load)" msgstr "Automatisch (beim Laden)" +msgid "Autumn leaves" +msgstr "Herbstlaub" + msgid "Back" msgstr "Zurück" @@ -419,6 +422,9 @@ msgstr "Block" msgid "Blocks movement" msgstr "Blockiert die Bewegung" +msgid "Blue flower bed" +msgstr "Blaues Blumenbeet" + msgid "Bottom half blocks" msgstr "Untere Halbblöcke" @@ -891,6 +897,12 @@ msgstr "Grafiken" msgid "Grass" msgstr "Gras" +msgid "Green carpet" +msgstr "Grüner Teppich" + +msgid "Green rug" +msgstr "Grüne Matte" + msgid "Grid" msgstr "Raster" @@ -1439,6 +1451,12 @@ msgstr "Diese Karte im Editor öffnen" msgid "Open web page" msgstr "Webseite öffnen" +msgid "Orange carpet" +msgstr "Oranger Teppich" + +msgid "Orange rug" +msgstr "Orange Matte" + msgid "Paint" msgstr "Malen" @@ -1458,6 +1476,9 @@ msgstr "Teil jedes Spiels." msgid "Paste the code or link a friend sent you." msgstr "Füge den Code oder Link ein, den dir ein Freund oder eine Freundin geschickt hat." +msgid "Path" +msgstr "Weg" + msgid "Paths and areas" msgstr "Wege und Flächen" @@ -1579,6 +1600,9 @@ msgid_plural "Polygon, %d corners" msgstr[0] "Polygon, %d Ecke" msgstr[1] "Polygon, %d Ecken" +msgid "Pool" +msgstr "Becken" + msgid "Position" msgstr "Position" @@ -1600,6 +1624,9 @@ msgstr "Projekte" msgid "Projects you open show up here." msgstr "Projekte, die du öffnest, erscheinen hier." +msgid "Purple leaves" +msgstr "Violettes Laub" + msgid "Quantity" msgstr "Menge" @@ -1629,6 +1656,9 @@ msgstr "Rechteck" msgid "Rectangle %d × %d" msgstr "Rechteck %d × %d" +msgid "Red flower bed" +msgstr "Rotes Blumenbeet" + msgid "Redo" msgstr "Wiederholen" @@ -1969,6 +1999,12 @@ msgstr "Tippe dorthin, wo die Heldenfigur ankommt" msgid "Target map" msgstr "Zielkarte" +msgid "Teal carpet" +msgstr "Türkiser Teppich" + +msgid "Teal rug" +msgstr "Türkise Matte" + msgid "Teleport" msgstr "Teleport" @@ -2265,6 +2301,9 @@ msgstr "Wo es gezeichnet wird" msgid "Which plane the next stroke lands on" msgstr "In welcher Ebene der nächste Strich landet" +msgid "White flower bed" +msgstr "Weißes Blumenbeet" + msgid "Who or what" msgstr "Wer oder was" diff --git a/packages/translations/org.pixelrpg.maker.pot b/packages/translations/org.pixelrpg.maker.pot index c1d78c44..5f730716 100644 --- a/packages/translations/org.pixelrpg.maker.pot +++ b/packages/translations/org.pixelrpg.maker.pot @@ -390,6 +390,9 @@ msgstr "" msgid "Auto (on load)" msgstr "" +msgid "Autumn leaves" +msgstr "" + msgid "Back" msgstr "" @@ -420,6 +423,9 @@ msgstr "" msgid "Blocks movement" msgstr "" +msgid "Blue flower bed" +msgstr "" + msgid "Bottom half blocks" msgstr "" @@ -892,6 +898,12 @@ msgstr "" msgid "Grass" msgstr "" +msgid "Green carpet" +msgstr "" + +msgid "Green rug" +msgstr "" + msgid "Grid" msgstr "" @@ -1440,6 +1452,12 @@ msgstr "" msgid "Open web page" msgstr "" +msgid "Orange carpet" +msgstr "" + +msgid "Orange rug" +msgstr "" + msgid "Paint" msgstr "" @@ -1459,6 +1477,9 @@ msgstr "" msgid "Paste the code or link a friend sent you." msgstr "" +msgid "Path" +msgstr "" + msgid "Paths and areas" msgstr "" @@ -1580,6 +1601,9 @@ msgid_plural "Polygon, %d corners" msgstr[0] "" msgstr[1] "" +msgid "Pool" +msgstr "" + msgid "Position" msgstr "" @@ -1601,6 +1625,9 @@ msgstr "" msgid "Projects you open show up here." msgstr "" +msgid "Purple leaves" +msgstr "" + msgid "Quantity" msgstr "" @@ -1630,6 +1657,9 @@ msgstr "" msgid "Rectangle %d × %d" msgstr "" +msgid "Red flower bed" +msgstr "" + msgid "Redo" msgstr "" @@ -1970,6 +2000,12 @@ msgstr "" msgid "Target map" msgstr "" +msgid "Teal carpet" +msgstr "" + +msgid "Teal rug" +msgstr "" + msgid "Teleport" msgstr "" @@ -2266,6 +2302,9 @@ msgstr "" msgid "Which plane the next stroke lands on" msgstr "" +msgid "White flower bed" +msgstr "" + msgid "Who or what" msgstr "" diff --git a/scripts/import-kenney-roguelike.mjs b/scripts/import-kenney-roguelike.mjs index 0abab78a..963d8f58 100755 --- a/scripts/import-kenney-roguelike.mjs +++ b/scripts/import-kenney-roguelike.mjs @@ -145,7 +145,7 @@ function cellAlpha(image, col, row) { // --------------------------------------------------------------------------- /** - * The five brushes the starter ships (§ 8.1). `origin` is the top-left + * The brushes the starter ships (§ 8.1, § 2.2, § 2.3). `origin` is the top-left * of the preset's FIRST part in the sheet; `parts` nudges a part that * sits somewhere else — only water needs it, its inner corners being * one row below everyone else's (§ 2.2). @@ -171,8 +171,35 @@ const TERRAINS = [ solid: true, }, { id: 'grass', name: 'Grass', preset: TerrainPreset.Patch13, origin: [2, 15], surface: 'grass' }, + { id: 'autumn-leaves', name: 'Autumn leaves', preset: TerrainPreset.Patch13, origin: [2, 18], surface: 'grass' }, + { id: 'purple-leaves', name: 'Purple leaves', preset: TerrainPreset.Patch13, origin: [2, 21], surface: 'grass' }, + // Flower beds: a low stone wall round the flowers. Their rim tiles are + // solid (see BED_WALLS below), the flowers inside are not. + { id: 'bed-red', name: 'Red flower bed', preset: TerrainPreset.Patch13, origin: [2, 6], surface: 'grass' }, + { id: 'bed-white', name: 'White flower bed', preset: TerrainPreset.Patch13, origin: [2, 9], surface: 'grass' }, + { id: 'bed-blue', name: 'Blue flower bed', preset: TerrainPreset.Patch13, origin: [2, 12], surface: 'grass' }, + // The stone-rimmed pool: already solid through SOLID. + { id: 'pool', name: 'Pool', preset: TerrainPreset.Patch13, origin: [2, 3], surface: 'water' }, + // Rugs and carpets: one plain 3×3 block each, walkable. + { id: 'rug-teal', name: 'Teal rug', preset: TerrainPreset.Block9, origin: [10, 7] }, + { id: 'rug-green', name: 'Green rug', preset: TerrainPreset.Block9, origin: [10, 10] }, + { id: 'rug-orange', name: 'Orange rug', preset: TerrainPreset.Block9, origin: [10, 13] }, + { id: 'carpet-green', name: 'Green carpet', preset: TerrainPreset.Block9, origin: [10, 16] }, + { id: 'carpet-orange', name: 'Orange carpet', preset: TerrainPreset.Block9, origin: [10, 19] }, + { id: 'carpet-teal', name: 'Teal carpet', preset: TerrainPreset.Block9, origin: [10, 22] }, ] +/** + * The wall round each flower bed: the 3×3 block minus its centre, and + * the 2×2 of inner corners, whose grey corner stones are wall too. Rows + * are the first row of each bed (red, white, blue). + */ +const BED_WALLS = [6, 9, 12].flatMap((row) => [ + [2, row, 4, row + 2], + [0, row, 1, row + 1], +]) +const BED_FREE = [6, 9, 12].map((row) => [3, row + 1, 3, row + 1]) + /** The plain floor tiles, coarse and fine speckle of each (§ 2.4). */ const FILLS = [ { @@ -280,6 +307,7 @@ const SOLID = [ [49, 18, 52, 22], // minecarts [45, 23, 53, 24], // fences [54, 19, 56, 24], // rock and dirt piles + ...BED_WALLS, // flower-bed rims ] /** @@ -292,6 +320,7 @@ const FREE = [ [24, 17, 26, 17], [31, 17, 33, 17], [38, 17, 40, 17], + ...BED_FREE, // the flowers inside a bed ] /** @@ -311,7 +340,9 @@ function buildTerrains(image) { const layout = defaultTerrainLayout(terrain.preset, terrain.origin[0], terrain.origin[1]) const parts = { ...layout.parts, ...(terrain.parts ?? {}) } const tiles = terrainTilesForPreset(terrain.preset, parts, SHEET) - const expected = terrain.preset === TerrainPreset.Ground29 ? 29 : 13 + const expected = { [TerrainPreset.Ground29]: 29, [TerrainPreset.Patch13]: 13, [TerrainPreset.Block9]: 9 }[ + terrain.preset + ] if (Object.keys(tiles).length !== expected) { throw new Error(`terrain ${terrain.id}: ${Object.keys(tiles).length} tiles, expected ${expected}`) } @@ -382,7 +413,7 @@ function buildSprites(image, terrains) { const data = terrains.find((t) => t.id === spec.id) for (const id of [...Object.values(data.tiles), ...(data.members ?? [])]) { describe(id, { name: spec.name, tags: ['terrain', spec.id] }) - surfaceOf(id, spec.surface) + if (spec.surface) surfaceOf(id, spec.surface) if (spec.solid) describe(id, { solid: true }) } }