@adatechnology/game-vehicles 0.7.1 → 0.8.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,6 +1,20 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1
+ import {
2
+ FLAT_PAD,
3
+ FLOATING_AREA,
4
+ MAX_HULL_POINTS,
5
+ __publicField,
6
+ convexFaces,
7
+ hullOf,
8
+ hullPlanKind,
9
+ hullVolume,
10
+ leavesOf,
11
+ newHullPlan,
12
+ planDivision,
13
+ planHulls,
14
+ protrusionsOf,
15
+ reducePoints,
16
+ unitsOf
17
+ } from "./chunk-AQFQ246K.js";
4
18
 
5
19
  // src/kit.ts
6
20
  import { shapeGeometries } from "@adatechnology/game-shapes-three";
@@ -12847,6 +12861,9 @@ var VehicleVisuals = class {
12847
12861
  /** Hinged panels created for the doors and the lid, by part id. */
12848
12862
  __publicField(this, "plates", /* @__PURE__ */ new Map());
12849
12863
  __publicField(this, "gone", /* @__PURE__ */ new Set());
12864
+ /** Where a part that comes off goes instead of the fling (a physics engine takes it as a body); null: the fling. */
12865
+ __publicField(this, "sink", null);
12866
+ __publicField(this, "detaching", null);
12850
12867
  /** Shows or hides the plate and the recess of a door or lid by its state (see `showWhenOpen`). */
12851
12868
  __publicField(this, "syncPlates", /* @__PURE__ */ new Map());
12852
12869
  /** Doors and lids whose own skin was cut from the body and hung on the hinge (true), or that had none to take and keep the plate (false). */
@@ -14120,10 +14137,29 @@ var VehicleVisuals = class {
14120
14137
  }
14121
14138
  fling(obj, v, w, trail) {
14122
14139
  const piece = this.I.fling(this.c, obj, v, w);
14123
- if (piece) piece.trail = trail;
14140
+ if (!piece) return;
14141
+ if (!this.sink || !this.detaching) {
14142
+ piece.trail = trail;
14143
+ return;
14144
+ }
14145
+ if (!this.sink(this.detaching, piece.o, [v.x, v.y, v.z], [w.x, w.y, w.z])) {
14146
+ piece.trail = trail;
14147
+ return;
14148
+ }
14149
+ const flying = this.c.flying;
14150
+ const at = flying ? flying.indexOf(piece) : -1;
14151
+ if (flying && at >= 0) flying.splice(at, 1);
14124
14152
  }
14125
14153
  /** Brings a part off the vehicle and throws it. Returns whether something visible moved. */
14126
14154
  detach(p, o) {
14155
+ this.detaching = p;
14156
+ try {
14157
+ return this.detachPart(p, o);
14158
+ } finally {
14159
+ this.detaching = null;
14160
+ }
14161
+ }
14162
+ detachPart(p, o) {
14127
14163
  if (this.gone.has(p.id)) return false;
14128
14164
  const V3 = this.THREE.Vector3;
14129
14165
  const c = this.c;
@@ -15470,6 +15506,9 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
15470
15506
  return d ? toWorld(d.box.center) : [0, 0, 0];
15471
15507
  },
15472
15508
  rollover,
15509
+ setPartSink: (sink) => {
15510
+ if (vis) vis.sink = sink;
15511
+ },
15473
15512
  detachedParts: () => [...ps.values()].filter((p) => !p.lost && !attached(p.def.id) || p.lost && p.def.visual && js.some((j) => j.open && j.def.a === p.def.id)).map((p) => p.def.id)
15474
15513
  };
15475
15514
  return impl;
@@ -15921,9 +15960,12 @@ export {
15921
15960
  DOOR_SHELL_DEPTH,
15922
15961
  DOOR_SHELL_MAX_DEPTH,
15923
15962
  ENTRY_DUCK_FACTOR,
15963
+ FLAT_PAD,
15964
+ FLOATING_AREA,
15924
15965
  JOINT_RULES,
15925
15966
  LEGACY_STATES,
15926
15967
  LEGACY_ZONE_IDS,
15968
+ MAX_HULL_POINTS,
15927
15969
  PLUME_PUFFS,
15928
15970
  RAIN_MOVE_STEP,
15929
15971
  RAIN_OPENING_DIAMETER,
@@ -15939,6 +15981,7 @@ export {
15939
15981
  cabinEnclosure,
15940
15982
  cabinMinimumOf,
15941
15983
  clamp,
15984
+ convexFaces,
15942
15985
  crackedGlassMaterial,
15943
15986
  crashDeltaV,
15944
15987
  crashVehicle,
@@ -15954,11 +15997,20 @@ export {
15954
15997
  engineBayVent,
15955
15998
  format,
15956
15999
  hash,
16000
+ hullOf,
16001
+ hullPlanKind,
16002
+ hullVolume,
16003
+ leavesOf,
15957
16004
  legacyGlassId,
15958
16005
  legacyLightId,
15959
16006
  legacyZoneId,
15960
16007
  listLocales,
16008
+ newHullPlan,
15961
16009
  openEdgeCount,
16010
+ planDivision,
16011
+ planHulls,
16012
+ protrusionsOf,
16013
+ reducePoints,
15962
16014
  registerLegacySeeds,
15963
16015
  registerLocale,
15964
16016
  resolveStrings,
@@ -15970,6 +16022,7 @@ export {
15970
16022
  strHash,
15971
16023
  strayLampsOf,
15972
16024
  swingOf,
16025
+ unitsOf,
15973
16026
  wrapThreeForLod
15974
16027
  };
15975
16028
  //# sourceMappingURL=index.js.map