@adatechnology/game-terrain-three 0.5.8 → 0.6.0
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-6YHNPX3W.js → chunk-TZVPP2GT.js} +6 -6
- package/dist/chunk-TZVPP2GT.js.map +1 -0
- package/dist/index.global.js +5 -5
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-6YHNPX3W.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/testing.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GroundLayout, TestableModule } from '@adatechnology/game-contracts';
|
|
2
2
|
|
|
3
|
-
/** The lots of the area, side by side in two rows, one of each ground:
|
|
4
|
-
declare const TERRAIN_STRIPS: readonly ["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"];
|
|
3
|
+
/** The lots of the area, side by side in two rows, one of each ground: the soft and wet ones in the back row, rock and the built ones in front. */
|
|
4
|
+
declare const TERRAIN_STRIPS: readonly ["lawn", "dirt", "sand", "mud", "dry_clay", "gravel_bed", "snow", "shallow_water", "pond", "bedrock", "road", "cobblestone", "paver_floor", "stone_paving", "concrete_slab", "suspended_slab", "tile_floor", "wood_floor"];
|
|
5
5
|
/** A lot of each ground, with its sign. A host lays it to give a room every ground to try (`createTestRoom`'s `ground`). */
|
|
6
6
|
declare function terrainLotsGround(locale?: string): GroundLayout;
|
|
7
7
|
declare const TERRAIN_AREA_GROUND: GroundLayout;
|
package/dist/testing.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adatechnology/game-terrain-three",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "three.js renderer for @adatechnology/game-terrain: chunked ground with a material pattern per surface, simplified far away, the marks as instanced decals, rebar where a slab is dug past its cover, and the clods.",
|
|
6
6
|
"keywords": [
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@adatechnology/game-contracts": "^0.34.0",
|
|
45
|
-
"@adatechnology/game-terrain": "^0.
|
|
45
|
+
"@adatechnology/game-terrain": "^0.8.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"three": "^0.160.0"
|
|
@@ -1 +0,0 @@
|
|
|
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: 'Bloquete', shallow_water: 'Água rasa', bedrock: 'Rocha' },\n },\n}\n\nexport const locale = (id: string): TerrainText => LOCALES[id] ?? LOCALES.en!\n"],"mappings":";AACA,SAAS,qBAAqB;;;ACE9B,IAAM,gBAAwD;AAAA,EAC5D,IAAI,EAAE,MAAM,QAAQ,MAAM,QAAQ,MAAM,QAAQ,MAAM,gBAAgB,eAAe,iBAAiB,gBAAgB,oBAAoB,YAAY,cAAc,YAAY,cAAc,cAAc,gBAAgB,KAAK,OAAO,YAAY,UAAU,UAAU,YAAY,MAAM,QAAQ,aAAa,gBAAgB,aAAa,mBAAmB,eAAe,iBAAiB,SAAS,YAAY;AAAA,EACpZ,SAAS,EAAE,MAAM,SAAS,MAAM,SAAS,MAAM,SAAS,MAAM,WAAW,eAAe,oBAAoB,gBAAgB,qBAAkB,YAAY,oBAAiB,YAAY,YAAY,cAAc,0BAAuB,KAAK,QAAQ,YAAY,YAAY,UAAU,cAAc,MAAM,QAAQ,aAAa,qBAAkB,aAAa,YAAY,eAAe,gBAAa,SAAS,QAAQ;AAC1Z;AAGO,SAAS,mBAAmB,WAAmB,UAA0B;AAC9E,UAAQ,cAAc,QAAQ,KAAK,cAAc,IAAK,SAAS,KAAK;AACtE;AASA,IAAM,UAAuC;AAAA,EAC3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