@adatechnology/game-interactables 0.10.0 → 0.12.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/index.js CHANGED
@@ -1,3 +1,30 @@
1
+ // src/gestures.ts
2
+ var GESTURE_OF_ACTION = {
3
+ toggle_part: null,
4
+ open_container: null,
5
+ take: null,
6
+ sit: null,
7
+ toggle_device: "press",
8
+ cycle_device: "press",
9
+ toggle_switch: "flip",
10
+ toggle_breaker: "flip",
11
+ toggle_main: "flip",
12
+ toggle_fixture: "turn",
13
+ toggle_burner: "turn",
14
+ ignite: "strike",
15
+ toggle_fuel: "turn",
16
+ read: "read"
17
+ };
18
+ var GESTURE_OF_USE = {
19
+ program: "press",
20
+ put_in: "put_in",
21
+ empty: "tip",
22
+ fill: "pour",
23
+ relieve: null,
24
+ wash: null,
25
+ drink: null
26
+ };
27
+
1
28
  // src/fixture-emitters.ts
2
29
  var FLUSH_RUN_SECONDS = 2;
3
30
  var START_OPENING = 0.05;
@@ -220,7 +247,19 @@ var locales = {
220
247
  done_program_stop: "{name} stopped",
221
248
  done_relieve_urine: "You peed in {name}",
222
249
  done_relieve_feces: "You pooed in {name}",
223
- done_clean: "{name} flushed clean"
250
+ done_clean: "{name} flushed clean",
251
+ "use.wash_dishes": "Wash the dishes",
252
+ "use.drink_water": "Drink water",
253
+ busy: "Already in use",
254
+ needs_running: "Turn the water on first",
255
+ needs_item: "You need {need}",
256
+ item_spent: "{item} is empty",
257
+ no_dirty_dishes: "No dirty dishes in the sink",
258
+ started_wash: "{label}\u2026",
259
+ started_drink: "{label}\u2026",
260
+ done_wash: "Washed and rinsed",
261
+ done_wash_dishes: "Dishes washed: {n} on the rack",
262
+ done_drink: "You drank {litres} l of water"
224
263
  },
225
264
  "pt-BR": {
226
265
  "prompt.open": "Abrir {name}",
@@ -273,7 +312,19 @@ var locales = {
273
312
  done_program_stop: "{name} parou",
274
313
  done_relieve_urine: "Voc\xEA fez xixi em {name}",
275
314
  done_relieve_feces: "Voc\xEA fez coc\xF4 em {name}",
276
- done_clean: "Descarga dada: {name} limpo"
315
+ done_clean: "Descarga dada: {name} limpo",
316
+ "use.wash_dishes": "Lavar a lou\xE7a",
317
+ "use.drink_water": "Beber \xE1gua",
318
+ busy: "J\xE1 est\xE1 em uso",
319
+ needs_running: "Abra a \xE1gua primeiro",
320
+ needs_item: "Precisa de {need}",
321
+ item_spent: "{item} acabou",
322
+ no_dirty_dishes: "N\xE3o h\xE1 lou\xE7a suja na pia",
323
+ started_wash: "{label}\u2026",
324
+ started_drink: "{label}\u2026",
325
+ done_wash: "Lavado e enxaguado",
326
+ done_wash_dishes: "Lou\xE7a lavada: {n} no escorredor",
327
+ done_drink: "Voc\xEA bebeu {litres} l de \xE1gua"
277
328
  }
278
329
  };
279
330
  function pickLocale(locale) {
@@ -1302,6 +1353,7 @@ function createWorld(options = {}) {
1302
1353
  id,
1303
1354
  object: o.id,
1304
1355
  kind: i.action.do,
1356
+ ...GESTURE_OF_ACTION[i.action.do] ? { gesture: GESTURE_OF_ACTION[i.action.do] } : {},
1305
1357
  pos: toWorld(o, i.pos),
1306
1358
  radius: i.radius ?? DEFAULT_RADIUS,
1307
1359
  label: p.label,
@@ -2434,6 +2486,29 @@ function wireRuns(params) {
2434
2486
  return runs;
2435
2487
  }
2436
2488
 
2489
+ // src/cast-with-member.ts
2490
+ var COLLAR_REACH = 0.03;
2491
+ var END_GAP = 5e-3;
2492
+ function centredOn(member, other) {
2493
+ for (const k of [0, 2]) {
2494
+ if (other[k] < member[k] - COLLAR_REACH || other[k + 3] > member[k + 3] + COLLAR_REACH) return false;
2495
+ if (Math.abs((other[k] + other[k + 3]) / 2 - (member[k] + member[k + 3]) / 2) > COLLAR_REACH) return false;
2496
+ }
2497
+ return true;
2498
+ }
2499
+ function wrapsMember(member, collar) {
2500
+ const overlap2 = Math.min(collar[4], member[4]) - Math.max(collar[1], member[1]);
2501
+ return overlap2 >= (collar[4] - collar[1]) / 2 && centredOn(member, collar);
2502
+ }
2503
+ function endsMember(member, end) {
2504
+ const under = Math.abs(end[4] - member[1]) <= END_GAP;
2505
+ const over = Math.abs(end[1] - member[4]) <= END_GAP;
2506
+ return (under || over) && end[4] - end[1] <= member[4] - member[1] && centredOn(member, end);
2507
+ }
2508
+ function castWithMember(member, other) {
2509
+ return wrapsMember(member, other) || endsMember(member, other);
2510
+ }
2511
+
2437
2512
  // src/fits-volume.ts
2438
2513
  function fitsInVolume(size, half) {
2439
2514
  const thing = [...size].sort((a, b) => b - a);
@@ -2441,7 +2516,192 @@ function fitsInVolume(size, half) {
2441
2516
  return thing.every((side, i) => side <= (room[i] ?? 0));
2442
2517
  }
2443
2518
 
2519
+ // src/sink-uses.ts
2520
+ var WASH_SCRUB_SECONDS = 3;
2521
+ var DRINK_LITRES = 0.25;
2522
+ var FILL_SHARE = 0.85;
2523
+ var DRINK_LPS = 0.06;
2524
+ var REACH_SECONDS = 0.6;
2525
+ var DRY_SECONDS = 0.5;
2526
+ var SCRUBBED_DIRT = 0.15;
2527
+ var YES = { available: true };
2528
+ var idsOf = (need) => typeof need === "string" ? [need] : need;
2529
+ function findNeeds(needs, host) {
2530
+ const items = [];
2531
+ for (const need of needs) {
2532
+ const item = host.itemAt?.(idsOf(need)) ?? null;
2533
+ if (!item) return { items, missing: idsOf(need) };
2534
+ items.push(item);
2535
+ }
2536
+ return { items };
2537
+ }
2538
+ function dirtyDishes(use, spec, host) {
2539
+ const dishes = use.dishes;
2540
+ const basin = dishes ? (spec.basins ?? []).find((b) => b.id === dishes.basin) : void 0;
2541
+ if (!dishes || !basin) return [];
2542
+ return (host.itemsInside?.(dishes.ids, basin.from, basin.to) ?? []).filter((item) => (item.dirt ?? 0) > 0);
2543
+ }
2544
+ function sinkVerdict(use, spec, host, flowing) {
2545
+ if (use.do === "wash" && use.requiresFlowing && !flowing) return { available: false, reason: "needs_running" };
2546
+ const found = findNeeds(use.needs ?? [], host);
2547
+ if (found.missing) return { available: false, reason: "needs_item", vars: { need: found.missing[0] ?? "" } };
2548
+ if (use.do === "drink") return YES;
2549
+ const dosed = use.dose ? found.items[use.dose.need] : void 0;
2550
+ if (dosed && (dosed.remaining ?? 1) <= 0) return { available: false, reason: "item_spent", vars: { item: dosed.name } };
2551
+ if (use.dishes && dirtyDishes(use, spec, host).length === 0) return { available: false, reason: "no_dirty_dishes" };
2552
+ return YES;
2553
+ }
2554
+ var fixtureFlowLps = (fixture) => fixture ? (fixture.flow ?? FLOW_DEFAULTS[fixture.kind] ?? 6) / 60 : 0;
2555
+ function runPhases(phases) {
2556
+ let index = 0;
2557
+ return (dt) => {
2558
+ if (index < phases.length && phases[index]?.(dt)) index++;
2559
+ return index >= phases.length;
2560
+ };
2561
+ }
2562
+ function wait(seconds) {
2563
+ let left = seconds;
2564
+ return (dt) => (left -= dt) <= 0;
2565
+ }
2566
+ function placePhase(host, item, spot) {
2567
+ return () => {
2568
+ if (spot) host.placeItem?.(item.objectId, [spot[0], spot[1], spot[2]]);
2569
+ return true;
2570
+ };
2571
+ }
2572
+ function createSinkRoutines(options) {
2573
+ const { spec, world, objectId } = options;
2574
+ const fixtureOf = (id) => (spec.fixtures ?? []).find((f) => f.id === id);
2575
+ const flowing = (use) => world.water.isFlowing(objectId, use.fixture);
2576
+ const water = (use) => flowing(use) ? fixtureFlowLps(fixtureOf(use.fixture)) : 0;
2577
+ const waterOf = (use) => {
2578
+ let dry = 0;
2579
+ return (dt) => {
2580
+ const flow = water(use);
2581
+ dry = flow > 0 ? 0 : dry + dt;
2582
+ return dry > DRY_SECONDS ? null : flow;
2583
+ };
2584
+ };
2585
+ const tapPhases = (use) => {
2586
+ let opened = false;
2587
+ const reach = wait(REACH_SECONDS);
2588
+ return {
2589
+ open: (dt) => {
2590
+ if (opened || use.opensFixture === false || flowing(use)) return true;
2591
+ if (!reach(dt)) return false;
2592
+ opened = world.setFixture(objectId, use.fixture, true);
2593
+ return true;
2594
+ },
2595
+ close: () => {
2596
+ if (opened) world.setFixture(objectId, use.fixture, false);
2597
+ return true;
2598
+ }
2599
+ };
2600
+ };
2601
+ const scrubAndRinse = (use, host, target, fail) => {
2602
+ const item = typeof target === "string" ? void 0 : target;
2603
+ const id = item?.objectId ?? target;
2604
+ const seconds = use.scrubSeconds ?? WASH_SCRUB_SECONDS;
2605
+ const dirt = item?.dirt ?? 0;
2606
+ let scrubbed = -1;
2607
+ const scrub = (dt) => {
2608
+ if (scrubbed < 0) {
2609
+ scrubbed = 0;
2610
+ host.playUse?.(use.clip, item?.objectId);
2611
+ }
2612
+ scrubbed = Math.min(seconds, scrubbed + dt);
2613
+ host.lather?.(id, dt / seconds);
2614
+ if (dirt > 0) host.setDirt?.(id, dirt - (dirt - Math.min(dirt, SCRUBBED_DIRT)) * (scrubbed / seconds));
2615
+ return scrubbed >= seconds;
2616
+ };
2617
+ const running = waterOf(use);
2618
+ const rinse = (dt) => {
2619
+ const flow = running(dt);
2620
+ if (flow === null) {
2621
+ fail({ key: "no_water", ok: false });
2622
+ return true;
2623
+ }
2624
+ if (flow <= 0 || (host.rinse?.(id, flow, dt) ?? 0) > 0) return false;
2625
+ if (dirt > 0) host.setDirt?.(id, 0);
2626
+ return true;
2627
+ };
2628
+ return [scrub, rinse];
2629
+ };
2630
+ const startWash = (use, host) => {
2631
+ const { items } = findNeeds(use.needs ?? [], host);
2632
+ let end = null;
2633
+ const fail = (reason) => {
2634
+ end ?? (end = reason);
2635
+ };
2636
+ const tap = tapPhases(use);
2637
+ const dosed = use.dose ? items[use.dose.need] : void 0;
2638
+ const dose = () => {
2639
+ if (dosed && host.takeDose?.(dosed.objectId, use.dose?.amount).taken === 0) fail({ key: "item_spent", ok: false, vars: { item: dosed.name } });
2640
+ return true;
2641
+ };
2642
+ const dishes = use.dishes ? dirtyDishes(use, spec, host) : [];
2643
+ const rack = use.dishes?.rack ?? [];
2644
+ const work = use.dishes ? dishes.flatMap((dish, index) => [...scrubAndRinse(use, host, dish, fail), placePhase(host, dish, rack[Math.min(index, rack.length - 1)])]) : scrubAndRinse(use, host, use.surface, fail);
2645
+ const guarded = work.map((phase) => (dt) => end !== null || phase(dt));
2646
+ const run = runPhases([tap.open, dose, ...guarded, tap.close]);
2647
+ const done = use.dishes ? { key: "done_wash_dishes", ok: true, vars: { n: String(dishes.length) } } : { key: "done_wash", ok: true, vars: { surface: use.surface } };
2648
+ return { use: use.id, step: (dt) => run(dt) ? end ?? done : null };
2649
+ };
2650
+ const startDrink = (use, host, vessel) => {
2651
+ const tap = tapPhases(use);
2652
+ const want = Math.min(use.litres ?? DRINK_LITRES, (vessel.liquid?.capacity ?? DRINK_LITRES) * FILL_SHARE);
2653
+ let filled = vessel.liquid?.kind === "water" ? vessel.liquid.litres : 0;
2654
+ let drunk = 0;
2655
+ let end = null;
2656
+ const take = () => {
2657
+ if (vessel.where !== "hand" && host.holdItem?.(vessel.objectId) === false) end = { key: "needs_item", ok: false, vars: { need: vessel.itemId } };
2658
+ else host.playUse?.(use.fillClip ?? "fill_cup", vessel.objectId);
2659
+ return true;
2660
+ };
2661
+ const running = waterOf(use);
2662
+ const fill = (dt) => {
2663
+ if (end) return true;
2664
+ const flow = running(dt);
2665
+ if (flow === null) {
2666
+ end = { key: "no_water", ok: false };
2667
+ return true;
2668
+ }
2669
+ if (flow <= 0) return false;
2670
+ const took = host.fillItem?.(vessel.objectId, "water", Math.min(flow * dt, want - filled)) ?? 0;
2671
+ filled += took;
2672
+ return filled >= want - 1e-6 || took <= 0;
2673
+ };
2674
+ let sipping = false;
2675
+ const drink = (dt) => {
2676
+ if (end) return true;
2677
+ if (!sipping) sipping = host.playUse?.(use.clip, vessel.objectId) ?? true;
2678
+ const sip = host.drinkItem?.(vessel.objectId, Math.min(DRINK_LPS * dt, filled - drunk)) ?? 0;
2679
+ drunk += sip;
2680
+ return drunk >= filled - 1e-6 || sip <= 0;
2681
+ };
2682
+ const giveBack = vessel.where === "reach" ? placePhase(host, vessel, vessel.at) : () => true;
2683
+ const run = runPhases([take, tap.open, fill, tap.close, drink, wait(REACH_SECONDS), giveBack]);
2684
+ return { use: use.id, step: (dt) => run(dt) ? end ?? { key: "done_drink", ok: true, vars: { litres: drunk.toFixed(2) } } : null };
2685
+ };
2686
+ return {
2687
+ start(use, host) {
2688
+ if (use.do === "wash") return startWash(use, host);
2689
+ const vessel = findNeeds(use.needs, host).items[0];
2690
+ if (!vessel) return { use: use.id, step: () => ({ key: "needs_item", ok: false, vars: { need: idsOf(use.needs[0] ?? "")[0] ?? "" } }) };
2691
+ return startDrink(use, host, vessel);
2692
+ }
2693
+ };
2694
+ }
2695
+
2444
2696
  // src/object-uses.ts
2697
+ function devicePointOf(spec, device) {
2698
+ const own = (spec.interactions ?? []).find((i) => i.action.do === "toggle_device" && i.action.device === device);
2699
+ if (own) return own.pos;
2700
+ const def = (spec.devices ?? []).find((d) => d.id === device);
2701
+ if (!def) return void 0;
2702
+ const part = def.part ? spec.parts?.find((p) => p.id === def.part)?.pivot : void 0;
2703
+ return part ?? def.plug ?? [0, 1, 0];
2704
+ }
2445
2705
  var OPEN = 0.5;
2446
2706
  var PREFIX = "use.";
2447
2707
  var SOIL_RANK = { clean: 0, urine: 1, feces: 2 };
@@ -2450,7 +2710,7 @@ var clock = (seconds) => {
2450
2710
  return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
2451
2711
  };
2452
2712
  var accepts = (bowl, hand) => (bowl.accepts ?? []).some((id) => hand.itemId === id || hand.itemId.endsWith(`_${id}`));
2453
- var YES = { available: true };
2713
+ var YES2 = { available: true };
2454
2714
  var no = (reason) => ({ available: false, reason });
2455
2715
  function createUses(options) {
2456
2716
  const { spec, world, objectId } = options;
@@ -2462,6 +2722,8 @@ function createUses(options) {
2462
2722
  const cleans = new Map((spec.fixtures ?? []).flatMap((f) => f.cleans ? [[f.id, f.cleans]] : []));
2463
2723
  let program = null;
2464
2724
  let lastHost = null;
2725
+ const sinkRoutines = createSinkRoutines({ spec, world, objectId });
2726
+ let routine = null;
2465
2727
  const typeKey = `type.${spec.type}`;
2466
2728
  const name = () => {
2467
2729
  const text = world.t(typeKey);
@@ -2473,15 +2735,15 @@ function createUses(options) {
2473
2735
  switch (use.do) {
2474
2736
  case "program":
2475
2737
  if (!world.power.isPowered(objectId, use.device)) return no("no_power");
2476
- return use.access && host.partOpening(use.access) >= OPEN ? no("needs_closed") : YES;
2738
+ return use.access && host.partOpening(use.access) >= OPEN ? no("needs_closed") : YES2;
2477
2739
  case "put_in": {
2478
2740
  const c = containers.get(use.container);
2479
2741
  if (!hand) return no("hand_empty");
2480
2742
  if (!c || !accessOpen(host, c.access)) return no("requires_open");
2481
- return fitsInVolume(hand.size, c.volume.half) ? YES : no("not_fit");
2743
+ return fitsInVolume(hand.size, c.volume.half) ? YES2 : no("not_fit");
2482
2744
  }
2483
2745
  case "empty":
2484
- return accessOpen(host, containers.get(use.container)?.access) ? YES : no("requires_open");
2746
+ return accessOpen(host, containers.get(use.container)?.access) ? YES2 : no("requires_open");
2485
2747
  case "fill": {
2486
2748
  const bowl = bowls.get(use.bowl);
2487
2749
  if (!bowl) return no("empty");
@@ -2489,12 +2751,23 @@ function createUses(options) {
2489
2751
  if (!hand) return no("hand_empty");
2490
2752
  if (bowl.holds === "water" && hand.liquid?.kind === "water" && hand.liquid.closed) return no("requires_open");
2491
2753
  const fits = bowl.holds === "water" ? hand.liquid?.kind === "water" && hand.liquid.litres > 0 : accepts(bowl, hand);
2492
- return fits ? YES : no("not_accepted");
2754
+ return fits ? YES2 : no("not_accepted");
2493
2755
  }
2494
2756
  case "relieve":
2495
- return YES;
2757
+ return YES2;
2758
+ case "wash":
2759
+ case "drink":
2760
+ return routine ? no("busy") : sinkVerdict(use, spec, host, world.water.isFlowing(objectId, use.fixture));
2496
2761
  }
2497
2762
  };
2763
+ const itemName = (id) => {
2764
+ const text = world.t(`item.${id}`);
2765
+ return text === `item.${id}` ? id.replace(/_/g, " ") : text;
2766
+ };
2767
+ const reasonOf = (v, use, host) => {
2768
+ const words = { ...textVars(use, host), ...v.vars };
2769
+ return world.t(v.reason, words.need ? { ...words, need: itemName(words.need) } : words);
2770
+ };
2498
2771
  const textVars = (use, host) => ({
2499
2772
  name: name(),
2500
2773
  item: host.hand()?.name ?? "",
@@ -2527,6 +2800,10 @@ function createUses(options) {
2527
2800
  soil.set(use.basin, SOIL_RANK[use.kind] > SOIL_RANK[now] ? use.kind : now);
2528
2801
  return { ok: true, text: world.t(`done_relieve_${use.kind}`, vars) };
2529
2802
  }
2803
+ case "wash":
2804
+ case "drink":
2805
+ routine = sinkRoutines.start(use, host);
2806
+ return { ok: true, text: world.t(`started_${use.do}`, { ...vars, label: world.t(use.label, vars) }) };
2530
2807
  }
2531
2808
  };
2532
2809
  const fill = (bowl, host, vars) => {
@@ -2541,6 +2818,19 @@ function createUses(options) {
2541
2818
  program = null;
2542
2819
  return world.t("done_program_stop", { name: name() });
2543
2820
  };
2821
+ const stepRoutine = (dt) => {
2822
+ const end = routine?.step(dt);
2823
+ if (!end) return;
2824
+ routine = null;
2825
+ const words = end.vars?.need ? { ...end.vars, need: itemName(end.vars.need) } : end.vars;
2826
+ lastHost?.say(world.t(end.key, { name: name(), ...words }));
2827
+ };
2828
+ const gestureOf = (use) => {
2829
+ const gesture = GESTURE_OF_USE[use.do];
2830
+ if (!gesture) return null;
2831
+ const at = use.do === "program" ? devicePointOf(spec, use.device) : use.do === "put_in" || use.do === "empty" ? containers.get(use.container)?.volume.center : use.do === "fill" ? bowls.get(use.bowl)?.center : void 0;
2832
+ return at ? { gesture, at: [at[0], at[1], at[2]] } : null;
2833
+ };
2544
2834
  const visible = (use) => use.do !== "program" || program === null;
2545
2835
  return {
2546
2836
  has: (id) => id.startsWith(PREFIX),
@@ -2550,7 +2840,8 @@ function createUses(options) {
2550
2840
  if (program) entries.push({ id: `${PREFIX}stop`, label: world.t("use.program.stop", { name: name(), left: clock(program.left) }), available: true });
2551
2841
  for (const use of all.filter(visible)) {
2552
2842
  const v = verdict(use, host);
2553
- entries.push({ id: `${PREFIX}${use.id}`, label: labelOf(use, host), available: v.available, ...v.available ? {} : { reason: world.t(v.reason, textVars(use, host)) } });
2843
+ const body = gestureOf(use);
2844
+ entries.push({ id: `${PREFIX}${use.id}`, label: labelOf(use, host), available: v.available, ...v.available ? {} : { reason: reasonOf(v, use, host) }, ...body ?? {} });
2554
2845
  }
2555
2846
  return entries;
2556
2847
  },
@@ -2560,9 +2851,10 @@ function createUses(options) {
2560
2851
  const use = all.find((u) => `${PREFIX}${u.id}` === id);
2561
2852
  if (!use || !visible(use)) return { ok: false, text: "" };
2562
2853
  const v = verdict(use, host);
2563
- return v.available ? runUse(use, host) : { ok: false, text: world.t(v.reason, textVars(use, host)) };
2854
+ return v.available ? runUse(use, host) : { ok: false, text: reasonOf(v, use, host) };
2564
2855
  },
2565
2856
  update(dt) {
2857
+ stepRoutine(dt);
2566
2858
  if (!program) return;
2567
2859
  program.left -= dt;
2568
2860
  if (program.left > 0) return;
@@ -2580,7 +2872,8 @@ function createUses(options) {
2580
2872
  state: () => ({
2581
2873
  bowls: Object.fromEntries(level),
2582
2874
  soil: Object.fromEntries(soil),
2583
- program: program ? { use: program.use.id, device: program.use.device, left: program.left } : null
2875
+ program: program ? { use: program.use.id, device: program.use.device, left: program.left } : null,
2876
+ routine: routine?.use ?? null
2584
2877
  })
2585
2878
  };
2586
2879
  }
@@ -2591,9 +2884,9 @@ var MAINS = "mains";
2591
2884
  var MAINS_TANK = "water";
2592
2885
  var HOST_KINDS = /* @__PURE__ */ new Set(["toggle_part", "open_container", "take", "read", "sit", "toggle_breaker"]);
2593
2886
  var PLUG_FALLBACK = [0, 0.3, 0];
2594
- function mainsSpec(spec) {
2887
+ function mainsSpec(spec, water) {
2595
2888
  const plugged = (spec.devices ?? []).filter((d) => d.socket !== void 0 && !d.circuit);
2596
- return { type: MAINS, sockets: plugged.map((d, i) => ({ id: `socket_${i}`, pos: d.plug ?? PLUG_FALLBACK })), tanks: [{ id: MAINS_TANK, capacity: 1e9 }] };
2889
+ return { type: MAINS, sockets: plugged.map((d, i) => ({ id: `socket_${i}`, pos: d.plug ?? PLUG_FALLBACK })), tanks: water ? [{ id: MAINS_TANK, capacity: 1e9 }] : [] };
2597
2890
  }
2598
2891
  function createObjectControls(options) {
2599
2892
  const { spec } = options;
@@ -2616,8 +2909,9 @@ function createObjectControls(options) {
2616
2909
  forwarded.set(part, open);
2617
2910
  host?.setPart(part, open);
2618
2911
  };
2619
- world.add(MAINS, mainsSpec(spec), { x: 0, y: 0, z: 0, ry: 0 });
2620
- if (options.mains?.water ?? true) world.water.setDefaultTank(`${MAINS}:${MAINS_TANK}`);
2912
+ const piped = options.mains?.water ?? true;
2913
+ world.add(MAINS, mainsSpec(spec, piped), { x: 0, y: 0, z: 0, ry: 0 });
2914
+ if (piped) world.water.setDefaultTank(`${MAINS}:${MAINS_TANK}`);
2621
2915
  world.add(CONTROLLED_OBJECT, spec, { x: 0, y: 0, z: 0, ry: 0 });
2622
2916
  const uses = createUses({ spec, world, objectId: CONTROLLED_OBJECT });
2623
2917
  const programmedDevices = new Set((spec.uses ?? []).flatMap((u) => u.do === "program" ? [u.device] : []));
@@ -2634,7 +2928,10 @@ function createObjectControls(options) {
2634
2928
  return {
2635
2929
  list(lent) {
2636
2930
  lend(lent);
2637
- const fromWorld = interactions().map((i) => ({ id: i.id, label: i.label, available: i.available, ...i.reason ? { reason: world.t(i.reason) } : {} }));
2931
+ const fromWorld = interactions().map((i) => {
2932
+ const gesture = i.gesture;
2933
+ return { id: i.id, label: i.label, available: i.available, ...i.reason ? { reason: world.t(i.reason) } : {}, ...gesture ? { gesture, at: [i.pos[0], i.pos[1], i.pos[2]] } : {} };
2934
+ });
2638
2935
  return [...fromWorld, ...uses.list(lent)];
2639
2936
  },
2640
2937
  run(id, lent) {
@@ -2664,19 +2961,37 @@ function createObjectControls(options) {
2664
2961
  };
2665
2962
  }
2666
2963
  export {
2964
+ COLLAR_REACH,
2667
2965
  CONTROLLED_OBJECT,
2966
+ DRINK_LITRES,
2967
+ DRINK_LPS,
2968
+ DRY_SECONDS,
2969
+ END_GAP,
2970
+ FILL_SHARE,
2971
+ FLOW_DEFAULTS,
2668
2972
  FLUSH_RUN_SECONDS,
2973
+ GESTURE_OF_ACTION,
2974
+ GESTURE_OF_USE,
2975
+ REACH_SECONDS,
2976
+ WASH_SCRUB_SECONDS,
2669
2977
  alignY,
2670
2978
  buildChain,
2979
+ castWithMember,
2671
2980
  chainPoints,
2672
2981
  createEnginePartPhysics,
2673
2982
  createFixtureEmitters,
2674
2983
  createObjectControls,
2984
+ createSinkRoutines,
2675
2985
  createWorld,
2986
+ devicePointOf,
2987
+ dirtyDishes,
2676
2988
  disposeChain,
2989
+ endsMember,
2990
+ findNeeds,
2677
2991
  fitsInVolume,
2678
2992
  fitsSize,
2679
2993
  fitsSlot,
2994
+ fixtureFlowLps,
2680
2995
  format,
2681
2996
  generateLoot,
2682
2997
  hangTail,
@@ -2691,9 +3006,11 @@ export {
2691
3006
  rng,
2692
3007
  rotY,
2693
3008
  rotateAxis,
3009
+ sinkVerdict,
2694
3010
  solveSpan,
2695
3011
  spanStrength,
2696
3012
  wireRuns,
2697
- worldToLocal
3013
+ worldToLocal,
3014
+ wrapsMember
2698
3015
  };
2699
3016
  //# sourceMappingURL=index.js.map