@adatechnology/game-audio 0.2.1 → 0.3.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/index.d.ts CHANGED
@@ -802,6 +802,11 @@ type AudioTestModuleOptions = {
802
802
  seed?: number;
803
803
  /** First sound chosen (default `bench_ping`). */
804
804
  sound?: string;
805
+ /**
806
+ * Draws the thing the probe stands for, where the sound comes from with the `probe` source (for example a portable radio of `game-items-three`). The module
807
+ * draws nothing of its own: without it the area has no probe and the sounds come from the bench settings.
808
+ */
809
+ probe?: (THREE: unknown) => unknown;
805
810
  };
806
811
  /** What the scenarios use of the context the test room passes. */
807
812
  interface AudioScenarioLike {
@@ -2025,25 +2025,23 @@ var GameAudio = (() => {
2025
2025
  if (value > 0) loop?.set({ frequency: value });
2026
2026
  }
2027
2027
  };
2028
- const items = () => [
2029
- {
2030
- id: PROBE_ID,
2031
- name: text.probe,
2032
- movable: false,
2033
- build: (THREE) => {
2034
- const T = THREE;
2035
- const group = new T.Group();
2036
- const post = new T.Mesh(new T.CylinderGeometry(0.04, 0.05, 1.5, 10), new T.MeshStandardMaterial({ color: 4869973 }));
2037
- post.position.set(0, 0.75, 0);
2038
- const speaker = new T.Mesh(new T.BoxGeometry(0.32, 0.4, 0.26), new T.MeshStandardMaterial({ color: 1908772 }));
2039
- speaker.position.set(0, 1.5, 0);
2040
- group.add(post, speaker);
2041
- group.userData[PROBE_ID] = true;
2042
- return group;
2043
- },
2044
- spec: { parts: [{ id: "post", material: "steel", shape: { kind: "box", size: [0.12, 1.7, 0.3] }, position: [0, 0.85, 0], mass: 25, hp: 400 }] }
2045
- }
2046
- ];
2028
+ const items = () => {
2029
+ const probe = options.probe;
2030
+ if (!probe) return [];
2031
+ return [
2032
+ {
2033
+ id: PROBE_ID,
2034
+ name: text.probe,
2035
+ movable: false,
2036
+ build: (THREE) => {
2037
+ const root = probe(THREE);
2038
+ root.userData = root.userData ?? {};
2039
+ root.userData[PROBE_ID] = true;
2040
+ return root;
2041
+ }
2042
+ }
2043
+ ];
2044
+ };
2047
2045
  const controls = () => [
2048
2046
  { kind: "choice", id: "sound", name: text.controls.sound, options: soundOptions(), default: state.sound },
2049
2047
  { kind: "choice", id: "source", name: text.controls.source, hint: text.hints.source, options: [{ id: "bench", name: text.options.bench }, { id: "probe", name: text.options.probe }], default: state.source },
@@ -2120,7 +2118,7 @@ var GameAudio = (() => {
2120
2118
  }
2121
2119
  ];
2122
2120
  const area = () => ({
2123
- placements: [{ item: PROBE_ID, position: PROBE_AT, asleep: true }],
2121
+ placements: options.probe ? [{ item: PROBE_ID, position: PROBE_AT, asleep: true }] : [],
2124
2122
  view: { eye: [0, 1.7, 3], target: [0, 1.4, -10] }
2125
2123
  });
2126
2124
  const module = {