Skip to content

Commit 0a37542

Browse files
committed
Collision surface sounds
1 parent 6236529 commit 0a37542

File tree

10 files changed

+82
-12
lines changed

10 files changed

+82
-12
lines changed
76 KB
Binary file not shown.
67.7 KB
Binary file not shown.
114 KB
Binary file not shown.
95.3 KB
Binary file not shown.
75.1 KB
Binary file not shown.
79.4 KB
Binary file not shown.
88.9 KB
Binary file not shown.
82.7 KB
Binary file not shown.

web/src/pages/reference/ID_Lists/Surface_Materials.astro

Lines changed: 71 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
2-
import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro";
3-
4-
import { getSeeAlsoLinksFromList } from "@src/utils/general";
2+
import { getAssetAudioPath, getSeeAlsoLinksFromList } from "@src/utils/general";
53
import SeeAlsoSection from "@src/components/SeeAlsoSection.astro";
64
75
import { Code } from "@astrojs/starlight/components";
86
import NoteBox from "@src/components/NoteBox.astro";
97
108
import { materials } from "@src/data/materials";
9+
import AutoStarlightPage from "@src/components/AutoStarlightPage.astro";
1110
1211
// Group materials by category
1312
const materialsByCategory: Record<string, typeof materials> = {};
@@ -29,11 +28,11 @@ materials.forEach((material) => {
2928
luaTable += `}`;
3029
---
3130

32-
<StarlightPage
31+
<AutoStarlightPage
3332
frontmatter={{
3433
template: "doc",
3534
title: "Surface Materials",
36-
tableOfContents: false,
35+
tableOfContents: true,
3736
}}
3837
>
3938
<p>
@@ -52,11 +51,8 @@ luaTable += `}`;
5251
>
5352
</p>
5453

55-
<NoteBox type="tip"
56-
>Even though many surfaces have the same sound, they have different physical
57-
properties. For example, water (shallow) causes a splashing effect when
58-
walking.</NoteBox
59-
>
54+
<h2>Groups</h2>
55+
<hr/>
6056

6157
{
6258
sortedCategories.map((category) => (
@@ -84,13 +80,76 @@ luaTable += `}`;
8480
))
8581
}
8682

83+
<h2>Collision surface sounds</h2>
84+
<hr/>
85+
<br/>
86+
87+
<NoteBox type="tip"
88+
>Even though many surfaces have the same sound, they have different physical
89+
properties. For example, water (shallow) causes a splashing effect when
90+
walking.</NoteBox
91+
>
92+
93+
<table class="audio-table">
94+
<thead>
95+
<tr>
96+
<th>Groups</th>
97+
<th>Sound</th>
98+
<th>Surface types</th>
99+
</tr>
100+
</thead>
101+
<tbody>
102+
<tr>
103+
<td>Default, Concrete, Gravel, Dirt, Sand, Stone, Misc</td>
104+
<td><audio controls><source src={await getAssetAudioPath("Surface-sounds/Surface_default.mp3")} type="audio/mpeg"></audio></td>
105+
<td>Default, Tarmac, Tarmac (fucked), Tarmac (really fucked), Pavement, Pavement (fucked), Concrete (fucked), Painted Ground, P Concrete, P Poolside, P Concrete (litter), P Alley Rubish, P Airport Ground, Floor (concrete), P Roadside, Waste Ground, Woodland Ground, Mud Wet, P Woodland, P Wood Dense, P Waste Ground, P Roadside Des, Steep Clif, Rock (dry), Rock (wet), Rock (cliff), Transparent Stone, Stairs (stone), Empty1, Empty2, Cardboard Box, Ped, Transparent Cloth, Rubber, Plastic, Plastic Barrier</td>
106+
</tr>
107+
<tr>
108+
<td>Concrete, Gravel, Dirt, Sand, Misc</td>
109+
<td><audio controls><source src={await getAssetAudioPath("Surface-sounds/Surface_sand.mp3")} type="audio/mpeg"></audio></td>
110+
<td>Concrete (beach), P Docklands, P Industrial, P Building Site, P Dirt (rocky), P Dirt (weeds), P River Edge, P Forest (stumps), P Forest (sticks), P Forest (leaves), Forest (dry), Sand (deep), Sand (medium), Sand (compact), Sand (arid), Sand (more), Sand (beach), P Sand, P Sand (dense), P Sand (arid), P Sand (compact), P Sand (rocky), P Sand (beach), P Desert Rocks, Carpet, Bin Bag, Plastic Cone, Plastic Dumpster, Gore</td>
111+
</tr>
112+
<tr>
113+
<td>Concrete, Wood, Misc</td>
114+
<td><audio controls><source src={await getAssetAudioPath("Surface-sounds/Surface_wood.mp3")} type="audio/mpeg"></audio></td>
115+
<td>P Industrial Jetty, Wood (crates), Wood (solid), Wood (thin), Wood (bench), Floorboard, Stairs (wood), Wood Picket Fence, Wood Slatted Fence, Wood Ranch Fence, P Office Desk, P 711 Shelf 1, P 711 Shelf 2, P 711 Shelf 3, P Restaurant Table, P Bar Table, P Bedroom Floor, P Livingroom Floor, P corridor Floor, P Skanky Floor, Door, Stairs (carpet)</td>
116+
</tr>
117+
<tr>
118+
<td>Gravel, Dirt, Stone, Misc</td>
119+
<td><audio controls><source src={await getAssetAudioPath("Surface-sounds/Surface_gravel.mp3")} type="audio/mpeg"></audio></td>
120+
<td>Gravel, P Rubble, P Junkyard Piles, Mud (dry), Dirt, Dirt Track, P Junkyard Ground, P Dump, P Mountain, Rail Track</td>
121+
</tr>
122+
<tr>
123+
<td>Grass, Dirt, Sand, Vegetation, Misc</td>
124+
<td><audio controls><source src={await getAssetAudioPath("Surface-sounds/Surface_grass.mp3")} type="audio/mpeg"></audio></td>
125+
<td>Grass (short, lush), Grass (medium, lush), Grass (long, lush), Grass (short, dry), Grass (medium, dry), Grass (long, dry), Golf Grass (rough), Golf Grass (smooth), Steep Slidy Grass, Meadow, P Grass (short), P Grass (meadow), P Grass (dry), P Grass (wee flowers), P Grass (dry, tall), P Grass (lush, tall), P Grass (green, mix) P Grass (brown, mix), P Grass (low), P Grass (rocky), P Grass (small tress), P Grass (weeds), P Grass (light), P Grass (lighter), P Grass (lighter 2), P Grass (mid 1), P Grass (mid 2), P Grass (dark), P Grass (dark 2), P Grass (dirt, mix), Park Grass, Flower Bed, Corn Field, P Flowerbed, P Marsh, P Sparse Flowers, P Cornfield, P Cactus Dense, P Seaweed, Vegetation, Hedge, P Bushy, P Bushy (mix), P Bushy (dry), P Bushy (mid), Hay Bale</td>
126+
</tr>
127+
<tr>
128+
<td>Dirt, Sand, Stone, Water</td>
129+
<td><audio controls><source src={await getAssetAudioPath("Surface-sounds/Surface_water.mp3")} type="audio/mpeg"></audio></td>
130+
<td>P Riverbed, P Riverbed (shallow), P Riverbed (weeds), P Underwater (lush), P Underwater (barren), P Underwater (coral), P Underwater (deep), P Riverbed (stone), Water (riverbed), Water (shallow)</td>
131+
</tr>
132+
<tr>
133+
<td>Glass, Misc</td>
134+
<td><audio controls><source src={await getAssetAudioPath("Surface-sounds/Surface_glass.mp3")} type="audio/mpeg"></audio></td>
135+
<td>Glass, Glass Windows (large), Glass Windows (small), Unbreakable Glass, P Kitchen Floor, P 711 Floor, P Fast Food Floor</td>
136+
</tr>
137+
<tr>
138+
<td>Metal, Misc</td>
139+
<td><audio controls><source src={await getAssetAudioPath("Surface-sounds/Surface_metal.mp3")} type="audio/mpeg"></audio></td>
140+
<td>Garage Door, Thick Metal Plate, Scaffold Pole, Lamp Post, Metal Gate, Metal Chain Fence, Girder, Fire Hydrant, Container, News Vendor, Car, Car (panel), Car (moving component), Stairs (metal), Floor (metal), Thin Metal Sheet, Metal Barrel, Metal Dumpster, Wheelbase</td>
141+
</tr>
142+
</tbody>
143+
</table>
144+
87145
<section data-pagefind-ignore>
88-
<h4>All materials in a Lua table:</h4>
146+
<h2>All materials in a Lua table:</h2>
147+
<hr/><br/>
89148
<Code lang="lua" code={luaTable} />
90149
</section>
91150

92151
<SeeAlsoSection
93152
seeAlsoLinks={getSeeAlsoLinksFromList(["reference:ID_Lists"])}
94153
currentId=""
95154
/>
96-
</StarlightPage>
155+
</AutoStarlightPage>

web/src/utils/general.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ export function getAssetImagePath(imageFilename: string): any {
1616
}
1717
}
1818

19+
const audioFromAssets = import.meta.glob<{ default: ImageMetadata }>('/src/assets/audio/**/*.{mp3,ogg,wav}');
20+
export async function getAssetAudioPath(audioFilename: string) {
21+
const audioPath = `/src/assets/audio/${audioFilename}`;
22+
if (audioFromAssets[audioPath]) {
23+
const mod = await audioFromAssets[audioPath]();
24+
return mod.default;
25+
} else {
26+
throw new Error(`Audio not found: ${audioFilename}`);
27+
}
28+
}
29+
1930
export function renderInlineMarkdown(markdown: string): string | Promise<string> {
2031
const html = marked.parseInline(markdown);
2132
return html;

0 commit comments

Comments
 (0)