@adatechnology/game-interactables-household 0.7.6 → 0.8.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.js CHANGED
@@ -16,6 +16,7 @@ var fridgeLike = { body: { material: "steel", joint: "weld" }, parts: [[/^door/,
16
16
  var bin = { body: { material: "plastic", joint: "fused" }, parts: [["lid", door("plastic", "hinge", "lid")]] };
17
17
  var upholstery = { material: "fabric", joint: "glue" };
18
18
  var POLE_CAGE = { material: "steel", spacing: 0.1, diameter: 0.01 };
19
+ var BRICKWORK = { size: [0.23, 0.075, 0.11], bond: "running", mortar: "mortar" };
19
20
  var DESTRUCTION = {
20
21
  fridge: fridgeLike,
21
22
  fridge_compact: fridgeLike,
@@ -71,13 +72,13 @@ var DESTRUCTION = {
71
72
  parts: [["flap", door("steel", "hinge", "flap")], ["flag", { material: "steel", joint: "hinge", piece: "flag" }]]
72
73
  },
73
74
  dog_house: { body: { material: "plywood", joint: "nail" }, parts: [] },
74
- bbq: { body: { material: "brick", joint: "mortar" }, parts: [["counter_door", door("steel")]] },
75
+ bbq: { body: { material: "brick", joint: "mortar", units: BRICKWORK }, parts: [["counter_door", door("steel")]] },
75
76
  bunk_bed: { body: { material: "wood_soft", joint: "screw" }, parts: [] },
76
77
  wood_stove: {
77
78
  body: { material: "cast_iron", joint: "bolt" },
78
79
  parts: [["firebox_door", { material: "cast_iron", joint: "hinge", piece: "door" }]]
79
80
  },
80
- fireplace: { body: { material: "brick", joint: "mortar" }, parts: [] },
81
+ fireplace: { body: { material: "brick", joint: "mortar", units: BRICKWORK }, parts: [] },
81
82
  outhouse: {
82
83
  body: { material: "wood_soft", joint: "nail" },
83
84
  parts: [["door", door("wood_soft", "hinge", "door")], ["seat_lid", door("wood_soft", "hinge", "lid")]]
@@ -435,7 +436,13 @@ var Ctx = class {
435
436
  this.collider("body", -this.hw, this.y0, -this.hd, this.hw, this.y0 + this.h, this.hd);
436
437
  }
437
438
  const body = DESTRUCTION[this.type]?.body;
438
- if (body && !this.spec.destruction) this.spec.destruction = body.reinforcement ? { ...body, reinforcement: { ...body.reinforcement } } : { ...body };
439
+ if (body && !this.spec.destruction) {
440
+ this.spec.destruction = {
441
+ ...body,
442
+ ...body.reinforcement ? { reinforcement: { ...body.reinforcement } } : {},
443
+ ...body.units ? { units: { ...body.units, size: [...body.units.size] } } : {}
444
+ };
445
+ }
439
446
  for (const k of Object.keys(s)) if (Array.isArray(s[k]) && s[k].length === 0) delete s[k];
440
447
  return this.spec;
441
448
  }
@@ -1329,6 +1336,11 @@ var en_default = {
1329
1336
  "prompt.glass_door.open": "Close the glass door",
1330
1337
  "prompt.glass_door.closed": "Open the glass door",
1331
1338
  "prompt.flush": "Flush",
1339
+ "prompt.flush.off": "Flush",
1340
+ "prompt.flush.on": "Flushing",
1341
+ "program.wash": "Wash",
1342
+ "program.dry": "Spin-dry",
1343
+ "use.grill": "Put {item} on the grill",
1332
1344
  "prompt.toilet_lid": "Toilet lid",
1333
1345
  "prompt.toilet_lid.open": "Close the lid",
1334
1346
  "prompt.toilet_lid.closed": "Lift the lid",
@@ -1574,6 +1586,11 @@ var pt_BR_default = {
1574
1586
  "prompt.glass_door.open": "Fechar a porta de vidro",
1575
1587
  "prompt.glass_door.closed": "Abrir a porta de vidro",
1576
1588
  "prompt.flush": "Descarga",
1589
+ "prompt.flush.off": "Dar a descarga",
1590
+ "prompt.flush.on": "Descarga correndo",
1591
+ "program.wash": "Lavar",
1592
+ "program.dry": "Secar",
1593
+ "use.grill": "P\xF4r {item} na grelha",
1577
1594
  "prompt.toilet_lid": "Tampa do vaso",
1578
1595
  "prompt.toilet_lid.open": "Fechar a tampa",
1579
1596
  "prompt.toilet_lid.closed": "Levantar a tampa",
@@ -2207,7 +2224,8 @@ var types_default = [
2207
2224
  h: 1.3,
2208
2225
  y: 0,
2209
2226
  solid: true,
2210
- massKg: 6
2227
+ massKg: 6,
2228
+ fixed: true
2211
2229
  },
2212
2230
  {
2213
2231
  id: "dog_house",
@@ -2528,6 +2546,7 @@ function plugged(c, id, kind, watts, plug, o = {}) {
2528
2546
  if (o.part) dev.part = o.part;
2529
2547
  if (o.channels) dev.channels = o.channels;
2530
2548
  if (o.fixture) dev.fixture = o.fixture;
2549
+ if (o.display) dev.display = o.display;
2531
2550
  c.add("devices", dev);
2532
2551
  const floor = c.y0 + 0.01;
2533
2552
  c.add("wires", {
@@ -2724,7 +2743,7 @@ function tv(c) {
2724
2743
  c.part("power", [bx, py + 5e-3, -0.02 + bz], { kind: "rocker", axis: [1, 0, 0], angle: 0.2 }, () => {
2725
2744
  c.b("plain", bx - 0.01, py - 8e-3, -0.02 + bz - 4e-3, bx + 0.01, py + 2e-3, -0.02 + bz + 6e-3, 3816512);
2726
2745
  }, { label: "prompt.tv_power", at: false, noSweep: true, radius: 1.2 });
2727
- plugged(c, "tv", "screen", 90, [hw * 0.5, py + 0.1, -0.02 - 0.03], { part: "power", channels: 6, on: c.M.on });
2746
+ plugged(c, "tv", "screen", 90, [hw * 0.5, py + 0.1, -0.02 - 0.03], { part: "power", channels: 6, on: c.M.on, display: { center: [0, round3(py + ph / 2), round3(-0.02 + bz + 5e-3)], w: round3(w - 0.05), h: round3(ph - 0.05) } });
2728
2747
  c.interact("use_tv", [0, py + ph / 2, hd], { do: "toggle_device", device: "tv" }, "prompt.tv", 2.5);
2729
2748
  c.interact("channel_tv", [hw * 0.5, py + ph * 0.5, hd], { do: "cycle_device", device: "tv" }, "prompt.tv_channel", 2.5);
2730
2749
  }
@@ -2770,6 +2789,8 @@ function microwave(c) {
2770
2789
  plugged(c, "microwave", "appliance", 1200, [hw * 0.5, y0 + 0.08, -hd], { part: "dial", on: c.M.on });
2771
2790
  c.interact("use_microwave", [hw - 0.07, y0 + 0.07, zf + 0.03], { do: "toggle_device", device: "microwave" }, "prompt.microwave", 1.2);
2772
2791
  }
2792
+ var WASH_SECONDS = 90;
2793
+ var DRY_SECONDS = 60;
2773
2794
  function washingMachine(c) {
2774
2795
  const { hw, hd, h } = c;
2775
2796
  const body = c.main(15790835);
@@ -2811,7 +2832,14 @@ function washingMachine(c) {
2811
2832
  );
2812
2833
  c.add("fixtures", { id: "inlet", kind: "hose", outlet: [round3(-hw * 0.6), 0.2, -hd], dir: [0, 0, -1], flow: 12 });
2813
2834
  plugged(c, "washer", "appliance", 500, [hw * 0.5, 0.15, -hd], { part: "dial", on: c.M.on, fixture: "inlet" });
2835
+ c.add("devices", { id: "dryer", kind: "heater", watts: 2e3, socket: "auto", plug: [hw * 0.5, 0.15, -hd] });
2814
2836
  c.interact("use_washer", [0.04, h - 0.07, zf + 0.03], { do: "toggle_device", device: "washer" }, "prompt.washing_machine", 1.2);
2837
+ const drumZ = zf - 0.26;
2838
+ const inner = R - 0.02;
2839
+ c.container({ id: "drum", access: "door", from: [-inner, cy - inner, drumZ - 0.22], to: [inner, cy + inner, drumZ + 0.22], slots: [{ pos: [0, round3(cy - inner), round3(drumZ)], max: [round3(inner * 1.4), round3(inner * 1.4), 0.4] }] });
2840
+ c.add("uses", { id: "wash", do: "program", device: "washer", seconds: WASH_SECONDS, label: "program.wash", access: "door" });
2841
+ c.add("uses", { id: "dry", do: "program", device: "dryer", seconds: DRY_SECONDS, label: "program.dry", access: "door" });
2842
+ c.add("uses", { id: "load", do: "put_in", container: "drum", label: "use.put_in" });
2815
2843
  }
2816
2844
  function electricalPanel(c) {
2817
2845
  const { hw, hd, h, y0 } = c;
@@ -3204,6 +3232,7 @@ function utilitySink(c) {
3204
3232
  tap2(c, 0, tubTop + 0.08, -hd + 0.08, "tap", "tap_handle", tub);
3205
3233
  c.add("fixtures", { id: "basin", kind: "utility_sink", outlet: [0, round3(tubTop - 0.1), 0], dir: [0, -1, 0], flow: 12, tank: "auto" });
3206
3234
  }
3235
+ var SHOWER_DOOR = 0.72;
3207
3236
  function shower(c) {
3208
3237
  const { hw, hd, h } = c;
3209
3238
  const tile = c.main(15133162);
@@ -3237,28 +3266,30 @@ function shower(c) {
3237
3266
  c.add("emitters", { id: "shower_steam", kind: "steam", pos: [0, 1.4, 0], dir: [0, 1, 0], source: "shower", size: 0.8 });
3238
3267
  c.interact("use_shower", [0.25, 1.1, -hd + 0.08], { do: "toggle_fixture", fixture: "shower" }, "prompt.shower", 1.3);
3239
3268
  const gl = 12573670;
3240
- const zFixed = hd - 0.015;
3241
- const zSlide = hd - 0.04;
3269
+ const zFront = hd - 0.015;
3242
3270
  const gh = h - 0.1;
3243
3271
  const gy = 0.075;
3244
- c.b("glass", -hw + 0.03, gy, zFixed - 4e-3, 0.02, gy + gh, zFixed + 4e-3, gl);
3272
+ const dx1 = hw - 0.034;
3273
+ const hingeX = round3(Math.max(-hw + 0.05, dx1 - SHOWER_DOOR));
3274
+ const dw = dx1 - hingeX;
3275
+ if (hingeX - (-hw + 0.03) > 0.02) {
3276
+ c.b("glass", -hw + 0.03, gy, zFront - 4e-3, hingeX - 4e-3, gy + gh, zFront + 4e-3, gl);
3277
+ c.add("soft", { id: "glass_fixed", kind: "panel", anchor: [round3((-hw + 0.03 + hingeX) / 2), round3(gy + gh), zFront], size: [round3(hingeX + hw - 0.03), round3(gh), 0.01], stiffness: 18, damping: 6, maxAngle: 0.2, wind: 0 });
3278
+ }
3245
3279
  c.b("glass", hw - 0.032, gy, -hd + 0.03, hw - 0.024, gy + gh, hd - 0.05, gl);
3246
- const dw = (hw - 0.03) * 0.55 + 0.02;
3247
- const dx1 = hw - 0.03;
3248
3280
  c.part(
3249
3281
  "glass_door",
3250
- [dx1 - dw / 2, gy, zSlide],
3251
- { kind: "slide", axis: [-1, 0, 0], distance: round3(dw - 0.06) },
3282
+ [hingeX, gy, zFront],
3283
+ { kind: "hinge", axis: [0, 1, 0], angle: -1.6 },
3252
3284
  () => {
3253
- c.b("glass", dx1 - dw + 2e-3, gy + 2e-3, zSlide - 4e-3, dx1 - 2e-3, gy + gh - 2e-3, zSlide + 4e-3, gl);
3254
- c.b("metal", dx1 - dw, gy, zSlide - 8e-3, dx1, gy + 0.015, zSlide + 8e-3, 12896460);
3255
- c.b("metal", dx1 - dw, gy + gh - 0.015, zSlide - 8e-3, dx1, gy + gh, zSlide + 8e-3, 12896460);
3256
- c.b("metal", dx1 - dw, gy + gh * 0.45, zSlide + 4e-3, dx1 - dw + 0.02, gy + gh * 0.45 + 0.3, zSlide + 0.024, 12896460);
3285
+ c.b("glass", hingeX + 2e-3, gy + 2e-3, zFront - 4e-3, dx1 - 2e-3, gy + gh - 2e-3, zFront + 4e-3, gl);
3286
+ c.b("metal", hingeX, gy, zFront - 8e-3, dx1, gy + 0.015, zFront + 8e-3, 12896460);
3287
+ c.b("metal", hingeX, gy + gh - 0.015, zFront - 8e-3, dx1, gy + gh, zFront + 8e-3, 12896460);
3288
+ c.b("metal", dx1 - 0.04, gy + gh * 0.45, zFront + 8e-3, dx1 - 0.02, gy + gh * 0.45 + 0.3, zFront + 0.028, 12896460);
3257
3289
  },
3258
- { label: "prompt.glass_door", at: [dx1 - dw / 2, 1, zSlide + 0.03] }
3290
+ { label: "prompt.glass_door", at: [round3(dx1 - 0.03), 1, round3(zFront + 0.03)] }
3259
3291
  );
3260
- c.add("soft", { id: "glass_door", kind: "panel", anchor: [round3(dx1 - dw / 2), round3(gy + gh), zSlide], size: [round3(dw), round3(gh), 0.01], stiffness: 18, damping: 6, maxAngle: 0.35, wind: 0, part: "glass_door" });
3261
- c.add("soft", { id: "glass_fixed", kind: "panel", anchor: [round3((-hw + 0.03 + 0.02) / 2), round3(gy + gh), zFixed], size: [round3(hw + 0.02 - 0.03), round3(gh), 0.01], stiffness: 18, damping: 6, maxAngle: 0.2, wind: 0 });
3292
+ c.add("soft", { id: "glass_door", kind: "panel", anchor: [round3((hingeX + dx1) / 2), round3(gy + gh), zFront], size: [round3(dw), round3(gh), 0.01], stiffness: 18, damping: 6, maxAngle: 0.35, wind: 0, part: "glass_door" });
3262
3293
  c.add("damage", { target: "glass_door", kind: "glass", hp: 25 });
3263
3294
  c.spec.colliders = [];
3264
3295
  c.collider("wall_back", -hw, 0, -hd, hw, h, -hd + 0.03);
@@ -3317,9 +3348,11 @@ function toilet(c) {
3317
3348
  },
3318
3349
  { label: "prompt.flush", at: false, noSweep: true }
3319
3350
  );
3320
- c.add("fixtures", { id: "flush", kind: "flush", outlet: [0, 0.36, BOWL_Z], dir: [0, -1, 0], volume: 6, part: "flush_button", tank: "auto" });
3321
- const bowl = { id: "bowl", from: [-0.12, 0.26, BOWL_Z - 0.12], to: [0.12, 0.36, BOWL_Z + 0.12], shape: "round" };
3351
+ c.add("fixtures", { id: "flush", kind: "flush", outlet: [0, 0.36, BOWL_Z], dir: [0, -1, 0], volume: 6, part: "flush_button", tank: "auto", cleans: "bowl" });
3352
+ const bowl = { id: "bowl", from: [-0.12, 0.26, BOWL_Z - 0.12], to: [0.12, 0.36, BOWL_Z + 0.12], shape: "round", soils: true };
3322
3353
  c.add("basins", bowl);
3354
+ c.add("uses", { id: "pee", do: "relieve", basin: "bowl", kind: "urine", label: "use.relieve.urine" });
3355
+ c.add("uses", { id: "poo", do: "relieve", basin: "bowl", kind: "feces", label: "use.relieve.feces" });
3323
3356
  const rim = [0, 0.385, BOWL_Z];
3324
3357
  c.add("emitters", { id: "flush_water", kind: "water", pos: rim, dir: [0, -1, 0], source: "flush", size: 0.08, ...streamInto(bowl, rim) });
3325
3358
  c.interact("use_flush", [0, ty + th + 0.05, -hd + 0.1], { do: "toggle_fixture", fixture: "flush" }, "prompt.flush");
@@ -4290,6 +4323,9 @@ function bbq(c) {
4290
4323
  ...c.row(lx0 + 0.01, lx1 - 0.01, 0.416, zc, 2, [0.17, topC - 0.12 - 0.416 - 0.02, 0.4])
4291
4324
  ];
4292
4325
  c.container({ id: "counter", access: "counter_door", from: [lx0, 0.05, lz0], to: [lx1, topC - 0.12, lz1], slots, loot: "bbq_counter" });
4326
+ const grateZ = (iz0 + iz1) / 2;
4327
+ c.container({ id: "grate", from: [ix0 + 0.02, gy + 8e-3, iz0 + 0.02], to: [ix1 - 0.02, gy + 0.2, iz1 - 0.02], slots: c.row(ix0 + 0.06, ix1 - 0.06, gy + 8e-3, grateZ, 3, [0.18, 0.15, round3(iz1 - iz0 - 0.06)]) });
4328
+ c.add("uses", { id: "grill", do: "put_in", container: "grate", label: "use.grill" });
4293
4329
  c.add("fuels", { id: "charcoal", kind: "charcoal", capacity: 4, level: 4 });
4294
4330
  const bed = [round3((ix0 + ix1) / 2), round3(bedY + 0.05), round3((iz0 + iz1) / 2)];
4295
4331
  c.add("burners", { id: "coal", pos: bed, fuel: "charcoal", rate: 4e-4, needsIgnition: true });
@@ -5114,6 +5150,8 @@ function trashBin(c) {
5114
5150
  c.b("plain", -0.05, hy - 0.01, -hd - 4e-3, 0.05, hy + 0.03, -hd + 0.03, 1974306);
5115
5151
  const slots = [...trashSlots(c, b, 2, 2, 0.28), ...trashSlots(c, { ...b, iy0: b.iy0 + 0.22 }, 2, 1, 0.2)];
5116
5152
  c.container({ id: "bin", access: "lid", from: [b.ix0, b.iy0, b.iz0], to: [b.ix1, rim, b.iz1], slots, loot: "trash" });
5153
+ c.add("uses", { id: "throw", do: "put_in", container: "bin", label: "use.put_in" });
5154
+ c.add("uses", { id: "empty", do: "empty", container: "bin", label: "use.empty" });
5117
5155
  c.add("damage", { target: "self", kind: "plastic", hp: 40 });
5118
5156
  }
5119
5157
  function wheelieBin(c) {
@@ -5153,6 +5191,8 @@ function wheelieBin(c) {
5153
5191
  );
5154
5192
  const slots = [...trashSlots(c, b, 2, 3, 0.4), ...trashSlots(c, { ...b, iy0: b.iy0 + 0.3 }, 2, 2, 0.3)];
5155
5193
  c.container({ id: "bin", access: "lid", from: [b.ix0, b.iy0, b.iz0], to: [b.ix1, rim, b.iz1], slots, loot: "trash" });
5194
+ c.add("uses", { id: "throw", do: "put_in", container: "bin", label: "use.put_in" });
5195
+ c.add("uses", { id: "empty", do: "empty", container: "bin", label: "use.empty" });
5156
5196
  c.add("damage", { target: "self", kind: "plastic", hp: 60 });
5157
5197
  }
5158
5198
  function mailbox(c) {
@@ -5301,11 +5341,18 @@ function dogHouse(c) {
5301
5341
  c.b("wood", -0.03, top - 5e-3, rz0 - 0.01, 0.03, top + roofT / 2 / cos + 0.012, rz1 + 0.01, shade(roofCol, 0.7));
5302
5342
  c.b("fabric", x0 + t + 0.03, y0 + 0.014, z0 + t + 0.03, x1 - t - 0.03, y0 + 0.07, z1 - t - 0.2, c.accent(4876954));
5303
5343
  c.b("fabric", x0 + t + 0.05, y0 + 0.07, z0 + t + 0.05, x1 - t - 0.05, y0 + 0.075, z1 - t - 0.22, mix(c.accent(4876954), 16777215, 0.15));
5304
- if (c.M.variant !== "no_bowl") {
5305
- const bx = x1 - 0.1;
5306
- const bz = z1 + 0.11;
5307
- c.cyl("metal", bx, 0, bz, 0.085, 0.045, 11843772, "cyl");
5308
- c.cyl("plain", bx, 0.045, bz, 0.07, 4e-3, 8018480, "cyl");
5344
+ if (c.M.variant !== "no_bowl") dogBowls(c, x0, x1, z1 + 0.11);
5345
+ }
5346
+ var DOG_BOWL = { radius: 0.085, height: 0.045, inner: 0.07, food: 0.3, water: 0.8 };
5347
+ function dogBowls(c, x0, x1, bz) {
5348
+ const bowls = [
5349
+ { id: "food", holds: "food", x: x1 - 0.1, accepts: ["dog_food"], capacity: DOG_BOWL.food },
5350
+ { id: "water", holds: "water", x: x0 + 0.1, capacity: DOG_BOWL.water }
5351
+ ];
5352
+ for (const b of bowls) {
5353
+ c.cyl("metal", b.x, 0, bz, DOG_BOWL.radius, DOG_BOWL.height, 11843772, "cyl");
5354
+ c.add("bowls", { id: b.id, holds: b.holds, capacity: b.capacity, center: [round3(b.x), DOG_BOWL.height, round3(bz)], radius: DOG_BOWL.inner, depth: 0.012, ...b.accepts ? { accepts: b.accepts } : {} });
5355
+ c.add("uses", { id: `fill_${b.id}`, do: "fill", bowl: b.id, label: "use.fill" });
5309
5356
  }
5310
5357
  }
5311
5358