@adatechnology/game-interactables-household 0.4.0 → 0.5.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
@@ -63,6 +63,13 @@ interface HouseholdTypeDef {
63
63
  * two tonnes): a host that builds a physical body splits this mass over the pieces. Absent for what is built into the ground (a fireplace, a well).
64
64
  */
65
65
  massKg?: number;
66
+ /**
67
+ * How its doors and lids sound worked by hand: a sound set by leaf part, `*` for all (`fridge`, `microwave`, `drawer`, `wood_door`, `metal_door`: the sets of
68
+ * game-audio `LEAF_FOLEY_SETS`). Absent: the host picks by the leaf's material. A host hands it on as `TestableItem.sounds`.
69
+ */
70
+ sounds?: {
71
+ readonly leaves?: Readonly<Record<string, string>>;
72
+ };
66
73
  }
67
74
  interface HouseholdType extends HouseholdTypeDef {
68
75
  /** Localized display name. */
@@ -34,6 +34,7 @@ var GameInteractablesHousehold = (() => {
34
34
  });
35
35
 
36
36
  // ../game-contracts/dist/index.js
37
+ var DEFAULT_COST_ALLOCATION_BYTES = 1024 * 1024;
37
38
  var STRUCTURE_ROLES = ["foundation", "column", "beam", "slab", "wall", "partition", "roof", "stair", "none"];
38
39
  var BEARS = [true, false, "a_on_b", "b_on_a"];
39
40
  var finite = (n) => typeof n === "number" && Number.isFinite(n);
@@ -136,6 +137,38 @@ var GameInteractablesHousehold = (() => {
136
137
  }
137
138
  return { ok: problems.length === 0, problems, warnings };
138
139
  };
140
+ var DEFERRED_QUEUE_ID = {
141
+ DESTRUCTION_EVENTS: "destruction.events",
142
+ BREACH_PAINT: "floorplan.breach-paint",
143
+ AUDIO_VOICES: "audio.voices",
144
+ VEHICLE_CREASE: "vehicles.crease"
145
+ };
146
+ var DEFERRED_PRIORITY = {
147
+ [DEFERRED_QUEUE_ID.DESTRUCTION_EVENTS]: { priority: 300, phase: "present" },
148
+ [DEFERRED_QUEUE_ID.BREACH_PAINT]: { priority: 250, phase: "present" },
149
+ [DEFERRED_QUEUE_ID.AUDIO_VOICES]: { priority: 200, phase: "idle", reserveMs: 1 },
150
+ [DEFERRED_QUEUE_ID.VEHICLE_CREASE]: { priority: 100, phase: "idle" }
151
+ };
152
+ var WARNED_KEY = /* @__PURE__ */ Symbol.for("@adatechnology/game-contracts.warned");
153
+ var warnedKeys = () => {
154
+ const holder = globalThis;
155
+ return holder[WARNED_KEY] ?? (holder[WARNED_KEY] = /* @__PURE__ */ new Set());
156
+ };
157
+ var isProduction = () => {
158
+ try {
159
+ return process.env.NODE_ENV === "production";
160
+ } catch {
161
+ return false;
162
+ }
163
+ };
164
+ var isQuiet = () => globalThis.__GAME_KIT_QUIET__ === true;
165
+ var warnOnce = (key, message) => {
166
+ if (isQuiet() || isProduction()) return;
167
+ const seen = warnedKeys();
168
+ if (seen.has(key)) return;
169
+ seen.add(key);
170
+ console.warn(`[game-kit] ${message}`);
171
+ };
139
172
  var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
140
173
  var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
141
174
  var deepMerge = (base, patch) => {
@@ -157,10 +190,13 @@ var GameInteractablesHousehold = (() => {
157
190
  for (const [id, patch] of Object.entries(patches ?? {})) {
158
191
  const entry = entries.get(id);
159
192
  if (entry) entries.set(id, deepMerge(entry, patch));
193
+ else warnOnce(`registry.patch.${id}`, `patch for "${id}" ignored: no entry has that id`);
160
194
  }
161
195
  };
162
196
  var removeIds = (entries, ids) => {
163
- for (const id of ids ?? []) entries.delete(id);
197
+ for (const id of ids ?? []) {
198
+ if (!entries.delete(id)) warnOnce(`registry.remove.${id}`, `remove of "${id}" ignored: no entry has that id`);
199
+ }
164
200
  };
165
201
  var defineCategories = (defs, options = {}) => {
166
202
  const problems = [];
@@ -224,6 +260,42 @@ var GameInteractablesHousehold = (() => {
224
260
  };
225
261
  return registry;
226
262
  };
263
+ var SURFACE_IDS = ["concrete", "asphalt", "wood", "tile", "dirt", "grass", "gravel", "sand", "metal", "water", "glass", "carpet"];
264
+ var GAIT_IDS = ["walk", "run"];
265
+ var LANDING_IDS = ["light", "heavy"];
266
+ var BODY_SOUND_IDS = [
267
+ "jump",
268
+ "cloth_rustle",
269
+ "body_fall",
270
+ "fall_damage",
271
+ "player_hurt",
272
+ "player_breath_run",
273
+ "player_death",
274
+ "bite",
275
+ "grab",
276
+ "punch_swing",
277
+ "punch_hit_body",
278
+ "punch_hit_face",
279
+ "punch_hit_object",
280
+ "kick_swing",
281
+ "kick_hit",
282
+ "kick_hit_object",
283
+ "shove_two_hands",
284
+ "knife_swing",
285
+ "knife_stab",
286
+ "knife_slash",
287
+ "knife_hit_object",
288
+ "blunt_swing",
289
+ "blunt_hit",
290
+ "blunt_hit_object",
291
+ "axe_swing",
292
+ "axe_chop",
293
+ "axe_hit_object"
294
+ ];
295
+ var footstepSoundId = (surface, gait) => `footstep_${surface}_${gait}`;
296
+ var FOOTSTEP_SOUND_IDS = SURFACE_IDS.flatMap((surface) => GAIT_IDS.map((gait) => footstepSoundId(surface, gait)));
297
+ var LAND_SOUND_IDS = SURFACE_IDS.flatMap((surface) => LANDING_IDS.map((landing) => `land_${surface}_${landing}`));
298
+ var BODY_FOLEY_IDS = [...FOOTSTEP_SOUND_IDS, ...LAND_SOUND_IDS, ...BODY_SOUND_IDS];
227
299
 
228
300
  // ../game-items-goods/dist/index.js
229
301
  var FLOORPLAN_POOL_KEYS = {
@@ -20324,7 +20396,12 @@ var GameInteractablesHousehold = (() => {
20324
20396
  y: 0,
20325
20397
  solid: true,
20326
20398
  pushable: true,
20327
- massKg: 70
20399
+ massKg: 70,
20400
+ sounds: {
20401
+ leaves: {
20402
+ "*": "fridge"
20403
+ }
20404
+ }
20328
20405
  },
20329
20406
  {
20330
20407
  id: "fridge_compact",
@@ -20335,7 +20412,12 @@ var GameInteractablesHousehold = (() => {
20335
20412
  y: 0,
20336
20413
  solid: true,
20337
20414
  pushable: true,
20338
- massKg: 30
20415
+ massKg: 30,
20416
+ sounds: {
20417
+ leaves: {
20418
+ "*": "fridge"
20419
+ }
20420
+ }
20339
20421
  },
20340
20422
  {
20341
20423
  id: "kitchen_cabinet_base",
@@ -20561,7 +20643,12 @@ var GameInteractablesHousehold = (() => {
20561
20643
  h: 0.3,
20562
20644
  y: 0.9,
20563
20645
  solid: false,
20564
- massKg: 14
20646
+ massKg: 14,
20647
+ sounds: {
20648
+ leaves: {
20649
+ "*": "microwave"
20650
+ }
20651
+ }
20565
20652
  },
20566
20653
  {
20567
20654
  id: "washing_machine",