Skip to content

Commit b1de9eb

Browse files
authored
Merge pull request #285 from TruncateGame/main
Production Release
2 parents 059235c + 80e313c commit b1de9eb

File tree

66 files changed

+4117
-2786
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4117
-2786
lines changed

.backstage/build-tile-data.js

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,74 +4,76 @@ const fs = require("fs");
44
const path = require("path");
55

66
const INPUT_FILE = path.join(__dirname, "../truncate_client/img/tile_order");
7-
const OUTPUT_RUST = path.join(__dirname, "../truncate_client/src/utils/tex/tiles.rs");
7+
const OUTPUT_RUST = path.join(
8+
__dirname,
9+
"../truncate_client/src/utils/tex/tiles.rs",
10+
);
811
const OUTPUT_JS = path.join(__dirname, "../web_client/src/_data/tiles.js");
912

1013
const raw_tiles = fs
11-
.readFileSync(INPUT_FILE, { encoding: "utf8" })
12-
.split("\n");
14+
.readFileSync(INPUT_FILE, { encoding: "utf8" })
15+
.split("\n")
16+
.filter((t) => /\w/.test(t));
1317

1418
const quad_tiles = {};
1519
for (const tile of raw_tiles) {
16-
if (/_(nw|ne|se|sw)$/i.test(tile)) {
17-
const tile_base = tile.replace(/_(nw|ne|se|sw)$/i, '');
18-
const tile_corner = tile.match(/_(nw|ne|se|sw)$/i)?.[1];
19-
quad_tiles[tile_base] = quad_tiles[tile_base] || {};
20-
quad_tiles[tile_base][tile_corner?.toLowerCase() || "??"] = true
21-
}
20+
if (/_(nw|ne|se|sw)$/i.test(tile)) {
21+
const tile_base = tile.replace(/_(nw|ne|se|sw)$/i, "");
22+
const tile_corner = tile.match(/_(nw|ne|se|sw)$/i)?.[1];
23+
quad_tiles[tile_base] = quad_tiles[tile_base] || {};
24+
quad_tiles[tile_base][tile_corner?.toLowerCase() || "??"] = true;
25+
}
2226
}
2327

2428
const rs_map = [
25-
`#![cfg_attr(rustfmt, rustfmt_skip)]\n`,
26-
`#![allow(dead_code)]\n`,
27-
`use super::{Tex, TexQuad};\n`,
28-
`const fn t(tile: usize) -> Tex {`,
29-
` Tex { tile, tint: None }`,
30-
`}\n`,
31-
`pub const MAX_TILE: usize = ${raw_tiles.length};`,
32-
...raw_tiles.map((tile, i) =>
33-
`pub const ${tile}: Tex = t(${i});`
34-
),
35-
`\npub mod quad {`,
36-
` use super::*;\n`,
37-
...Object.entries(quad_tiles).map(([tile, quadrants]) =>
38-
` pub const ${tile}: TexQuad = [${[
39-
quadrants.nw ? `${tile}_NW` : `NONE`,
40-
quadrants.ne ? `${tile}_NE` : `NONE`,
41-
quadrants.se ? `${tile}_SE` : `NONE`,
42-
quadrants.sw ? `${tile}_SW` : `NONE`,
43-
].join(', ')}];`
44-
),
45-
`}`
29+
`#![cfg_attr(rustfmt, rustfmt_skip)]\n`,
30+
`#![allow(dead_code)]\n`,
31+
`use super::{Tex, TexQuad};\n`,
32+
`const fn t(tile: usize) -> Tex {`,
33+
` Tex { tile, tint: None }`,
34+
`}\n`,
35+
`pub const MAX_TILE: usize = ${raw_tiles.length};`,
36+
...raw_tiles.map((tile, i) => `pub const ${tile}: Tex = t(${i});`),
37+
`\npub mod quad {`,
38+
` use super::*;\n`,
39+
...Object.entries(quad_tiles).map(
40+
([tile, quadrants]) =>
41+
` pub const ${tile}: TexQuad = [${[
42+
quadrants.nw ? `${tile}_NW` : `NONE`,
43+
quadrants.ne ? `${tile}_NE` : `NONE`,
44+
quadrants.se ? `${tile}_SE` : `NONE`,
45+
quadrants.sw ? `${tile}_SW` : `NONE`,
46+
].join(", ")}];`,
47+
),
48+
`}`,
4649
].join("\n");
4750

4851
fs.writeFileSync(OUTPUT_RUST, rs_map);
4952

5053
const js_map = [
51-
`const tiles = {`,
52-
...raw_tiles.map((tile, i) =>
53-
` ${tile}: ${i},`
54-
),
55-
`};\n`,
56-
`const quads = {`,
57-
...Object.entries(quad_tiles).map(([tile, quadrants]) =>
58-
` ${tile}: [[${[
59-
quadrants.nw ? `tiles.${tile}_NW` : `tiles.NONE`,
60-
quadrants.ne ? `tiles.${tile}_NE` : `tiles.NONE`,
61-
].join(', ')}],[${[
62-
quadrants.sw ? `tiles.${tile}_SW` : `tiles.NONE`,
63-
quadrants.se ? `tiles.${tile}_SE` : `tiles.NONE`,
64-
].join(', ')}]],`
65-
),
66-
`};\n`,
67-
`module.exports = async function () {`,
68-
` return {`,
69-
` ...tiles,`,
70-
` QUAD: {`,
71-
` ...quads,`,
72-
` }`,
73-
` }`,
74-
`}`,
54+
`const tiles = {`,
55+
...raw_tiles.map((tile, i) => ` ${tile}: ${i},`),
56+
`};\n`,
57+
`const quads = {`,
58+
...Object.entries(quad_tiles).map(
59+
([tile, quadrants]) =>
60+
` ${tile}: [[${[
61+
quadrants.nw ? `tiles.${tile}_NW` : `tiles.NONE`,
62+
quadrants.ne ? `tiles.${tile}_NE` : `tiles.NONE`,
63+
].join(", ")}],[${[
64+
quadrants.sw ? `tiles.${tile}_SW` : `tiles.NONE`,
65+
quadrants.se ? `tiles.${tile}_SE` : `tiles.NONE`,
66+
].join(", ")}]],`,
67+
),
68+
`};\n`,
69+
`module.exports = async function () {`,
70+
` return {`,
71+
` ...tiles,`,
72+
` QUAD: {`,
73+
` ...quads,`,
74+
` }`,
75+
` }`,
76+
`}`,
7577
].join("\n");
7678

7779
fs.writeFileSync(OUTPUT_JS, js_map);

.github/workflows/test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ jobs:
4545
- name: Install Rust
4646
uses: actions-rs/toolchain@v1
4747
with:
48-
toolchain: ${{ matrix.rust }}
49-
target: ${{ matrix.target }}
50-
override: true
51-
default: true
52-
components: rustfmt, clippy
53-
48+
toolchain: ${{ matrix.rust }}
49+
target: ${{ matrix.target }}
50+
override: true
51+
default: true
52+
components: rustfmt, clippy
53+
5454
- name: Install wasm-pack
5555
uses: jetli/[email protected]
5656
with:
5757
version: ${{env.WASM_PACK_VERSION}}
58-
58+
5959
- name: Install Rust components
6060
if: matrix.workspace == 'truncate_client'
6161
run: |-
62-
cargo install -f wasm-bindgen-cli --version 0.2.92
62+
cargo install -f wasm-bindgen-cli --version 0.2.93
6363
rustup target add wasm32-unknown-unknown
6464
6565
- name: Test

Cargo.lock

Lines changed: 11 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile.client

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN apt-get install -y nodejs
1515

1616
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
1717
# Keep this wasm-bindgen-cli version aligned with the latest egui release's dependency
18-
RUN cargo install -f wasm-bindgen-cli --version 0.2.92
18+
RUN cargo install -f wasm-bindgen-cli --version 0.2.93
1919
RUN rustup target add wasm32-unknown-unknown
2020

2121
RUN mkdir /app

truncate_client/img/tile_order

Lines changed: 18 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ CHECKERBOARD_NW
1717
CHECKERBOARD_NE
1818
CHECKERBOARD_SW
1919
CHECKERBOARD_SE
20+
BASE_WATER_WAVES
2021
BASE_WATER
2122
WATER_WITH_LAND_SE
2223
WATER_WITH_LAND_S
@@ -55,76 +56,20 @@ HOUSE_2
5556
ROOF_2
5657
HOUSE_3
5758
ROOF_3
58-
SMOKE_0
59-
SMOKE_1
60-
SMOKE_2
61-
SMOKE_3
62-
SMOKE_4
6359
BUSH_0
6460
BUSH_FLOWERS_0
6561
BUSH_1
6662
BUSH_FLOWERS_1
6763
BUSH_2
6864
BUSH_FLOWERS_2
69-
WHEAT_WIND_0
70-
WHEAT_WIND_1
71-
WELL
72-
NORTH_DOCK_NW
73-
NORTH_DOCK_NE
74-
NORTH_DOCK_SW
75-
NORTH_DOCK_SE
76-
NORTH_DOCK_SAIL_WIND_0_NW
77-
NORTH_DOCK_SAIL_WIND_0_NE
78-
NORTH_DOCK_SAIL_WIND_1_NW
79-
NORTH_DOCK_SAIL_WIND_1_NE
80-
NORTH_DOCK_SAIL_WIND_2_NW
81-
NORTH_DOCK_SAIL_WIND_2_NE
82-
SOUTH_DOCK_NW
83-
SOUTH_DOCK_NE
84-
SOUTH_DOCK_SW
85-
SOUTH_DOCK_SE
86-
SOUTH_DOCK_SAIL_WIND_0_NW
87-
SOUTH_DOCK_SAIL_WIND_0_SW
88-
SOUTH_DOCK_SAIL_WIND_1_NW
89-
SOUTH_DOCK_SAIL_WIND_1_SW
90-
SOUTH_DOCK_SAIL_WIND_2_NW
91-
SOUTH_DOCK_SAIL_WIND_2_SW
92-
EAST_DOCK_NW
93-
EAST_DOCK_NE
94-
EAST_DOCK_SW
95-
EAST_DOCK_SE
96-
EAST_DOCK_SAIL_WIND_0_NW
97-
EAST_DOCK_SAIL_WIND_0_NE
98-
EAST_DOCK_SAIL_WIND_0_SW
99-
EAST_DOCK_SAIL_WIND_0_SE
100-
EAST_DOCK_SAIL_WIND_1_NW
101-
EAST_DOCK_SAIL_WIND_1_NE
102-
EAST_DOCK_SAIL_WIND_1_SW
103-
EAST_DOCK_SAIL_WIND_1_SE
104-
EAST_DOCK_SAIL_WIND_2_NW
105-
EAST_DOCK_SAIL_WIND_2_NE
106-
EAST_DOCK_SAIL_WIND_2_SW
107-
EAST_DOCK_SAIL_WIND_2_SE
108-
WEST_DOCK_NW
109-
WEST_DOCK_NE
110-
WEST_DOCK_SW
111-
WEST_DOCK_SE
112-
WEST_DOCK_SAIL_WIND_0_NW
113-
WEST_DOCK_SAIL_WIND_0_NE
114-
WEST_DOCK_SAIL_WIND_1_NW
115-
WEST_DOCK_SAIL_WIND_1_NE
116-
WEST_DOCK_SAIL_WIND_2_NW
117-
WEST_DOCK_SAIL_WIND_2_NE
118-
FLOATING_DOCK_NW
119-
FLOATING_DOCK_NE
120-
FLOATING_DOCK_SW
121-
FLOATING_DOCK_SE
122-
FLOATING_DOCK_SAIL_WIND_0_NW
123-
FLOATING_DOCK_SAIL_WIND_0_NE
124-
FLOATING_DOCK_SAIL_WIND_1_NW
125-
FLOATING_DOCK_SAIL_WIND_1_NE
126-
FLOATING_DOCK_SAIL_WIND_2_NW
127-
FLOATING_DOCK_SAIL_WIND_2_NE
65+
ARTIFACT_NW
66+
ARTIFACT_NE
67+
ARTIFACT_SW
68+
ARTIFACT_SE
69+
ARTIFACT_GLYPH_NW
70+
ARTIFACT_GLYPH_NE
71+
ARTIFACT_GLYPH_SW
72+
ARTIFACT_GLYPH_SE
12873
GAME_PIECE_NW
12974
GAME_PIECE_NE
13075
GAME_PIECE_SW
@@ -237,13 +182,15 @@ TOWN_BUTTON_SW
237182
TOWN_BUTTON_SE
238183
TOWN_BUTTON_ROOF_NW
239184
TOWN_BUTTON_ROOF_NE
240-
DOCK_BUTTON_NW
241-
DOCK_BUTTON_NE
242-
DOCK_BUTTON_SW
243-
DOCK_BUTTON_SE
244-
DOCK_BUTTON_SAIL_NW
245-
DOCK_BUTTON_SAIL_NE
185+
ARTIFACT_BUTTON_NW
186+
ARTIFACT_BUTTON_NE
187+
ARTIFACT_BUTTON_SW
188+
ARTIFACT_BUTTON_SE
189+
ARTIFACT_BUTTON_GLYPH_NW
190+
ARTIFACT_BUTTON_GLYPH_NE
191+
ARTIFACT_BUTTON_GLYPH_SW
192+
ARTIFACT_BUTTON_GLYPH_SE
246193
TERRAIN_BUTTON_NW
247194
TERRAIN_BUTTON_NE
248195
TERRAIN_BUTTON_SW
249-
TERRAIN_BUTTON_SE
196+
TERRAIN_BUTTON_SE

truncate_client/img/truncate.aseprite

-729 Bytes
Binary file not shown.
354 Bytes
Loading
12.9 KB
Loading

0 commit comments

Comments
 (0)