@adatechnology/game-terrain-three 0.4.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-B5EA72GU.js → chunk-6YHNPX3W.js} +8 -8
- package/dist/chunk-6YHNPX3W.js.map +1 -0
- package/dist/index.global.js +26 -17
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +19 -10
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-B5EA72GU.js.map +0 -1
|
@@ -3,8 +3,8 @@ import { markKitOrigin } from "@adatechnology/game-contracts";
|
|
|
3
3
|
|
|
4
4
|
// src/test-area/locale.ts
|
|
5
5
|
var PROFILE_NAMES = {
|
|
6
|
-
en: { lawn: "Lawn", dirt: "Dirt", sand: "Sand", road: "Asphalt road", concrete_slab: "Concrete slab", suspended_slab: "Slab over a void", tile_floor: "Tile floor", wood_floor: "Wood floor", stone_paving: "Stone paving" },
|
|
7
|
-
"pt-BR": { lawn: "Grama", dirt: "Terra", sand: "Areia", road: "Asfalto", concrete_slab: "Laje de concreto", suspended_slab: "Laje sobre v\xE3o", tile_floor: "Piso cer\xE2mico", wood_floor: "Assoalho", stone_paving: "Cal\xE7amento de pedra" }
|
|
6
|
+
en: { lawn: "Lawn", dirt: "Dirt", sand: "Sand", road: "Asphalt road", concrete_slab: "Concrete slab", suspended_slab: "Slab over a void", tile_floor: "Tile floor", wood_floor: "Wood floor", stone_paving: "Stone paving", mud: "Mud", gravel_bed: "Gravel", dry_clay: "Dry clay", snow: "Snow", cobblestone: "Cobblestones", paver_floor: "Concrete pavers", shallow_water: "Shallow water", bedrock: "Bare rock" },
|
|
7
|
+
"pt-BR": { lawn: "Grama", dirt: "Terra", sand: "Areia", road: "Asfalto", concrete_slab: "Laje de concreto", suspended_slab: "Laje sobre v\xE3o", tile_floor: "Piso cer\xE2mico", wood_floor: "Assoalho", stone_paving: "Cal\xE7amento de pedra", mud: "Lama", gravel_bed: "Cascalho", dry_clay: "Barro seco", snow: "Neve", cobblestone: "Paralelep\xEDpedo", paver_floor: "Bloquete", shallow_water: "\xC1gua rasa", bedrock: "Rocha" }
|
|
8
8
|
};
|
|
9
9
|
function terrainProfileName(profileId, localeId) {
|
|
10
10
|
return (PROFILE_NAMES[localeId] ?? PROFILE_NAMES.en)[profileId] ?? profileId;
|
|
@@ -14,22 +14,22 @@ var LOCALES = {
|
|
|
14
14
|
name: "Terrain",
|
|
15
15
|
group: "Terrain",
|
|
16
16
|
weight: "Concrete block (60 kg)",
|
|
17
|
-
surfaces: { dirt: "Dirt", lawn: "Lawn", sand: "Sand", road: "Asphalt", concrete_slab: "Concrete slab", suspended_slab: "Slab over a void", wood_floor: "Wood floor", tile_floor: "Tile", stone_paving: "Stone paving", mud: "Mud", gravel_bed: "Gravel", dry_clay: "Dry clay", snow: "Snow", cobblestone: "Cobblestones", paver_floor: "Concrete pavers", shallow_water: "Shallow water" }
|
|
17
|
+
surfaces: { dirt: "Dirt", lawn: "Lawn", sand: "Sand", road: "Asphalt", concrete_slab: "Concrete slab", suspended_slab: "Slab over a void", wood_floor: "Wood floor", tile_floor: "Tile", stone_paving: "Stone paving", mud: "Mud", gravel_bed: "Gravel", dry_clay: "Dry clay", snow: "Snow", cobblestone: "Cobblestones", paver_floor: "Concrete pavers", shallow_water: "Shallow water", bedrock: "Bare rock" }
|
|
18
18
|
},
|
|
19
19
|
"pt-BR": {
|
|
20
20
|
name: "Terreno",
|
|
21
21
|
group: "Terreno",
|
|
22
22
|
weight: "Bloco de concreto (60 kg)",
|
|
23
|
-
surfaces: { dirt: "Terra", lawn: "Grama", sand: "Areia", road: "Asfalto", concrete_slab: "Laje de concreto", suspended_slab: "Laje sobre v\xE3o", wood_floor: "Assoalho", tile_floor: "Cer\xE2mica", stone_paving: "Pedra", mud: "Lama", gravel_bed: "Cascalho", dry_clay: "Barro seco", snow: "Neve", cobblestone: "Paralelep\xEDpedo", paver_floor: "Bloquete", shallow_water: "\xC1gua rasa" }
|
|
23
|
+
surfaces: { dirt: "Terra", lawn: "Grama", sand: "Areia", road: "Asfalto", concrete_slab: "Laje de concreto", suspended_slab: "Laje sobre v\xE3o", wood_floor: "Assoalho", tile_floor: "Cer\xE2mica", stone_paving: "Pedra", mud: "Lama", gravel_bed: "Cascalho", dry_clay: "Barro seco", snow: "Neve", cobblestone: "Paralelep\xEDpedo", paver_floor: "Bloquete", shallow_water: "\xC1gua rasa", bedrock: "Rocha" }
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
var locale = (id) => LOCALES[id] ?? LOCALES.en;
|
|
27
27
|
|
|
28
28
|
// src/test-area/test-module.ts
|
|
29
|
-
var TERRAIN_STRIPS = ["lawn", "dirt", "sand", "mud", "dry_clay", "gravel_bed", "snow", "shallow_water", "road", "cobblestone", "paver_floor", "stone_paving", "concrete_slab", "suspended_slab", "tile_floor", "wood_floor"];
|
|
30
|
-
var LOT_WIDTH = 3
|
|
29
|
+
var TERRAIN_STRIPS = ["lawn", "dirt", "sand", "mud", "dry_clay", "gravel_bed", "snow", "shallow_water", "bedrock", "road", "cobblestone", "paver_floor", "stone_paving", "concrete_slab", "suspended_slab", "tile_floor", "wood_floor"];
|
|
30
|
+
var LOT_WIDTH = 3;
|
|
31
31
|
var LOT_DEPTH = 3.8;
|
|
32
|
-
var LOTS_PER_ROW =
|
|
32
|
+
var LOTS_PER_ROW = 9;
|
|
33
33
|
var LOTS_Z1 = -1.4;
|
|
34
34
|
var lotRect = (index) => {
|
|
35
35
|
const row = Math.floor(index / LOTS_PER_ROW);
|
|
@@ -85,4 +85,4 @@ export {
|
|
|
85
85
|
TERRAIN_AREA_GROUND,
|
|
86
86
|
createTerrainTestModule
|
|
87
87
|
};
|
|
88
|
-
//# sourceMappingURL=chunk-
|
|
88
|
+
//# sourceMappingURL=chunk-6YHNPX3W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/test-area/test-module.ts","../src/test-area/locale.ts"],"sourcesContent":["import type * as THREE_NS from 'three'\nimport { markKitOrigin } from '@adatechnology/game-contracts'\nimport type { DestructibleSpec, GroundLayout, ModuleArea, TestableItem, TestableModule } from '@adatechnology/game-contracts'\nimport { locale as localeTable } from './locale'\n\ntype ThreeLib = typeof THREE_NS\n\n/** The lots of the area, side by side in two rows, one of each ground: natural ones in the back row, built ones in front. */\nexport const TERRAIN_STRIPS = ['lawn', 'dirt', 'sand', 'mud', 'dry_clay', 'gravel_bed', 'snow', 'shallow_water', 'bedrock', 'road', 'cobblestone', 'paver_floor', 'stone_paving', 'concrete_slab', 'suspended_slab', 'tile_floor', 'wood_floor'] as const\nconst LOT_WIDTH = 3\nconst LOT_DEPTH = 3.8\nconst LOTS_PER_ROW = 9\n/** Between the target wall and the table of the room: what the player sees on arriving, and clear of the furniture. */\nconst LOTS_Z1 = -1.4\nconst lotRect = (index: number): readonly [number, number, number, number] => {\n const row = Math.floor(index / LOTS_PER_ROW)\n const x0 = ((index % LOTS_PER_ROW) - LOTS_PER_ROW / 2) * LOT_WIDTH\n // the first row is the far one\n const z1 = LOTS_Z1 - (1 - row) * LOT_DEPTH\n return [x0, z1 - LOT_DEPTH, x0 + LOT_WIDTH, z1]\n}\n\n/** A lot of each ground, with its sign. A host lays it to give a room every ground to try (`createTestRoom`'s `ground`). */\nexport function terrainLotsGround(locale = 'en'): GroundLayout {\n const text = localeTable(locale)\n return { surface: 'concrete_slab', zones: TERRAIN_STRIPS.map((surface, index) => ({ rect: lotRect(index), surface, label: text.surfaces[surface] })) }\n}\nexport const TERRAIN_AREA_GROUND: GroundLayout = terrainLotsGround()\n\nconst WEIGHT_SIDE = 0.32\nconst WEIGHT_HEIGHT = 4\n\nfunction weightSpec(): DestructibleSpec {\n return { name: 'Weight', parts: [{ id: 'block', material: 'concrete', shape: { kind: 'box', size: [WEIGHT_SIDE, WEIGHT_SIDE, WEIGHT_SIDE] }, position: [0, WEIGHT_SIDE / 2, 0] }], joints: [] }\n}\n\nfunction buildWeight(THREE: ThreeLib): THREE_NS.Object3D {\n const mesh = new THREE.Mesh(new THREE.BoxGeometry(WEIGHT_SIDE, WEIGHT_SIDE, WEIGHT_SIDE), new THREE.MeshStandardMaterial({ color: 0xb4b4ae, roughness: 0.9 }))\n mesh.name = 'block'\n mesh.position.y = WEIGHT_SIDE / 2\n mesh.castShadow = true\n const root = markKitOrigin(new THREE.Group(), { owner: 'game-terrain-three', kind: 'item' })\n root.add(mesh)\n return root\n}\n\n/**\n * The ground bench: a lot of each surface side by side to shoot, blow up, burn and drop weights on. Opening the area lays the lots with their signs (`ground`) and drops a concrete block\n * on each from four metres.\n */\nexport function createTerrainTestModule(options: { readonly locale?: string } = {}): TestableModule {\n const text = localeTable(options.locale ?? 'en')\n return {\n id: 'terrain',\n name: text.name,\n group: text.group,\n ground: terrainLotsGround(options.locale ?? 'en'),\n items(): TestableItem[] {\n return [{ id: 'terrain_weight', name: text.weight, build: (THREE) => buildWeight(THREE as ThreeLib), spec: weightSpec, movable: true }]\n },\n area(): ModuleArea {\n return {\n placements: TERRAIN_STRIPS.map((_, index) => {\n const [x0, z0] = lotRect(index)\n return { item: 'terrain_weight', position: [x0 + LOT_WIDTH / 2, WEIGHT_HEIGHT, z0 + 1.2] }\n }),\n view: { eye: [0, 1.7, 1.5], target: [0, 0, -6] },\n }\n },\n }\n}\n","import type { TERRAIN_STRIPS } from './test-module'\n\n/** The ground profiles of the catalogue (`TERRAIN_PROFILES` of game-terrain) by name, for a HUD that says what the floor under the aim is. */\nconst PROFILE_NAMES: Record<string, Record<string, string>> = {\n en: { lawn: 'Lawn', dirt: 'Dirt', sand: 'Sand', road: 'Asphalt road', concrete_slab: 'Concrete slab', suspended_slab: 'Slab over a void', tile_floor: 'Tile floor', wood_floor: 'Wood floor', stone_paving: 'Stone paving', mud: 'Mud', gravel_bed: 'Gravel', dry_clay: 'Dry clay', snow: 'Snow', cobblestone: 'Cobblestones', paver_floor: 'Concrete pavers', shallow_water: 'Shallow water', bedrock: 'Bare rock' },\n 'pt-BR': { lawn: 'Grama', dirt: 'Terra', sand: 'Areia', road: 'Asfalto', concrete_slab: 'Laje de concreto', suspended_slab: 'Laje sobre vão', tile_floor: 'Piso cerâmico', wood_floor: 'Assoalho', stone_paving: 'Calçamento de pedra', mud: 'Lama', gravel_bed: 'Cascalho', dry_clay: 'Barro seco', snow: 'Neve', cobblestone: 'Paralelepípedo', paver_floor: 'Bloquete', shallow_water: 'Água rasa', bedrock: 'Rocha' },\n}\n\n/** The name of a ground profile in the locale (`en` when the locale is unknown); a profile a game added without a name answers its id. */\nexport function terrainProfileName(profileId: string, localeId: string): string {\n return (PROFILE_NAMES[localeId] ?? PROFILE_NAMES.en!)[profileId] ?? profileId\n}\n\ninterface TerrainText {\n readonly name: string\n readonly group: string\n readonly weight: string\n readonly surfaces: Record<(typeof TERRAIN_STRIPS)[number], string>\n}\n\nconst LOCALES: Record<string, TerrainText> = {\n en: {\n name: 'Terrain',\n group: 'Terrain',\n weight: 'Concrete block (60 kg)',\n surfaces: { dirt: 'Dirt', lawn: 'Lawn', sand: 'Sand', road: 'Asphalt', concrete_slab: 'Concrete slab', suspended_slab: 'Slab over a void', wood_floor: 'Wood floor', tile_floor: 'Tile', stone_paving: 'Stone paving', mud: 'Mud', gravel_bed: 'Gravel', dry_clay: 'Dry clay', snow: 'Snow', cobblestone: 'Cobblestones', paver_floor: 'Concrete pavers', shallow_water: 'Shallow water', bedrock: 'Bare rock' },\n },\n 'pt-BR': {\n name: 'Terreno',\n group: 'Terreno',\n weight: 'Bloco de concreto (60 kg)',\n surfaces: { dirt: 'Terra', lawn: 'Grama', sand: 'Areia', road: 'Asfalto', concrete_slab: 'Laje de concreto', suspended_slab: 'Laje sobre vão', wood_floor: 'Assoalho', tile_floor: 'Cerâmica', stone_paving: 'Pedra', mud: 'Lama', gravel_bed: 'Cascalho', dry_clay: 'Barro seco', snow: 'Neve', cobblestone: 'Paralelepípedo', paver_floor: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
134
|
-
var TERRAIN_PATTERNS = ["plain", "grass", "soil", "sand", "asphalt", "concrete", "tile", "planks", "stone", "mud", "gravel", "clay", "snow", "cobble", "paver"];
|
|
134
|
+
var TERRAIN_PATTERNS = ["plain", "grass", "soil", "sand", "asphalt", "concrete", "tile", "planks", "stone", "mud", "gravel", "clay", "snow", "cobble", "paver", "rock"];
|
|
135
135
|
|
|
136
136
|
// src/surface-material.ts
|
|
137
137
|
var patternIndex = (pattern) => Math.max(0, TERRAIN_PATTERNS.indexOf(pattern ?? "plain"));
|
|
@@ -212,11 +212,18 @@ vec3 terrainSurface(vec3 base, vec2 xz, float kind) {
|
|
|
212
212
|
float seam = max(tsLine(xz.y, 0.2, 0.014), tsLine(along, 0.3, 0.014));
|
|
213
213
|
return base * (0.72 + 0.6 * tsHash(cell)) * (0.82 + 0.36 * tsFbm(xz * 22.0)) * (1.0 - 0.8 * seam);
|
|
214
214
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
215
|
+
if (k < 14.5) {
|
|
216
|
+
float row = floor(xz.y / 0.2);
|
|
217
|
+
float along = xz.x - mod(abs(row), 2.0) * 0.1;
|
|
218
|
+
vec2 cell = vec2(floor(along / 0.2), row);
|
|
219
|
+
float seam = max(tsLine(xz.y, 0.2, 0.008), tsLine(along, 0.2, 0.008));
|
|
220
|
+
return base * (0.86 + 0.26 * tsHash(cell)) * (0.92 + 0.16 * tsNoise(xz * 70.0)) * (1.0 - 0.7 * seam);
|
|
221
|
+
}
|
|
222
|
+
// bare rock: weathered blotches, lichen-dark patches and a few long joints, no grid
|
|
223
|
+
float blotch = tsFbm(xz * 0.9) * 0.6 + tsFbm(xz * 4.0 + 2.0) * 0.4;
|
|
224
|
+
float joint = 1.0 - smoothstep(0.0, 0.035, abs(tsNoise(xz * vec2(0.7, 1.9)) - 0.5));
|
|
225
|
+
float grain = tsNoise(xz * 95.0);
|
|
226
|
+
return base * (0.62 + 0.75 * blotch) * (0.88 + 0.24 * grain) * (1.0 - 0.6 * joint);
|
|
220
227
|
}
|
|
221
228
|
`
|
|
222
229
|
);
|
|
@@ -247,9 +254,9 @@ ${SURFACE_GLSL}`).replace("#include <color_fragment>", "#include <color_fragment
|
|
|
247
254
|
const index = row * terrain.stride + column;
|
|
248
255
|
let material = terrain.vertexMaterial(column, row);
|
|
249
256
|
if (terrain.loose[index] > LOOSE_VISIBLE) {
|
|
250
|
-
const
|
|
251
|
-
const first =
|
|
252
|
-
material = terrain.material(first.thickness < THIN_SKIN &&
|
|
257
|
+
const profile2 = terrain.profileList[terrain.profileIndex[index]];
|
|
258
|
+
const first = profile2.strata[0];
|
|
259
|
+
material = terrain.material(first.thickness < THIN_SKIN && profile2.strata[1] ? profile2.strata[1].material : first.material);
|
|
253
260
|
}
|
|
254
261
|
const broken = material.pattern === "concrete" && terrain.dug[index] > BROKEN_DEPTH;
|
|
255
262
|
const tone = broken ? BROKEN_TONE : 1;
|
|
@@ -258,7 +265,9 @@ ${SURFACE_GLSL}`).replace("#include <color_fragment>", "#include <color_fragment
|
|
|
258
265
|
base[2] = material.color[2] * tone;
|
|
259
266
|
shade[0] = Math.max(MIN_DEPTH_LIGHT, 1 - terrain.dug[index] / DEPTH_SHADE);
|
|
260
267
|
shade[1] = terrain.scorch[index];
|
|
261
|
-
|
|
268
|
+
const profile = terrain.profileList[terrain.profileIndex[index]];
|
|
269
|
+
const untouched = profile.surfacePattern !== void 0 && terrain.dug[index] <= BROKEN_DEPTH && terrain.loose[index] <= LOOSE_VISIBLE;
|
|
270
|
+
return patternIndex(broken ? "soil" : untouched ? profile.surfacePattern : material.pattern);
|
|
262
271
|
}
|
|
263
272
|
function chunkVertexCount(terrain, chunk, step) {
|
|
264
273
|
const lastColumn = Math.min(terrain.columns, chunk.column + chunk.cells);
|
|
@@ -1150,8 +1159,8 @@ ${SURFACE_GLSL}`).replace("#include <color_fragment>", "#include <color_fragment
|
|
|
1150
1159
|
|
|
1151
1160
|
// src/test-area/locale.ts
|
|
1152
1161
|
var PROFILE_NAMES = {
|
|
1153
|
-
en: { lawn: "Lawn", dirt: "Dirt", sand: "Sand", road: "Asphalt road", concrete_slab: "Concrete slab", suspended_slab: "Slab over a void", tile_floor: "Tile floor", wood_floor: "Wood floor", stone_paving: "Stone paving" },
|
|
1154
|
-
"pt-BR": { lawn: "Grama", dirt: "Terra", sand: "Areia", road: "Asfalto", concrete_slab: "Laje de concreto", suspended_slab: "Laje sobre v\xE3o", tile_floor: "Piso cer\xE2mico", wood_floor: "Assoalho", stone_paving: "Cal\xE7amento de pedra" }
|
|
1162
|
+
en: { lawn: "Lawn", dirt: "Dirt", sand: "Sand", road: "Asphalt road", concrete_slab: "Concrete slab", suspended_slab: "Slab over a void", tile_floor: "Tile floor", wood_floor: "Wood floor", stone_paving: "Stone paving", mud: "Mud", gravel_bed: "Gravel", dry_clay: "Dry clay", snow: "Snow", cobblestone: "Cobblestones", paver_floor: "Concrete pavers", shallow_water: "Shallow water", bedrock: "Bare rock" },
|
|
1163
|
+
"pt-BR": { lawn: "Grama", dirt: "Terra", sand: "Areia", road: "Asfalto", concrete_slab: "Laje de concreto", suspended_slab: "Laje sobre v\xE3o", tile_floor: "Piso cer\xE2mico", wood_floor: "Assoalho", stone_paving: "Cal\xE7amento de pedra", mud: "Lama", gravel_bed: "Cascalho", dry_clay: "Barro seco", snow: "Neve", cobblestone: "Paralelep\xEDpedo", paver_floor: "Bloquete", shallow_water: "\xC1gua rasa", bedrock: "Rocha" }
|
|
1155
1164
|
};
|
|
1156
1165
|
function terrainProfileName(profileId, localeId) {
|
|
1157
1166
|
return (PROFILE_NAMES[localeId] ?? PROFILE_NAMES.en)[profileId] ?? profileId;
|
|
@@ -1161,22 +1170,22 @@ ${SURFACE_GLSL}`).replace("#include <color_fragment>", "#include <color_fragment
|
|
|
1161
1170
|
name: "Terrain",
|
|
1162
1171
|
group: "Terrain",
|
|
1163
1172
|
weight: "Concrete block (60 kg)",
|
|
1164
|
-
surfaces: { dirt: "Dirt", lawn: "Lawn", sand: "Sand", road: "Asphalt", concrete_slab: "Concrete slab", suspended_slab: "Slab over a void", wood_floor: "Wood floor", tile_floor: "Tile", stone_paving: "Stone paving", mud: "Mud", gravel_bed: "Gravel", dry_clay: "Dry clay", snow: "Snow", cobblestone: "Cobblestones", paver_floor: "Concrete pavers", shallow_water: "Shallow water" }
|
|
1173
|
+
surfaces: { dirt: "Dirt", lawn: "Lawn", sand: "Sand", road: "Asphalt", concrete_slab: "Concrete slab", suspended_slab: "Slab over a void", wood_floor: "Wood floor", tile_floor: "Tile", stone_paving: "Stone paving", mud: "Mud", gravel_bed: "Gravel", dry_clay: "Dry clay", snow: "Snow", cobblestone: "Cobblestones", paver_floor: "Concrete pavers", shallow_water: "Shallow water", bedrock: "Bare rock" }
|
|
1165
1174
|
},
|
|
1166
1175
|
"pt-BR": {
|
|
1167
1176
|
name: "Terreno",
|
|
1168
1177
|
group: "Terreno",
|
|
1169
1178
|
weight: "Bloco de concreto (60 kg)",
|
|
1170
|
-
surfaces: { dirt: "Terra", lawn: "Grama", sand: "Areia", road: "Asfalto", concrete_slab: "Laje de concreto", suspended_slab: "Laje sobre v\xE3o", wood_floor: "Assoalho", tile_floor: "Cer\xE2mica", stone_paving: "Pedra", mud: "Lama", gravel_bed: "Cascalho", dry_clay: "Barro seco", snow: "Neve", cobblestone: "Paralelep\xEDpedo", paver_floor: "Bloquete", shallow_water: "\xC1gua rasa" }
|
|
1179
|
+
surfaces: { dirt: "Terra", lawn: "Grama", sand: "Areia", road: "Asfalto", concrete_slab: "Laje de concreto", suspended_slab: "Laje sobre v\xE3o", wood_floor: "Assoalho", tile_floor: "Cer\xE2mica", stone_paving: "Pedra", mud: "Lama", gravel_bed: "Cascalho", dry_clay: "Barro seco", snow: "Neve", cobblestone: "Paralelep\xEDpedo", paver_floor: "Bloquete", shallow_water: "\xC1gua rasa", bedrock: "Rocha" }
|
|
1171
1180
|
}
|
|
1172
1181
|
};
|
|
1173
1182
|
var locale = (id) => LOCALES[id] ?? LOCALES.en;
|
|
1174
1183
|
|
|
1175
1184
|
// src/test-area/test-module.ts
|
|
1176
|
-
var TERRAIN_STRIPS = ["lawn", "dirt", "sand", "mud", "dry_clay", "gravel_bed", "snow", "shallow_water", "road", "cobblestone", "paver_floor", "stone_paving", "concrete_slab", "suspended_slab", "tile_floor", "wood_floor"];
|
|
1177
|
-
var LOT_WIDTH = 3
|
|
1185
|
+
var TERRAIN_STRIPS = ["lawn", "dirt", "sand", "mud", "dry_clay", "gravel_bed", "snow", "shallow_water", "bedrock", "road", "cobblestone", "paver_floor", "stone_paving", "concrete_slab", "suspended_slab", "tile_floor", "wood_floor"];
|
|
1186
|
+
var LOT_WIDTH = 3;
|
|
1178
1187
|
var LOT_DEPTH = 3.8;
|
|
1179
|
-
var LOTS_PER_ROW =
|
|
1188
|
+
var LOTS_PER_ROW = 9;
|
|
1180
1189
|
var LOTS_Z1 = -1.4;
|
|
1181
1190
|
var lotRect = (index) => {
|
|
1182
1191
|
const row = Math.floor(index / LOTS_PER_ROW);
|