@kuncat/avoidant 0.1.5 → 0.2.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/README.md +26 -0
- package/dist/components/AvoidantGame.svelte +240 -148
- package/dist/components/IdleBillboard.svelte +27 -0
- package/dist/components/IdleBillboard.svelte.d.ts +8 -0
- package/dist/components/MapControls.svelte +158 -0
- package/dist/components/MapControls.svelte.d.ts +7 -0
- package/dist/components/board.svelte +241 -100
- package/dist/components/board.svelte.d.ts +3 -0
- package/dist/components/fragment.glsl +29 -19
- package/dist/components/map-camera.d.ts +10 -0
- package/dist/components/map-camera.js +73 -0
- package/dist/components/terrain-depth-sort.d.ts +17 -0
- package/dist/components/terrain-depth-sort.js +63 -0
- package/dist/components/vertex.glsl +12 -7
- package/dist/generated/shared-constants.d.ts +0 -3
- package/dist/generated/shared-constants.js +0 -3
- package/dist/paraglide/messages/_index.d.ts +14 -0
- package/dist/paraglide/messages/_index.js +15 -1
- package/dist/paraglide/messages/cells_per_face.d.ts +18 -0
- package/dist/paraglide/messages/cells_per_face.js +29 -0
- package/dist/paraglide/messages/faces_count.d.ts +18 -0
- package/dist/paraglide/messages/faces_count.js +29 -0
- package/dist/paraglide/messages/field_cell_density.d.ts +16 -0
- package/dist/paraglide/messages/field_cell_density.js +29 -0
- package/dist/paraglide/messages/field_map_shape.d.ts +16 -0
- package/dist/paraglide/messages/field_map_shape.js +29 -0
- package/dist/paraglide/messages/field_radius.d.ts +16 -0
- package/dist/paraglide/messages/field_radius.js +29 -0
- package/dist/paraglide/messages/field_radius_x.d.ts +16 -0
- package/dist/paraglide/messages/field_radius_x.js +29 -0
- package/dist/paraglide/messages/field_radius_y.d.ts +16 -0
- package/dist/paraglide/messages/field_radius_y.js +29 -0
- package/dist/paraglide/messages/field_radius_z.d.ts +16 -0
- package/dist/paraglide/messages/field_radius_z.js +29 -0
- package/dist/paraglide/messages/field_spikiness.d.ts +16 -0
- package/dist/paraglide/messages/field_spikiness.js +29 -0
- package/dist/paraglide/messages/field_subdivisions.d.ts +16 -0
- package/dist/paraglide/messages/field_subdivisions.js +29 -0
- package/dist/paraglide/messages/field_surface_detail.d.ts +16 -0
- package/dist/paraglide/messages/field_surface_detail.js +29 -0
- package/dist/paraglide/messages/shape_label.d.ts +26 -0
- package/dist/paraglide/messages/shape_label.js +55 -0
- package/dist/paraglide/messages/text_density_summary.d.ts +19 -0
- package/dist/paraglide/messages/text_density_summary.js +29 -0
- package/dist/paraglide/messages/text_invite_after_opening.d.ts +16 -0
- package/dist/paraglide/messages/text_invite_after_opening.js +29 -0
- package/dist/paraglide/messages/tutorial_intro.d.ts +1 -1
- package/dist/paraglide/messages/tutorial_intro.js +3 -3
- package/dist/wasm/avoidant_wasm.d.ts +77 -35
- package/dist/wasm/avoidant_wasm.js +236 -223
- package/dist/wasm/avoidant_wasm_bg.wasm +0 -0
- package/dist/wasm/avoidant_wasm_bg.wasm.d.ts +27 -27
- package/dist/workers/mapgen-client.js +2 -0
- package/dist/workers/mapgen.worker.d.ts +2 -0
- package/dist/workers/mapgen.worker.js +3 -0
- package/package.json +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
varying vec3 vWorldPosition;
|
|
2
|
-
varying vec3 vNormal;
|
|
3
2
|
varying float vHeight;
|
|
3
|
+
varying float vEdgeDistance;
|
|
4
|
+
varying float vRelief;
|
|
4
5
|
varying float vCellIndex;
|
|
5
6
|
varying float vFallProgress;
|
|
6
7
|
|
|
8
|
+
uniform bool uTransparentPass;
|
|
7
9
|
uniform float elevationMin;
|
|
8
10
|
uniform float elevationMax;
|
|
9
11
|
uniform sampler2D uCellMeta;
|
|
@@ -14,14 +16,11 @@ uniform vec3 pulsePositions[MAX_PULSES];
|
|
|
14
16
|
uniform float pulseOriginCells[MAX_PULSES];
|
|
15
17
|
uniform float pulseIsRemote[MAX_PULSES];
|
|
16
18
|
uniform float pulseMaxRadii[MAX_PULSES];
|
|
17
|
-
uniform vec3 uLightDir;
|
|
18
|
-
uniform float uAmbient;
|
|
19
|
-
uniform float uDiffuse;
|
|
20
19
|
uniform float uHighlightedCell;
|
|
21
20
|
uniform float uTime;
|
|
22
21
|
|
|
23
22
|
float remapClamped(float value, float inMin, float inMax, float outMin, float outMax) {
|
|
24
|
-
float t = clamp((value - inMin) / (inMax - inMin), 0.0, 1.0);
|
|
23
|
+
float t = clamp((value - inMin) / max(inMax - inMin, 0.0001), 0.0, 1.0);
|
|
25
24
|
return mix(outMin, outMax, t);
|
|
26
25
|
}
|
|
27
26
|
|
|
@@ -34,6 +33,17 @@ void main() {
|
|
|
34
33
|
// Once an explored void cell has fully fallen, drop every fragment.
|
|
35
34
|
if (isVoid > 0.5 && isExplored > 0.5 && vFallProgress >= 0.999) discard;
|
|
36
35
|
|
|
36
|
+
// Unexplored cells retain slight transparency; revealed solid cells are opaque.
|
|
37
|
+
float alpha = isExplored > 0.5 ? 1.0 : 0.95;
|
|
38
|
+
// Fade alpha while an explored void cell is falling.
|
|
39
|
+
if (isVoid > 0.5 && isExplored > 0.5) {
|
|
40
|
+
alpha = clamp(1.0 - vFallProgress, 0.0, 1.0);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Keep opaque depth separate from blended layers. The two passes must be
|
|
44
|
+
// mutually exclusive so no cell is drawn twice.
|
|
45
|
+
if (uTransparentPass ? alpha >= 1.0 : alpha < 1.0) discard;
|
|
46
|
+
|
|
37
47
|
float elevation = remapClamped(vHeight, elevationMin, elevationMax, 0.0, 1.0);
|
|
38
48
|
|
|
39
49
|
float totalRing = 0.0;
|
|
@@ -48,7 +58,9 @@ void main() {
|
|
|
48
58
|
float maxRadius = pulseMaxRadii[i];
|
|
49
59
|
float ringRadius = pulseProgress * maxRadius;
|
|
50
60
|
float ringWidth = 1.2;
|
|
51
|
-
|
|
61
|
+
// Use full 3D distance — pulses radiate outward over the curved surface
|
|
62
|
+
// of the polyhedron/spheroid, not within an XZ plane.
|
|
63
|
+
float distToOrigin = distance(vWorldPosition, pulsePositions[i]);
|
|
52
64
|
float ringDistance = abs(distToOrigin - ringRadius);
|
|
53
65
|
float ring = (1.0 - smoothstep(ringWidth, ringWidth + 0.8, ringDistance)) * pulseActive;
|
|
54
66
|
float pulseFade = 1.0 - pulseProgress;
|
|
@@ -69,19 +81,16 @@ void main() {
|
|
|
69
81
|
|
|
70
82
|
vec3 unexploredLow = vec3(0.2588, 0.2588, 0.2784);
|
|
71
83
|
vec3 unexploredHigh = vec3(0.4431, 0.451, 0.4706);
|
|
72
|
-
vec3 exploredLow = vec3(0.
|
|
73
|
-
vec3 exploredHigh = vec3(0.
|
|
84
|
+
vec3 exploredLow = vec3(0.43, 0.5, 0.59);
|
|
85
|
+
vec3 exploredHigh = vec3(0.75, 0.79, 0.84);
|
|
74
86
|
|
|
75
87
|
vec3 lowColor = mix(unexploredLow, exploredLow, colorFactor);
|
|
76
88
|
vec3 highColor = mix(unexploredHigh, exploredHigh, colorFactor);
|
|
77
89
|
vec3 terrainColor = mix(lowColor, highColor, elevation);
|
|
78
90
|
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
float ndotl = max(dot(shadingNormal, normalize(uLightDir)), 0.0);
|
|
83
|
-
float shade = clamp(uAmbient + uDiffuse * ndotl, 0.0, 1.5);
|
|
84
|
-
terrainColor *= shade;
|
|
91
|
+
// Uniform illumination keeps every face readable regardless of its
|
|
92
|
+
// orientation, with a subdued level that avoids near-white revealed cells.
|
|
93
|
+
terrainColor *= 0.9 * mix(0.82, 1.0, vRelief);
|
|
85
94
|
|
|
86
95
|
vec3 localPulseTint = vec3(0.55, 0.95, 1.0);
|
|
87
96
|
vec3 remotePulseTint = vec3(1.0, 0.42, 0.38);
|
|
@@ -97,11 +106,12 @@ void main() {
|
|
|
97
106
|
finalColor = mix(finalColor, glowColor, 0.35 + 0.45 * glowPulse);
|
|
98
107
|
}
|
|
99
108
|
|
|
100
|
-
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
// Draw an antialiased perimeter on the surface itself. A pixel-based
|
|
110
|
+
// minimum keeps borders visible when zooming out or viewing at an angle.
|
|
111
|
+
float edgePixel = max(fwidth(vEdgeDistance), 0.0001);
|
|
112
|
+
float borderWidth = max(0.04, 1.1 * edgePixel);
|
|
113
|
+
float border = 1.0 - smoothstep(borderWidth, borderWidth + edgePixel, vEdgeDistance);
|
|
114
|
+
finalColor = mix(finalColor, vec3(0.1, 0.13, 0.18), border * 0.9);
|
|
105
115
|
|
|
106
116
|
gl_FragColor = vec4(clamp(finalColor, 0.0, 1.0), alpha);
|
|
107
117
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PerspectiveCamera, Vector2, Vector3 } from "three";
|
|
2
|
+
/** Rotate the entire camera frame around the map, without Euler-angle pole limits. */
|
|
3
|
+
export declare function orbitMap(camera: PerspectiveCamera, dx: number, dy: number): void;
|
|
4
|
+
/** Dolly along the anchor ray; the anchor keeps the same screen position. */
|
|
5
|
+
export declare function zoomMap(camera: PerspectiveCamera, anchor: Vector3, factor: number, minDistance: number, maxDistance: number, centeredBounds?: boolean): void;
|
|
6
|
+
/** Match rotation to the projected surface size, slowing down as the camera approaches it. */
|
|
7
|
+
export declare function orbitRadiansPerPixel(camera: PerspectiveCamera, radius: number, viewportHeight: number, flat?: boolean): number;
|
|
8
|
+
/** Move the grabbed surface point with the pointer without changing the orbit center. */
|
|
9
|
+
export declare function panMap(camera: PerspectiveCamera, from: Vector2, to: Vector2, anchor: Vector3): void;
|
|
10
|
+
export declare function cameraPlanePoint(camera: PerspectiveCamera, ndc: Vector2, anchor?: Vector3): Vector3 | null;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { PerspectiveCamera, Plane, Quaternion, Raycaster, Vector2, Vector3 } from "three";
|
|
2
|
+
const origin = new Vector3();
|
|
3
|
+
/** Rotate the entire camera frame around the map, without Euler-angle pole limits. */
|
|
4
|
+
export function orbitMap(camera, dx, dy) {
|
|
5
|
+
const axis = new Vector3(dy, dx, 0);
|
|
6
|
+
const angle = axis.length();
|
|
7
|
+
if (!angle)
|
|
8
|
+
return;
|
|
9
|
+
axis.normalize().applyQuaternion(camera.quaternion);
|
|
10
|
+
const rotation = new Quaternion().setFromAxisAngle(axis, -angle);
|
|
11
|
+
camera.position.applyQuaternion(rotation);
|
|
12
|
+
camera.quaternion.premultiply(rotation).normalize();
|
|
13
|
+
camera.up.set(0, 1, 0).applyQuaternion(camera.quaternion);
|
|
14
|
+
camera.updateMatrixWorld();
|
|
15
|
+
}
|
|
16
|
+
/** Dolly along the anchor ray; the anchor keeps the same screen position. */
|
|
17
|
+
export function zoomMap(camera, anchor, factor, minDistance, maxDistance, centeredBounds = true) {
|
|
18
|
+
if (!centeredBounds) {
|
|
19
|
+
// Flat maps can be panned far from the origin; bound zoom relative to the focus.
|
|
20
|
+
const distance = camera.position.distanceTo(anchor);
|
|
21
|
+
if (!distance)
|
|
22
|
+
return;
|
|
23
|
+
factor = Math.max(minDistance / distance, Math.min(maxDistance / distance, factor));
|
|
24
|
+
camera.position.sub(anchor).multiplyScalar(factor).add(anchor);
|
|
25
|
+
camera.updateMatrixWorld();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const next = camera.position.clone().sub(anchor).multiplyScalar(factor).add(anchor);
|
|
29
|
+
// Bound travel along the ray rather than clamping position off the cursor ray.
|
|
30
|
+
const delta = next.clone().sub(camera.position);
|
|
31
|
+
const distance = camera.position.length();
|
|
32
|
+
const limit = factor < 1 ? minDistance : maxDistance;
|
|
33
|
+
if ((factor < 1 && next.length() < limit) || (factor > 1 && next.length() > limit)) {
|
|
34
|
+
const a = delta.lengthSq();
|
|
35
|
+
const b = 2 * camera.position.dot(delta);
|
|
36
|
+
const c = distance * distance - limit * limit;
|
|
37
|
+
const discriminant = b * b - 4 * a * c;
|
|
38
|
+
if (!a || discriminant < 0)
|
|
39
|
+
return;
|
|
40
|
+
const roots = [
|
|
41
|
+
(-b - Math.sqrt(discriminant)) / (2 * a),
|
|
42
|
+
(-b + Math.sqrt(discriminant)) / (2 * a),
|
|
43
|
+
];
|
|
44
|
+
const t = roots.filter((value) => value >= 0 && value <= 1).sort((a, b) => a - b)[0];
|
|
45
|
+
if (t === undefined)
|
|
46
|
+
return;
|
|
47
|
+
next.copy(camera.position).addScaledVector(delta, t);
|
|
48
|
+
}
|
|
49
|
+
camera.position.copy(next);
|
|
50
|
+
camera.updateMatrixWorld();
|
|
51
|
+
}
|
|
52
|
+
/** Match rotation to the projected surface size, slowing down as the camera approaches it. */
|
|
53
|
+
export function orbitRadiansPerPixel(camera, radius, viewportHeight, flat = false) {
|
|
54
|
+
const mapRadius = Math.max(1, radius);
|
|
55
|
+
const surfaceDistance = Math.max(mapRadius * 0.01, camera.position.length() - (flat ? 0 : mapRadius));
|
|
56
|
+
const visibleHeight = 2 * Math.tan((camera.getEffectiveFOV() * Math.PI) / 360) * surfaceDistance;
|
|
57
|
+
// The vertical FOV includes the aspect-ratio adjustment on narrow screens.
|
|
58
|
+
return 2 * Math.min(Math.PI * 2, visibleHeight / mapRadius) / Math.max(1, viewportHeight);
|
|
59
|
+
}
|
|
60
|
+
/** Move the grabbed surface point with the pointer without changing the orbit center. */
|
|
61
|
+
export function panMap(camera, from, to, anchor) {
|
|
62
|
+
const start = cameraPlanePoint(camera, from, anchor);
|
|
63
|
+
const end = cameraPlanePoint(camera, to, anchor);
|
|
64
|
+
if (start && end)
|
|
65
|
+
camera.position.add(start.sub(end));
|
|
66
|
+
camera.updateMatrixWorld();
|
|
67
|
+
}
|
|
68
|
+
export function cameraPlanePoint(camera, ndc, anchor = origin) {
|
|
69
|
+
const raycaster = new Raycaster();
|
|
70
|
+
raycaster.setFromCamera(ndc, camera);
|
|
71
|
+
const plane = new Plane().setFromNormalAndCoplanarPoint(camera.getWorldDirection(new Vector3()), anchor);
|
|
72
|
+
return raycaster.ray.intersectPlane(plane, new Vector3());
|
|
73
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BufferGeometry, Matrix4 } from "three";
|
|
2
|
+
/** Sort individual triangles in a merged surface, including falling cells.
|
|
3
|
+
* Three.js sorts transparent objects, but cannot sort triangles inside a mesh.
|
|
4
|
+
* Only the index buffer changes, preserving all per-vertex cell IDs for picking.
|
|
5
|
+
*/
|
|
6
|
+
export declare class TerrainDepthSort {
|
|
7
|
+
private readonly centers;
|
|
8
|
+
private readonly normals;
|
|
9
|
+
private readonly cells;
|
|
10
|
+
private readonly depths;
|
|
11
|
+
private readonly order;
|
|
12
|
+
private readonly index;
|
|
13
|
+
private readonly previousView;
|
|
14
|
+
private previousRevision;
|
|
15
|
+
constructor(geometry: BufferGeometry);
|
|
16
|
+
update(view: Matrix4, revision: number, fallDistance: (cell: number) => number): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { BufferAttribute, BufferGeometry, Matrix4 } from "three";
|
|
2
|
+
/** Sort individual triangles in a merged surface, including falling cells.
|
|
3
|
+
* Three.js sorts transparent objects, but cannot sort triangles inside a mesh.
|
|
4
|
+
* Only the index buffer changes, preserving all per-vertex cell IDs for picking.
|
|
5
|
+
*/
|
|
6
|
+
export class TerrainDepthSort {
|
|
7
|
+
centers;
|
|
8
|
+
normals;
|
|
9
|
+
cells;
|
|
10
|
+
depths;
|
|
11
|
+
order;
|
|
12
|
+
index;
|
|
13
|
+
previousView = new Matrix4();
|
|
14
|
+
previousRevision = -1;
|
|
15
|
+
constructor(geometry) {
|
|
16
|
+
const positions = geometry.getAttribute("position");
|
|
17
|
+
const normals = geometry.getAttribute("aCellNormal");
|
|
18
|
+
const cells = geometry.getAttribute("aCellIndex");
|
|
19
|
+
const count = positions.count / 3;
|
|
20
|
+
this.centers = new Float64Array(count * 3);
|
|
21
|
+
this.normals = new Float64Array(count * 3);
|
|
22
|
+
this.cells = new Uint32Array(count);
|
|
23
|
+
this.depths = new Float64Array(count);
|
|
24
|
+
this.order = Uint32Array.from({ length: count }, (_, i) => i);
|
|
25
|
+
this.index = new BufferAttribute(Uint32Array.from({ length: positions.count }, (_, i) => i), 1);
|
|
26
|
+
geometry.setIndex(this.index);
|
|
27
|
+
for (let t = 0; t < count; t++) {
|
|
28
|
+
this.cells[t] = cells.getX(t * 3);
|
|
29
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
30
|
+
this.centers[t * 3 + axis] =
|
|
31
|
+
(positions.getComponent(t * 3, axis) +
|
|
32
|
+
positions.getComponent(t * 3 + 1, axis) +
|
|
33
|
+
positions.getComponent(t * 3 + 2, axis)) /
|
|
34
|
+
3;
|
|
35
|
+
this.normals[t * 3 + axis] = normals.getComponent(t * 3, axis);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
update(view, revision, fallDistance) {
|
|
40
|
+
if (revision === this.previousRevision && view.equals(this.previousView))
|
|
41
|
+
return;
|
|
42
|
+
this.previousView.copy(view);
|
|
43
|
+
this.previousRevision = revision;
|
|
44
|
+
const m = view.elements;
|
|
45
|
+
for (let t = 0; t < this.order.length; t++) {
|
|
46
|
+
const offset = t * 3;
|
|
47
|
+
const fall = fallDistance(this.cells[t]);
|
|
48
|
+
const x = this.centers[offset] - this.normals[offset] * fall;
|
|
49
|
+
const y = this.centers[offset + 1] - this.normals[offset + 1] * fall;
|
|
50
|
+
const z = this.centers[offset + 2] - this.normals[offset + 2] * fall;
|
|
51
|
+
// The camera looks along -Z: smaller view-space Z is farther away.
|
|
52
|
+
this.depths[t] = m[2] * x + m[6] * y + m[10] * z + m[14];
|
|
53
|
+
}
|
|
54
|
+
this.order.sort((a, b) => this.depths[a] - this.depths[b] || a - b);
|
|
55
|
+
for (let i = 0; i < this.order.length; i++) {
|
|
56
|
+
const vertex = this.order[i] * 3;
|
|
57
|
+
this.index.setX(i * 3, vertex);
|
|
58
|
+
this.index.setX(i * 3 + 1, vertex + 1);
|
|
59
|
+
this.index.setX(i * 3 + 2, vertex + 2);
|
|
60
|
+
}
|
|
61
|
+
this.index.needsUpdate = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
attribute float aCellIndex;
|
|
2
|
+
attribute vec3 aCellNormal;
|
|
3
|
+
attribute float aHeight;
|
|
4
|
+
attribute float aEdgeDistance;
|
|
2
5
|
attribute vec3 aNormal;
|
|
3
6
|
|
|
4
7
|
uniform sampler2D uCellMeta;
|
|
5
8
|
uniform float uCellMetaSize;
|
|
6
9
|
|
|
7
10
|
varying vec3 vWorldPosition;
|
|
8
|
-
varying vec3 vNormal;
|
|
9
11
|
varying float vHeight;
|
|
12
|
+
varying float vEdgeDistance;
|
|
13
|
+
varying float vRelief;
|
|
10
14
|
varying float vCellIndex;
|
|
11
15
|
varying float vFallProgress;
|
|
12
16
|
|
|
@@ -16,15 +20,16 @@ void main() {
|
|
|
16
20
|
float fallProgress = meta[CELL_META_FALL_PROGRESS];
|
|
17
21
|
vFallProgress = fallProgress;
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
displaced
|
|
23
|
+
// Displace falling void cells along the cell's outward surface normal so they sink "into" the polyhedron/spheroid rather than along world -Y.
|
|
24
|
+
vec3 displaced = position - aCellNormal * (fallProgress * VOID_FALL_DISTANCE);
|
|
21
25
|
|
|
22
26
|
vec4 worldPosition = modelMatrix * vec4(displaced, 1.0);
|
|
23
27
|
vWorldPosition = worldPosition.xyz;
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
// Raw scalar elevation displacement (along the cell's outward normal) for the fragment shader's color ramp. Independent of fall animation so falling cells don't shift colors as they drop.
|
|
29
|
+
vHeight = aHeight;
|
|
30
|
+
vEdgeDistance = aEdgeDistance;
|
|
31
|
+
// Local slope gives hills depth without favoring a world-space direction.
|
|
32
|
+
vRelief = clamp(dot(normalize(aNormal), normalize(aCellNormal)), 0.0, 1.0);
|
|
28
33
|
vCellIndex = aCellIndex;
|
|
29
34
|
|
|
30
35
|
gl_Position = projectionMatrix * viewMatrix * worldPosition;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
// AUTO-GENERATED by crates/game/build.rs from
|
|
2
2
|
// crates/game/src/shared_constants.rs.
|
|
3
3
|
// Edit that file, not this one.
|
|
4
|
-
export const MAP_WIDTH = 100.0;
|
|
5
|
-
export const MAP_HEIGHT = 100.0;
|
|
6
|
-
export const MAP_AREA = MAP_WIDTH * MAP_HEIGHT;
|
|
7
4
|
export const PULSE_SWEEP_BAND = 0.12;
|
|
8
5
|
export const PULSE_SWEEP_VELOCITY = 0.1;
|
|
9
6
|
export const PULSE_MIN_DURATION_MS = 80;
|
|
@@ -15,14 +15,22 @@ export * from "./error_join_failed.js";
|
|
|
15
15
|
export * from "./error_join_ticket_invalid.js";
|
|
16
16
|
export * from "./error_join_ticket_required.js";
|
|
17
17
|
export * from "./field_invitation_url.js";
|
|
18
|
+
export * from "./field_map_shape.js";
|
|
18
19
|
export * from "./field_map_size.js";
|
|
19
20
|
export * from "./field_player_name.js";
|
|
21
|
+
export * from "./field_radius.js";
|
|
22
|
+
export * from "./field_radius_x.js";
|
|
23
|
+
export * from "./field_radius_y.js";
|
|
24
|
+
export * from "./field_radius_z.js";
|
|
20
25
|
export * from "./field_relay_servers.js";
|
|
21
26
|
export * from "./field_seed.js";
|
|
22
27
|
export * from "./field_size.js";
|
|
28
|
+
export * from "./field_spikiness.js";
|
|
29
|
+
export * from "./field_subdivisions.js";
|
|
23
30
|
export * from "./field_ticket_or_invitation_url.js";
|
|
24
31
|
export * from "./field_tutorial_mode.js";
|
|
25
32
|
export * from "./field_void_fraction.js";
|
|
33
|
+
export * from "./shape_label.js";
|
|
26
34
|
export * from "./label_advanced_settings.js";
|
|
27
35
|
export * from "./label_players.js";
|
|
28
36
|
export * from "./label_safe_cells_explored.js";
|
|
@@ -49,4 +57,10 @@ export * from "./tutorial_after_void.js";
|
|
|
49
57
|
export * from "./tutorial_awaiting_first_click.js";
|
|
50
58
|
export * from "./tutorial_intro.js";
|
|
51
59
|
export * from "./tutorial_won.js";
|
|
60
|
+
export * from "./field_cell_density.js";
|
|
61
|
+
export * from "./cells_per_face.js";
|
|
62
|
+
export * from "./faces_count.js";
|
|
63
|
+
export * from "./field_surface_detail.js";
|
|
64
|
+
export * from "./text_density_summary.js";
|
|
65
|
+
export * from "./text_invite_after_opening.js";
|
|
52
66
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
|
@@ -17,14 +17,22 @@ export * from './error_join_failed.js'
|
|
|
17
17
|
export * from './error_join_ticket_invalid.js'
|
|
18
18
|
export * from './error_join_ticket_required.js'
|
|
19
19
|
export * from './field_invitation_url.js'
|
|
20
|
+
export * from './field_map_shape.js'
|
|
20
21
|
export * from './field_map_size.js'
|
|
21
22
|
export * from './field_player_name.js'
|
|
23
|
+
export * from './field_radius.js'
|
|
24
|
+
export * from './field_radius_x.js'
|
|
25
|
+
export * from './field_radius_y.js'
|
|
26
|
+
export * from './field_radius_z.js'
|
|
22
27
|
export * from './field_relay_servers.js'
|
|
23
28
|
export * from './field_seed.js'
|
|
24
29
|
export * from './field_size.js'
|
|
30
|
+
export * from './field_spikiness.js'
|
|
31
|
+
export * from './field_subdivisions.js'
|
|
25
32
|
export * from './field_ticket_or_invitation_url.js'
|
|
26
33
|
export * from './field_tutorial_mode.js'
|
|
27
34
|
export * from './field_void_fraction.js'
|
|
35
|
+
export * from './shape_label.js'
|
|
28
36
|
export * from './label_advanced_settings.js'
|
|
29
37
|
export * from './label_players.js'
|
|
30
38
|
export * from './label_safe_cells_explored.js'
|
|
@@ -50,4 +58,10 @@ export * from './tutorial_after_safe_guess.js'
|
|
|
50
58
|
export * from './tutorial_after_void.js'
|
|
51
59
|
export * from './tutorial_awaiting_first_click.js'
|
|
52
60
|
export * from './tutorial_intro.js'
|
|
53
|
-
export * from './tutorial_won.js'
|
|
61
|
+
export * from './tutorial_won.js'
|
|
62
|
+
export * from './field_cell_density.js'
|
|
63
|
+
export * from './cells_per_face.js'
|
|
64
|
+
export * from './faces_count.js'
|
|
65
|
+
export * from './field_surface_detail.js'
|
|
66
|
+
export * from './text_density_summary.js'
|
|
67
|
+
export * from './text_invite_after_opening.js'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* | output |
|
|
3
|
+
* | --- |
|
|
4
|
+
* | "{count} / face" |
|
|
5
|
+
*
|
|
6
|
+
* @param {Cells_Per_FaceInputs} inputs
|
|
7
|
+
* @param {{ locale?: "en" | "bn" }} options
|
|
8
|
+
* @returns {LocalizedString}
|
|
9
|
+
*/
|
|
10
|
+
export const cells_per_face: ((inputs: Cells_Per_FaceInputs, options?: {
|
|
11
|
+
locale?: "en" | "bn";
|
|
12
|
+
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Cells_Per_FaceInputs, {
|
|
13
|
+
locale?: "en" | "bn";
|
|
14
|
+
}, {}>;
|
|
15
|
+
export type LocalizedString = import("../runtime.js").LocalizedString;
|
|
16
|
+
export type Cells_Per_FaceInputs = {
|
|
17
|
+
count: NonNullable<unknown>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
|
3
|
+
|
|
4
|
+
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
|
5
|
+
|
|
6
|
+
/** @typedef {{ count: NonNullable<unknown> }} Cells_Per_FaceInputs */
|
|
7
|
+
|
|
8
|
+
const en_cells_per_face = /** @type {(inputs: Cells_Per_FaceInputs) => LocalizedString} */ (i) => {
|
|
9
|
+
return /** @type {LocalizedString} */ (`${i?.count} / face`)
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const bn_cells_per_face = /** @type {(inputs: Cells_Per_FaceInputs) => LocalizedString} */ (i) => {
|
|
13
|
+
return /** @type {LocalizedString} */ (`${i?.count} / পৃষ্ঠ`)
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* | output |
|
|
18
|
+
* | --- |
|
|
19
|
+
* | "{count} / face" |
|
|
20
|
+
*
|
|
21
|
+
* @param {Cells_Per_FaceInputs} inputs
|
|
22
|
+
* @param {{ locale?: "en" | "bn" }} options
|
|
23
|
+
* @returns {LocalizedString}
|
|
24
|
+
*/
|
|
25
|
+
export const cells_per_face = /** @type {((inputs: Cells_Per_FaceInputs, options?: { locale?: "en" | "bn" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Cells_Per_FaceInputs, { locale?: "en" | "bn" }, {}>} */ ((inputs, options = {}) => {
|
|
26
|
+
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
|
27
|
+
if (locale === "en") return en_cells_per_face(inputs)
|
|
28
|
+
return bn_cells_per_face(inputs)
|
|
29
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* | output |
|
|
3
|
+
* | --- |
|
|
4
|
+
* | "{count} faces" |
|
|
5
|
+
*
|
|
6
|
+
* @param {Faces_CountInputs} inputs
|
|
7
|
+
* @param {{ locale?: "en" | "bn" }} options
|
|
8
|
+
* @returns {LocalizedString}
|
|
9
|
+
*/
|
|
10
|
+
export const faces_count: ((inputs: Faces_CountInputs, options?: {
|
|
11
|
+
locale?: "en" | "bn";
|
|
12
|
+
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Faces_CountInputs, {
|
|
13
|
+
locale?: "en" | "bn";
|
|
14
|
+
}, {}>;
|
|
15
|
+
export type LocalizedString = import("../runtime.js").LocalizedString;
|
|
16
|
+
export type Faces_CountInputs = {
|
|
17
|
+
count: NonNullable<unknown>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
|
3
|
+
|
|
4
|
+
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
|
5
|
+
|
|
6
|
+
/** @typedef {{ count: NonNullable<unknown> }} Faces_CountInputs */
|
|
7
|
+
|
|
8
|
+
const en_faces_count = /** @type {(inputs: Faces_CountInputs) => LocalizedString} */ (i) => {
|
|
9
|
+
return /** @type {LocalizedString} */ (`${i?.count} faces`)
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const bn_faces_count = /** @type {(inputs: Faces_CountInputs) => LocalizedString} */ (i) => {
|
|
13
|
+
return /** @type {LocalizedString} */ (`${i?.count}টি পৃষ্ঠ`)
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* | output |
|
|
18
|
+
* | --- |
|
|
19
|
+
* | "{count} faces" |
|
|
20
|
+
*
|
|
21
|
+
* @param {Faces_CountInputs} inputs
|
|
22
|
+
* @param {{ locale?: "en" | "bn" }} options
|
|
23
|
+
* @returns {LocalizedString}
|
|
24
|
+
*/
|
|
25
|
+
export const faces_count = /** @type {((inputs: Faces_CountInputs, options?: { locale?: "en" | "bn" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Faces_CountInputs, { locale?: "en" | "bn" }, {}>} */ ((inputs, options = {}) => {
|
|
26
|
+
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
|
27
|
+
if (locale === "en") return en_faces_count(inputs)
|
|
28
|
+
return bn_faces_count(inputs)
|
|
29
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* | output |
|
|
3
|
+
* | --- |
|
|
4
|
+
* | "Cells per face" |
|
|
5
|
+
*
|
|
6
|
+
* @param {Field_Cell_DensityInputs} inputs
|
|
7
|
+
* @param {{ locale?: "en" | "bn" }} options
|
|
8
|
+
* @returns {LocalizedString}
|
|
9
|
+
*/
|
|
10
|
+
export const field_cell_density: ((inputs?: Field_Cell_DensityInputs, options?: {
|
|
11
|
+
locale?: "en" | "bn";
|
|
12
|
+
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Field_Cell_DensityInputs, {
|
|
13
|
+
locale?: "en" | "bn";
|
|
14
|
+
}, {}>;
|
|
15
|
+
export type LocalizedString = import("../runtime.js").LocalizedString;
|
|
16
|
+
export type Field_Cell_DensityInputs = {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
|
3
|
+
|
|
4
|
+
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
|
5
|
+
|
|
6
|
+
/** @typedef {{}} Field_Cell_DensityInputs */
|
|
7
|
+
|
|
8
|
+
const en_field_cell_density = /** @type {(inputs: Field_Cell_DensityInputs) => LocalizedString} */ () => {
|
|
9
|
+
return /** @type {LocalizedString} */ (`Cells per face`)
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const bn_field_cell_density = /** @type {(inputs: Field_Cell_DensityInputs) => LocalizedString} */ () => {
|
|
13
|
+
return /** @type {LocalizedString} */ (`প্রতি পৃষ্ঠে ঘর`)
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* | output |
|
|
18
|
+
* | --- |
|
|
19
|
+
* | "Cells per face" |
|
|
20
|
+
*
|
|
21
|
+
* @param {Field_Cell_DensityInputs} inputs
|
|
22
|
+
* @param {{ locale?: "en" | "bn" }} options
|
|
23
|
+
* @returns {LocalizedString}
|
|
24
|
+
*/
|
|
25
|
+
export const field_cell_density = /** @type {((inputs?: Field_Cell_DensityInputs, options?: { locale?: "en" | "bn" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Field_Cell_DensityInputs, { locale?: "en" | "bn" }, {}>} */ ((inputs = {}, options = {}) => {
|
|
26
|
+
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
|
27
|
+
if (locale === "en") return en_field_cell_density(inputs)
|
|
28
|
+
return bn_field_cell_density(inputs)
|
|
29
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* | output |
|
|
3
|
+
* | --- |
|
|
4
|
+
* | "Map Shape" |
|
|
5
|
+
*
|
|
6
|
+
* @param {Field_Map_ShapeInputs} inputs
|
|
7
|
+
* @param {{ locale?: "en" | "bn" }} options
|
|
8
|
+
* @returns {LocalizedString}
|
|
9
|
+
*/
|
|
10
|
+
export const field_map_shape: ((inputs?: Field_Map_ShapeInputs, options?: {
|
|
11
|
+
locale?: "en" | "bn";
|
|
12
|
+
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Field_Map_ShapeInputs, {
|
|
13
|
+
locale?: "en" | "bn";
|
|
14
|
+
}, {}>;
|
|
15
|
+
export type LocalizedString = import("../runtime.js").LocalizedString;
|
|
16
|
+
export type Field_Map_ShapeInputs = {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
|
3
|
+
|
|
4
|
+
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
|
5
|
+
|
|
6
|
+
/** @typedef {{}} Field_Map_ShapeInputs */
|
|
7
|
+
|
|
8
|
+
const en_field_map_shape = /** @type {(inputs: Field_Map_ShapeInputs) => LocalizedString} */ () => {
|
|
9
|
+
return /** @type {LocalizedString} */ (`Map Shape`)
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const bn_field_map_shape = /** @type {(inputs: Field_Map_ShapeInputs) => LocalizedString} */ () => {
|
|
13
|
+
return /** @type {LocalizedString} */ (`ম্যাপের আকৃতি`)
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* | output |
|
|
18
|
+
* | --- |
|
|
19
|
+
* | "Map Shape" |
|
|
20
|
+
*
|
|
21
|
+
* @param {Field_Map_ShapeInputs} inputs
|
|
22
|
+
* @param {{ locale?: "en" | "bn" }} options
|
|
23
|
+
* @returns {LocalizedString}
|
|
24
|
+
*/
|
|
25
|
+
export const field_map_shape = /** @type {((inputs?: Field_Map_ShapeInputs, options?: { locale?: "en" | "bn" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Field_Map_ShapeInputs, { locale?: "en" | "bn" }, {}>} */ ((inputs = {}, options = {}) => {
|
|
26
|
+
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
|
27
|
+
if (locale === "en") return en_field_map_shape(inputs)
|
|
28
|
+
return bn_field_map_shape(inputs)
|
|
29
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* | output |
|
|
3
|
+
* | --- |
|
|
4
|
+
* | "Radius" |
|
|
5
|
+
*
|
|
6
|
+
* @param {Field_RadiusInputs} inputs
|
|
7
|
+
* @param {{ locale?: "en" | "bn" }} options
|
|
8
|
+
* @returns {LocalizedString}
|
|
9
|
+
*/
|
|
10
|
+
export const field_radius: ((inputs?: Field_RadiusInputs, options?: {
|
|
11
|
+
locale?: "en" | "bn";
|
|
12
|
+
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Field_RadiusInputs, {
|
|
13
|
+
locale?: "en" | "bn";
|
|
14
|
+
}, {}>;
|
|
15
|
+
export type LocalizedString = import("../runtime.js").LocalizedString;
|
|
16
|
+
export type Field_RadiusInputs = {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
|
3
|
+
|
|
4
|
+
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
|
5
|
+
|
|
6
|
+
/** @typedef {{}} Field_RadiusInputs */
|
|
7
|
+
|
|
8
|
+
const en_field_radius = /** @type {(inputs: Field_RadiusInputs) => LocalizedString} */ () => {
|
|
9
|
+
return /** @type {LocalizedString} */ (`Radius`)
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const bn_field_radius = /** @type {(inputs: Field_RadiusInputs) => LocalizedString} */ () => {
|
|
13
|
+
return /** @type {LocalizedString} */ (`ব্যাসার্ধ`)
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* | output |
|
|
18
|
+
* | --- |
|
|
19
|
+
* | "Radius" |
|
|
20
|
+
*
|
|
21
|
+
* @param {Field_RadiusInputs} inputs
|
|
22
|
+
* @param {{ locale?: "en" | "bn" }} options
|
|
23
|
+
* @returns {LocalizedString}
|
|
24
|
+
*/
|
|
25
|
+
export const field_radius = /** @type {((inputs?: Field_RadiusInputs, options?: { locale?: "en" | "bn" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Field_RadiusInputs, { locale?: "en" | "bn" }, {}>} */ ((inputs = {}, options = {}) => {
|
|
26
|
+
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
|
27
|
+
if (locale === "en") return en_field_radius(inputs)
|
|
28
|
+
return bn_field_radius(inputs)
|
|
29
|
+
});
|