@adatechnology/game-interactables 0.13.0 → 0.14.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.d.ts CHANGED
@@ -298,11 +298,14 @@ interface ItemDef {
298
298
  type ItemCatalog = Record<string, ItemDef>;
299
299
  /** A spot where one stack sits, in object-local coordinates (bottom center of the stack). */
300
300
  interface SlotSpec {
301
+ /** Where the item stands: the middle of its base. */
301
302
  pos: Vec3;
302
- /** Largest item [w, h, d] the slot holds. */
303
+ /** Largest item [w, h, d] the slot holds, as it lies in the slot. */
303
304
  max: Vec3;
304
305
  /** The slot moves with this part (a drawer or a door shelf). */
305
306
  part?: string;
307
+ /** The item lies on its side, its height along `x` or `z` (a toothbrush or a tube laid on a counter); left out, it stands up. */
308
+ lay?: 'x' | 'z';
306
309
  }
307
310
  interface ContainerSpec {
308
311
  id: string;
@@ -1181,7 +1184,9 @@ declare function rng(seed?: number | string): () => number;
1181
1184
 
1182
1185
  /** True when an item of `size` [w, h, d] fits in a slot of `max`; width and depth may be swapped (the item is turned). */
1183
1186
  declare function fitsSize(size: Vec3, max: Vec3): boolean;
1184
- /** Does the item type fit the slot. Types missing from the catalog are accepted (the host owns unknown items). */
1187
+ /** An item's size [w, h, d] as it lies in a slot: on its side (`SlotSpec.lay`) its height runs along that axis and its depth (or width) stands up. */
1188
+ declare function laidSize(size: Vec3, lay: SlotSpec['lay']): Vec3;
1189
+ /** Does the item type fit the slot, as it lies there. Types missing from the catalog are accepted (the host owns unknown items). */
1185
1190
  declare function fitsSlot(type: string, slot: SlotSpec, items?: ItemCatalog): boolean;
1186
1191
  /**
1187
1192
  * Deterministic contents for a container: one entry per slot. A slot is filled with probability `fill`; the entry is a weighted pick
@@ -1596,4 +1601,4 @@ declare function createSinkRoutines(options: SinkUsesOptions): SinkRoutines;
1596
1601
  declare const GESTURE_OF_ACTION: Readonly<Record<Action['do'], BodyGesture | null>>;
1597
1602
  declare const GESTURE_OF_USE: Readonly<Record<UseSpec['do'], BodyGesture | null>>;
1598
1603
 
1599
- export { type Action, type ActiveEmitter, type BasinContent, type BasinContentInput, type BasinContentKind, type BasinContentSave, type BasinContentStage, type BasinDrain, type BasinDrainSave, type BasinDrainState, type BasinDrainStep, type BasinSpec, type BasinWater, type BowlSpec, type BurnerSpec, CLOGGED, COLLAR_REACH, CONTROLLED_OBJECT, type CastBox, type Chain, type ChainSpec, type ClogCause, type ColliderOptions, type ColliderSpec, type ContainerSpec, DRINK_HANDS_LITRES, DRINK_HANDS_LPS, DRINK_LITRES, DRINK_LPS, DRY_SECONDS, type DamageKind, type DamageSpec, type DestructionDelegate, type DestructionJoint, type DeviceKind, type DeviceSpec, type DrainPhase, type DrainSpec, type DrainUses, type DrainUsesOptions, type DrinkUseSpec, END_GAP, type EmitterBowl, type EmitterKind, type EmitterSpec, type EnginePartDriver, type EnginePartOptions, type EnginePartPhysics, FILL_SHARE, FLOW_DEFAULTS, FLUSH_POUR_SECONDS, FLUSH_RUN_SECONDS, type FixtureEmitters, type FixtureKind, type FixtureSpec, type FuelSourceSpec, GESTURE_OF_ACTION, GESTURE_OF_USE, type HangTailParams, type Interactable, type InteractablesLocale, type InteractionSpec, type ItemCatalog, type ItemDef, type ItemStack, type LootEntry, type LootTable, type LootTables, type MirrorSpec, type Motion, type MotionKind, type ObjectControls, type ObjectControlsOptions, type ObjectControlsState, type ObjectSpec, type PartDestruction, type PartDriver, type PartPhysics, type PartSpec, type PlungeUseSpec, type Pose, REACH_SECONDS, type Rect, type RelieveUseSpec, type RoutineEnd, type RunningEmitter, type SeatPose, type SeatResult, type SeatSpec, type SinkRoutine, type SinkRoutines, type SinkUseSpec, type SinkUsesOptions, type SinkVerdict, type SlotSpec, type SocketSpec, type SoftDriver, type SoftSpec, type Soil, type SolveSpanParams, type Span, type SpanMaterial, type SpanShape, type Strings, type SwitchSpec, type TankSpec, type TargetOptions, type Transform, type UseBody, type UseBodyPose, type UseNeed, type UseSpec, type UsesState, type Vec3, WASH_SCRUB_SECONDS, type WashDishesSpec, type WashUseSpec, type WireRun, type WireRunsParams, type World, type WorldCollider, type WorldEvent, type WorldObject, type WorldOptions, type WorldState, alignY, buildChain, castWithMember, chainPoints, createBasinDrain, createDrainUses, createEnginePartPhysics, createFixtureEmitters, createObjectControls, createSinkRoutines, createUseBody, createWorld, devicePointOf, dirtyDishes, disposeChain, endsMember, findNeeds, fitsInVolume, fitsSize, fitsSlot, fixtureFlowLps, format, generateLoot, hangTail, hashString, localToWorld, locales, mergeColliders, pickLocale, polylineLength, poseOf, resolveStrings, rng, rotY, rotateAxis, sinkVerdict, solveSpan, spanStrength, wireRuns, worldToLocal, wrapsMember };
1604
+ export { type Action, type ActiveEmitter, type BasinContent, type BasinContentInput, type BasinContentKind, type BasinContentSave, type BasinContentStage, type BasinDrain, type BasinDrainSave, type BasinDrainState, type BasinDrainStep, type BasinSpec, type BasinWater, type BowlSpec, type BurnerSpec, CLOGGED, COLLAR_REACH, CONTROLLED_OBJECT, type CastBox, type Chain, type ChainSpec, type ClogCause, type ColliderOptions, type ColliderSpec, type ContainerSpec, DRINK_HANDS_LITRES, DRINK_HANDS_LPS, DRINK_LITRES, DRINK_LPS, DRY_SECONDS, type DamageKind, type DamageSpec, type DestructionDelegate, type DestructionJoint, type DeviceKind, type DeviceSpec, type DrainPhase, type DrainSpec, type DrainUses, type DrainUsesOptions, type DrinkUseSpec, END_GAP, type EmitterBowl, type EmitterKind, type EmitterSpec, type EnginePartDriver, type EnginePartOptions, type EnginePartPhysics, FILL_SHARE, FLOW_DEFAULTS, FLUSH_POUR_SECONDS, FLUSH_RUN_SECONDS, type FixtureEmitters, type FixtureKind, type FixtureSpec, type FuelSourceSpec, GESTURE_OF_ACTION, GESTURE_OF_USE, type HangTailParams, type Interactable, type InteractablesLocale, type InteractionSpec, type ItemCatalog, type ItemDef, type ItemStack, type LootEntry, type LootTable, type LootTables, type MirrorSpec, type Motion, type MotionKind, type ObjectControls, type ObjectControlsOptions, type ObjectControlsState, type ObjectSpec, type PartDestruction, type PartDriver, type PartPhysics, type PartSpec, type PlungeUseSpec, type Pose, REACH_SECONDS, type Rect, type RelieveUseSpec, type RoutineEnd, type RunningEmitter, type SeatPose, type SeatResult, type SeatSpec, type SinkRoutine, type SinkRoutines, type SinkUseSpec, type SinkUsesOptions, type SinkVerdict, type SlotSpec, type SocketSpec, type SoftDriver, type SoftSpec, type Soil, type SolveSpanParams, type Span, type SpanMaterial, type SpanShape, type Strings, type SwitchSpec, type TankSpec, type TargetOptions, type Transform, type UseBody, type UseBodyPose, type UseNeed, type UseSpec, type UsesState, type Vec3, WASH_SCRUB_SECONDS, type WashDishesSpec, type WashUseSpec, type WireRun, type WireRunsParams, type World, type WorldCollider, type WorldEvent, type WorldObject, type WorldOptions, type WorldState, alignY, buildChain, castWithMember, chainPoints, createBasinDrain, createDrainUses, createEnginePartPhysics, createFixtureEmitters, createObjectControls, createSinkRoutines, createUseBody, createWorld, devicePointOf, dirtyDishes, disposeChain, endsMember, findNeeds, fitsInVolume, fitsSize, fitsSlot, fixtureFlowLps, format, generateLoot, hangTail, hashString, laidSize, localToWorld, locales, mergeColliders, pickLocale, polylineLength, poseOf, resolveStrings, rng, rotY, rotateAxis, sinkVerdict, solveSpan, spanStrength, wireRuns, worldToLocal, wrapsMember };
@@ -63,6 +63,7 @@ var GameInteractables = (() => {
63
63
  generateLoot: () => generateLoot,
64
64
  hangTail: () => hangTail,
65
65
  hashString: () => hashString,
66
+ laidSize: () => laidSize,
66
67
  localToWorld: () => localToWorld,
67
68
  locales: () => locales,
68
69
  mergeColliders: () => mergeColliders,
@@ -436,9 +437,14 @@ var GameInteractables = (() => {
436
437
  if (size[1] > max[1] + eps) return false;
437
438
  return size[0] <= max[0] + eps && size[2] <= max[2] + eps || size[2] <= max[0] + eps && size[0] <= max[2] + eps;
438
439
  }
440
+ function laidSize(size, lay) {
441
+ if (lay === "x") return [size[1], size[0], size[2]];
442
+ if (lay === "z") return [size[0], size[2], size[1]];
443
+ return size;
444
+ }
439
445
  function fitsSlot(type, slot, items) {
440
446
  const def = items?.[type];
441
- return def ? fitsSize(def.size, slot.max) : true;
447
+ return def ? fitsSize(laidSize(def.size, slot.lay), slot.max) : true;
442
448
  }
443
449
  function generateLoot(tables, tableId, slots, seed, items) {
444
450
  const table = tables?.[tableId];
@@ -528,6 +534,10 @@ var GameInteractables = (() => {
528
534
  "use.wash_dishes": "Wash the dishes",
529
535
  "use.drink_water": "Drink water from the glass",
530
536
  "use.drink_from_hands": "Drink water from your hands",
537
+ "use.lather_body": "Soap yourself",
538
+ "use.shampoo_hair": "Shampoo your hair",
539
+ "use.wash_hands": "Wash your hands",
540
+ "use.brush_teeth": "Brush your teeth",
531
541
  needs_in_hand: "Pick up {item} first",
532
542
  needs_vessel: "You need a glass",
533
543
  vessel_not_empty: "Empty {item} first",
@@ -617,6 +627,10 @@ var GameInteractables = (() => {
617
627
  "use.wash_dishes": "Lavar a lou\xE7a",
618
628
  "use.drink_water": "Beber \xE1gua no copo",
619
629
  "use.drink_from_hands": "Beber \xE1gua com a m\xE3o",
630
+ "use.lather_body": "Ensaboar-se",
631
+ "use.shampoo_hair": "Passar shampoo",
632
+ "use.wash_hands": "Lavar as m\xE3os",
633
+ "use.brush_teeth": "Escovar os dentes",
620
634
  needs_in_hand: "Pegue {item} antes",
621
635
  needs_vessel: "Precisa de um copo",
622
636
  vessel_not_empty: "Esvazie {item} antes",
@@ -2877,6 +2891,8 @@ var GameInteractables = (() => {
2877
2891
  };
2878
2892
  var MUST_DRAIN_QUEUE_IDS = /* @__PURE__ */ new Set([DEFERRED_QUEUE_ID.DESTRUCTION_EVENTS, DEFERRED_QUEUE_ID.BREACH_CUT]);
2879
2893
  var PLUNGE_STROKE_SECONDS = 0.8;
2894
+ var BODY_FOAM_SURFACES = ["hands", "arms", "torso", "hair", "mouth"];
2895
+ var WASH_SURFACES = [...BODY_FOAM_SURFACES, "brush"];
2880
2896
  var SURFACE_IDS = ["concrete", "asphalt", "wood", "tile", "dirt", "grass", "gravel", "sand", "metal", "water", "glass", "carpet"];
2881
2897
  var GAIT_IDS = ["walk", "run"];
2882
2898
  var LANDING_IDS = ["light", "heavy"];
@@ -3290,7 +3306,14 @@ var GameInteractables = (() => {
3290
3306
  };
3291
3307
  const tap = tapPhases(use);
3292
3308
  const dosed = use.dose ? items[use.dose.need] : void 0;
3293
- const dose = () => {
3309
+ const waterForDose = waterOf(use);
3310
+ const dose = (dt) => {
3311
+ const flow = waterForDose(dt);
3312
+ if (flow === null) {
3313
+ fail({ key: "no_water", ok: false });
3314
+ return true;
3315
+ }
3316
+ if (flow <= 0) return false;
3294
3317
  if (dosed && body.takeDose?.(dosed.objectId, use.dose?.amount).taken === 0) fail({ key: "item_spent", ok: false, vars: { item: dosed.name } });
3295
3318
  return true;
3296
3319
  };