@adatechnology/game-weapons-three 0.25.0 → 0.26.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/README.md +3 -2
- package/dist/{chunk-DCMD54HC.js → chunk-CGGF5CDD.js} +27 -2
- package/dist/{chunk-DCMD54HC.js.map → chunk-CGGF5CDD.js.map} +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.global.js +29 -3
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ interface ProjectileModel {
|
|
|
79
79
|
*/
|
|
80
80
|
declare function projectileModel(THREE: typeof THREE_NS, query: ProjectileQuery): ProjectileModel | null;
|
|
81
81
|
|
|
82
|
-
/** Rolling resistance of the kit's round loose pieces (a casing) on a hard floor: the C_rr the gate-0 B2 run settled on. */
|
|
82
|
+
/** Rolling resistance of the kit's round loose pieces (a casing, a grenade) on a hard floor: the C_rr the gate-0 B2 run settled on. */
|
|
83
83
|
declare const LOOSE_ROLLING_RESISTANCE = 0.015;
|
|
84
84
|
/** What the engine needs to make a loose body from what the gallery drew. */
|
|
85
85
|
interface LooseCollider {
|
|
@@ -91,6 +91,11 @@ interface LooseCollider {
|
|
|
91
91
|
}
|
|
92
92
|
/** A casing lying along x as `buildCasing` draws it (the engine's cylinder stands on y, so its child is turned a quarter about z), rolling on its own radius. */
|
|
93
93
|
declare function casingCollider(radius: number, length: number): LooseCollider;
|
|
94
|
+
/**
|
|
95
|
+
* The M67 as `projectileModel` draws it (body, fuze, spoon; centred on the middle of the model), with the rolling resistance of a round piece, so a thrown one
|
|
96
|
+
* bounces to rest as the arsenal's does. Undefined for an explosive the engine has no collider of.
|
|
97
|
+
*/
|
|
98
|
+
declare function explosiveCollider(THREE: typeof THREE_NS, explosive: string): LooseCollider | undefined;
|
|
94
99
|
/** A loose body in the engine: what the costura keeps between frames. */
|
|
95
100
|
interface LooseBody {
|
|
96
101
|
readonly id: BodyId;
|
|
@@ -432,4 +437,4 @@ interface HolsteredWeapons {
|
|
|
432
437
|
}
|
|
433
438
|
declare const createHolsteredWeapons: (options: HolsteredWeaponsOptions) => HolsteredWeapons;
|
|
434
439
|
|
|
435
|
-
export { ARCHETYPE_MODELS, ATTACHMENT_MODELS, AttachmentModelRegistry, type AttachmentRig, BODY_ACTIONS, type CartridgeShape, type ClipContext, DEFAULT_THUMBNAIL_BASE, EXPLOSIVE_MODEL_IDS, type FitAttachmentOptions, GROUND_SLOT, HOLSTER_PLACEMENT, HOLSTER_TOSS, type HolsterRig, type HolsteredWeapons, type HolsteredWeaponsOptions, ItemModels, LOOSE_ROLLING_RESISTANCE, LaserRaycast, type LooseBody, type LooseCollider, type LooseLaunch, type LooseReading, MODEL_ENTRIES, type ModelEntry, ModelFamily, ModelKit, ModelOptions, ModelParts, P13_VALVE_MESH, type ProjectileModel, type ProjectileQuery, SLING_HANG, TOOL_MOTIONS, type ToolMotion, type ToolMotionKey, VIEW_HOLD, VIEW_MOTION, type ViewHoldKind, WEAPON_THUMBNAILS, WORLD_EFFECTS, WORLD_EXPLOSIVE_IDS, WORLD_EXPLOSIVE_PREFIX, WeaponItemModel, WeaponModel, type WeaponProp, WeaponProps, type WeaponPropsOptions, type WeaponThumbnailEntry, type WorldEffectIds, type WorldEffectsOptions, type WorldExplosiveOptions, type WorldExplosiveShells, applyCondition, buildCartridge, buildCasing, buildExplosiveModel, buildHolsterRig, buildModeledProp, buildProp, buildRound, buildToolClips, buildTripodMountedProp, buildWeaponModelById, cartridgeShape, casingCollider, createHolsteredWeapons, createWeaponProps, createWorldEffects, createWorldExplosiveShells, dropLoose, fitAttachmentModels, hasExplosiveModel, hasWeaponModel, holsteredModel, modeledPropSpec, partRegistry, projectileModel, rigStock, rigUnderbarrel, sampleToolMotion, spawnLoose, syncLoose, toWorldLens, weaponProp, weaponThumbnailCredit, weaponThumbnailUrl, worldExplosiveItem, worldExplosiveShell, worldExplosiveValve };
|
|
440
|
+
export { ARCHETYPE_MODELS, ATTACHMENT_MODELS, AttachmentModelRegistry, type AttachmentRig, BODY_ACTIONS, type CartridgeShape, type ClipContext, DEFAULT_THUMBNAIL_BASE, EXPLOSIVE_MODEL_IDS, type FitAttachmentOptions, GROUND_SLOT, HOLSTER_PLACEMENT, HOLSTER_TOSS, type HolsterRig, type HolsteredWeapons, type HolsteredWeaponsOptions, ItemModels, LOOSE_ROLLING_RESISTANCE, LaserRaycast, type LooseBody, type LooseCollider, type LooseLaunch, type LooseReading, MODEL_ENTRIES, type ModelEntry, ModelFamily, ModelKit, ModelOptions, ModelParts, P13_VALVE_MESH, type ProjectileModel, type ProjectileQuery, SLING_HANG, TOOL_MOTIONS, type ToolMotion, type ToolMotionKey, VIEW_HOLD, VIEW_MOTION, type ViewHoldKind, WEAPON_THUMBNAILS, WORLD_EFFECTS, WORLD_EXPLOSIVE_IDS, WORLD_EXPLOSIVE_PREFIX, WeaponItemModel, WeaponModel, type WeaponProp, WeaponProps, type WeaponPropsOptions, type WeaponThumbnailEntry, type WorldEffectIds, type WorldEffectsOptions, type WorldExplosiveOptions, type WorldExplosiveShells, applyCondition, buildCartridge, buildCasing, buildExplosiveModel, buildHolsterRig, buildModeledProp, buildProp, buildRound, buildToolClips, buildTripodMountedProp, buildWeaponModelById, cartridgeShape, casingCollider, createHolsteredWeapons, createWeaponProps, createWorldEffects, createWorldExplosiveShells, dropLoose, explosiveCollider, fitAttachmentModels, hasExplosiveModel, hasWeaponModel, holsteredModel, modeledPropSpec, partRegistry, projectileModel, rigStock, rigUnderbarrel, sampleToolMotion, spawnLoose, syncLoose, toWorldLens, weaponProp, weaponThumbnailCredit, weaponThumbnailUrl, worldExplosiveItem, worldExplosiveShell, worldExplosiveValve };
|
package/dist/index.global.js
CHANGED
|
@@ -91,6 +91,7 @@ var GameWeaponsThree = (() => {
|
|
|
91
91
|
defaultWeaponProps: () => defaultWeaponProps,
|
|
92
92
|
deriveFrames: () => deriveFrames,
|
|
93
93
|
dropLoose: () => dropLoose,
|
|
94
|
+
explosiveCollider: () => explosiveCollider,
|
|
94
95
|
explosivesTextOf: () => explosivesTextOf,
|
|
95
96
|
fitAttachmentModels: () => fitAttachmentModels,
|
|
96
97
|
hasExplosiveModel: () => hasExplosiveModel,
|
|
@@ -54894,7 +54895,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54894
54895
|
}
|
|
54895
54896
|
var residentialTower = residentialTowerTemplate();
|
|
54896
54897
|
|
|
54897
|
-
// ../game-floorplan-three/dist/chunk-
|
|
54898
|
+
// ../game-floorplan-three/dist/chunk-ANCD3HXE.js
|
|
54898
54899
|
var __defProp4 = Object.defineProperty;
|
|
54899
54900
|
var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
54900
54901
|
var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -67334,6 +67335,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67334
67335
|
}
|
|
67335
67336
|
var FLOOR_TOUCH2 = 5e-3;
|
|
67336
67337
|
var LOOSE = /* @__PURE__ */ new Set(["paper"]);
|
|
67338
|
+
var PLANTED = /* @__PURE__ */ new Set(["mailbox", "correio", "clothesline", "tree_small", "bbq_simple"]);
|
|
67337
67339
|
var BASE_MATERIAL = {
|
|
67338
67340
|
wood: "wood_hard",
|
|
67339
67341
|
metal: "steel",
|
|
@@ -67445,7 +67447,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67445
67447
|
const wallMounted = parts2.some((part) => part.anchored && low(part) > FLOOR_TOUCH2);
|
|
67446
67448
|
const sunk = parts2.some((part) => low(part) < -FLOOR_TOUCH2);
|
|
67447
67449
|
const rooted = parts2.some((part) => part.material === "foliage") && parts2.some((part) => part.material.startsWith("wood") && low(part) <= FLOOR_TOUCH2);
|
|
67448
|
-
const fixed2 = wallMounted || sunk || rooted;
|
|
67450
|
+
const fixed2 = wallMounted || sunk || rooted || PLANTED.has(name);
|
|
67449
67451
|
const all = drawn.reduce(
|
|
67450
67452
|
(m, p) => ({ x0: Math.min(m.x0, p.min[0]), x1: Math.max(m.x1, p.max[0]), z0: Math.min(m.z0, p.min[2]), z1: Math.max(m.z1, p.max[2]) }),
|
|
67451
67453
|
{ x0: Infinity, x1: -Infinity, z0: Infinity, z1: -Infinity }
|
|
@@ -99804,11 +99806,13 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
99804
99806
|
var LOOSE_ROLLING_RESISTANCE = 0.015;
|
|
99805
99807
|
var CASING_FILL = 0.25;
|
|
99806
99808
|
var BRASS_DENSITY = 8500;
|
|
99807
|
-
var
|
|
99809
|
+
var GRENADE_MASS_KG = 0.4;
|
|
99810
|
+
var LOOSE_USER = { casing: 100, grenade: 2 };
|
|
99808
99811
|
var BOUNCE_FALL_SPEED = 0.5;
|
|
99809
99812
|
var BOUNCE_RISE_SPEED = 0.2;
|
|
99810
99813
|
var QUARTER_TURN_Z = [0, 0, Math.SQRT1_2, Math.SQRT1_2];
|
|
99811
99814
|
var CASING_MATERIAL = { frictionStatic: 0.4, frictionDynamic: 0.3, restitution: 0.4 };
|
|
99815
|
+
var GRENADE_MATERIAL = { frictionStatic: 0.6, frictionDynamic: 0.5, restitution: 0.35 };
|
|
99812
99816
|
function casingCollider(radius, length2) {
|
|
99813
99817
|
return {
|
|
99814
99818
|
shape: { kind: "compound", children: [{ shape: { kind: "cylinder", halfHeight: length2 / 2, radius }, position: [0, 0, 0], rotation: QUARTER_TURN_Z }] },
|
|
@@ -99818,6 +99822,28 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
99818
99822
|
user: LOOSE_USER.casing
|
|
99819
99823
|
};
|
|
99820
99824
|
}
|
|
99825
|
+
function explosiveCollider(THREE, explosive) {
|
|
99826
|
+
if (explosive !== "m67") return void 0;
|
|
99827
|
+
const model = buildExplosiveModel(THREE, explosive);
|
|
99828
|
+
if (!model) return void 0;
|
|
99829
|
+
const centre = new THREE.Box3().setFromObject(model).getCenter(new THREE.Vector3());
|
|
99830
|
+
const { bodyRadius, fuze, spoon } = M67_PARTS;
|
|
99831
|
+
const at4 = (x, y) => [x - centre.x, y + bodyRadius - centre.y, 0 - centre.z];
|
|
99832
|
+
return {
|
|
99833
|
+
shape: {
|
|
99834
|
+
kind: "compound",
|
|
99835
|
+
children: [
|
|
99836
|
+
{ shape: { kind: "sphere", radius: bodyRadius }, position: at4(0, 0) },
|
|
99837
|
+
{ shape: { kind: "cylinder", halfHeight: fuze.height / 2, radius: fuze.radius }, position: at4(0, fuze.y) },
|
|
99838
|
+
{ shape: { kind: "box", half: [spoon.size[0] / 2, spoon.size[1] / 2, spoon.size[2] / 2] }, position: at4(spoon.x, spoon.y), rotation: [0, 0, Math.sin(spoon.tilt / 2), Math.cos(spoon.tilt / 2)] }
|
|
99839
|
+
]
|
|
99840
|
+
},
|
|
99841
|
+
mass: GRENADE_MASS_KG,
|
|
99842
|
+
material: GRENADE_MATERIAL,
|
|
99843
|
+
rolling: { coefficient: LOOSE_ROLLING_RESISTANCE, radius: bodyRadius },
|
|
99844
|
+
user: LOOSE_USER.grenade
|
|
99845
|
+
};
|
|
99846
|
+
}
|
|
99821
99847
|
function spawnLoose(world, collider, launch) {
|
|
99822
99848
|
const desc = {
|
|
99823
99849
|
shape: collider.shape,
|