@adatechnology/game-weapons-three 0.7.1 → 0.7.2
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.global.js +889 -700
- package/dist/index.global.js.map +1 -1
- package/package.json +3 -3
package/dist/index.global.js
CHANGED
|
@@ -13781,17 +13781,17 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
13781
13781
|
var DEFAULT_NOISE_SECONDS = 1.5;
|
|
13782
13782
|
var OCCLUSION_GAIN = 0.5;
|
|
13783
13783
|
var OCCLUSION_CUTOFF = 0.6;
|
|
13784
|
-
function isParamRef(
|
|
13785
|
-
return typeof
|
|
13784
|
+
function isParamRef(range2) {
|
|
13785
|
+
return typeof range2 === "object" && !Array.isArray(range2);
|
|
13786
13786
|
}
|
|
13787
|
-
function draw(
|
|
13788
|
-
if (typeof
|
|
13789
|
-
if (isParamRef(
|
|
13790
|
-
const value = scope2.params[
|
|
13791
|
-
if (value === void 0) throw new Error(`game-audio: the recipe reads the param "${
|
|
13792
|
-
return value * (
|
|
13787
|
+
function draw(range2, scope2) {
|
|
13788
|
+
if (typeof range2 === "number") return range2;
|
|
13789
|
+
if (isParamRef(range2)) {
|
|
13790
|
+
const value = scope2.params[range2.param];
|
|
13791
|
+
if (value === void 0) throw new Error(`game-audio: the recipe reads the param "${range2.param}", which was not given`);
|
|
13792
|
+
return value * (range2.scale ?? 1) + (range2.add ?? 0);
|
|
13793
13793
|
}
|
|
13794
|
-
const [min2, max2] =
|
|
13794
|
+
const [min2, max2] = range2;
|
|
13795
13795
|
return min2 + scope2.random() * (max2 - min2);
|
|
13796
13796
|
}
|
|
13797
13797
|
function drawTime(time, scope2) {
|
|
@@ -13956,7 +13956,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
13956
13956
|
};
|
|
13957
13957
|
if (silent) return recipe.keepSilent ? { ...base, silent: true, length: 0, layers: [] } : null;
|
|
13958
13958
|
const scope2 = { random: input.random ?? createRng2(1), params: { ...input.params } };
|
|
13959
|
-
for (const [name,
|
|
13959
|
+
for (const [name, range2] of Object.entries(recipe.vars ?? {})) if (scope2.params[name] === void 0) scope2.params[name] = draw(range2, scope2);
|
|
13960
13960
|
const defaults = {
|
|
13961
13961
|
...recipe.duration === void 0 ? {} : { duration: draw(recipe.duration, scope2) },
|
|
13962
13962
|
...recipe.tail === void 0 ? {} : { tail: recipe.tail },
|
|
@@ -14233,7 +14233,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
14233
14233
|
}
|
|
14234
14234
|
};
|
|
14235
14235
|
}
|
|
14236
|
-
var fixed = (
|
|
14236
|
+
var fixed = (range2) => typeof range2 === "number" ? range2 : 0;
|
|
14237
14237
|
var fixedFrequency = (automation) => fixed("set" in automation ? automation.set : automation.from);
|
|
14238
14238
|
function sourceOf(recipe, target) {
|
|
14239
14239
|
if (recipe.source.kind === "noise") return { source: noiseSource(target, true) };
|
|
@@ -15448,12 +15448,12 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
15448
15448
|
var VIEWMODEL_NODE_NAME = "weapon-viewmodel";
|
|
15449
15449
|
var IN_HAND_NODE_NAME = "weapon-in-hand";
|
|
15450
15450
|
var LASER_RAYCAST_HZ = 30;
|
|
15451
|
-
var isHeld = (
|
|
15452
|
-
for (let node =
|
|
15451
|
+
var isHeld = (object2) => {
|
|
15452
|
+
for (let node = object2; node; node = node.parent) if (node.name === VIEWMODEL_NODE_NAME || node.name === IN_HAND_NODE_NAME) return true;
|
|
15453
15453
|
return false;
|
|
15454
15454
|
};
|
|
15455
|
-
var isVisibleInScene = (
|
|
15456
|
-
for (let node =
|
|
15455
|
+
var isVisibleInScene = (object2) => {
|
|
15456
|
+
for (let node = object2; node; node = node.parent) if (!node.visible) return false;
|
|
15457
15457
|
return true;
|
|
15458
15458
|
};
|
|
15459
15459
|
var createLaserRaycast = (THREE, scene, camera2, options = {}) => {
|
|
@@ -15479,6 +15479,226 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
15479
15479
|
};
|
|
15480
15480
|
};
|
|
15481
15481
|
|
|
15482
|
+
// ../game-shapes/dist/chunk-R4RY23RH.js
|
|
15483
|
+
function normalMatrix(me) {
|
|
15484
|
+
const n11 = me[0], n21 = me[1], n31 = me[2];
|
|
15485
|
+
const n12 = me[4], n22 = me[5], n32 = me[6];
|
|
15486
|
+
const n13 = me[8], n23 = me[9], n33 = me[10];
|
|
15487
|
+
const t11 = n33 * n22 - n32 * n23;
|
|
15488
|
+
const t12 = n32 * n13 - n33 * n12;
|
|
15489
|
+
const t13 = n23 * n12 - n22 * n13;
|
|
15490
|
+
const det = n11 * t11 + n21 * t12 + n31 * t13;
|
|
15491
|
+
if (det === 0) return [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
15492
|
+
const detInv = 1 / det;
|
|
15493
|
+
const te = [
|
|
15494
|
+
t11 * detInv,
|
|
15495
|
+
(n31 * n23 - n33 * n21) * detInv,
|
|
15496
|
+
(n32 * n21 - n31 * n22) * detInv,
|
|
15497
|
+
t12 * detInv,
|
|
15498
|
+
(n33 * n11 - n31 * n13) * detInv,
|
|
15499
|
+
(n31 * n12 - n32 * n11) * detInv,
|
|
15500
|
+
t13 * detInv,
|
|
15501
|
+
(n21 * n13 - n23 * n11) * detInv,
|
|
15502
|
+
(n22 * n11 - n21 * n12) * detInv
|
|
15503
|
+
];
|
|
15504
|
+
let tmp = te[1];
|
|
15505
|
+
te[1] = te[3];
|
|
15506
|
+
te[3] = tmp;
|
|
15507
|
+
tmp = te[2];
|
|
15508
|
+
te[2] = te[6];
|
|
15509
|
+
te[6] = tmp;
|
|
15510
|
+
tmp = te[5];
|
|
15511
|
+
te[5] = te[7];
|
|
15512
|
+
te[7] = tmp;
|
|
15513
|
+
return te;
|
|
15514
|
+
}
|
|
15515
|
+
function transformPoint(e, x, y, z) {
|
|
15516
|
+
const w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);
|
|
15517
|
+
return [(e[0] * x + e[4] * y + e[8] * z + e[12]) * w, (e[1] * x + e[5] * y + e[9] * z + e[13]) * w, (e[2] * x + e[6] * y + e[10] * z + e[14]) * w];
|
|
15518
|
+
}
|
|
15519
|
+
var num = (v) => typeof v === "number" && Number.isFinite(v) ? null : "expected a finite number";
|
|
15520
|
+
var bool = (v) => typeof v === "boolean" ? null : "expected a boolean";
|
|
15521
|
+
var str = (v) => typeof v === "string" ? null : "expected a string";
|
|
15522
|
+
var int = (min2) => (v) => typeof v === "number" && Number.isInteger(v) && v >= min2 ? null : `expected an integer >= ${min2}`;
|
|
15523
|
+
var range = (lo, hi, loOpen = false) => (v) => typeof v === "number" && (loOpen ? v > lo : v >= lo) && v <= hi ? null : `expected a number in ${loOpen ? "(" : "["}${lo}, ${hi}]`;
|
|
15524
|
+
var tuple = (n, item = num) => (v) => {
|
|
15525
|
+
if (!Array.isArray(v) || v.length !== n) return `expected an array of ${n}`;
|
|
15526
|
+
for (const x of v) if (item(x)) return `expected an array of ${n} numbers`;
|
|
15527
|
+
return null;
|
|
15528
|
+
};
|
|
15529
|
+
var list = (item, min2 = 0) => (v) => {
|
|
15530
|
+
if (!Array.isArray(v)) return "expected an array";
|
|
15531
|
+
if (v.length < min2) return `expected at least ${min2} items`;
|
|
15532
|
+
for (let i = 0; i < v.length; i++) {
|
|
15533
|
+
const e = item(v[i]);
|
|
15534
|
+
if (e) return `[${i}]: ${e}`;
|
|
15535
|
+
}
|
|
15536
|
+
return null;
|
|
15537
|
+
};
|
|
15538
|
+
var color = (v) => typeof v === "number" && Number.isInteger(v) && v >= 0 && v <= 16777215 || typeof v === "string" && /^#[0-9a-fA-F]{6}$/.test(v) ? null : 'expected 0xRRGGBB or "#rrggbb"';
|
|
15539
|
+
var oneOf = (values) => (v) => values.includes(v) ? null : `expected one of ${values.map((x) => JSON.stringify(x)).join(", ")}`;
|
|
15540
|
+
var object = (fields, required = []) => (v) => {
|
|
15541
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return "expected an object";
|
|
15542
|
+
const record = v;
|
|
15543
|
+
for (const key of required) if (record[key] === void 0) return `${key}: required`;
|
|
15544
|
+
for (const key of Object.keys(record)) {
|
|
15545
|
+
if (record[key] === void 0) continue;
|
|
15546
|
+
const check = fields[key];
|
|
15547
|
+
if (!check) return `${key}: unknown field`;
|
|
15548
|
+
const e = check(record[key]);
|
|
15549
|
+
if (e) return `${key}: ${e}`;
|
|
15550
|
+
}
|
|
15551
|
+
return null;
|
|
15552
|
+
};
|
|
15553
|
+
var ORDERS = ["XYZ", "YXZ", "ZXY", "ZYX", "YZX", "XZY"];
|
|
15554
|
+
var TRANSFORM = {
|
|
15555
|
+
position: tuple(3),
|
|
15556
|
+
rotation: tuple(3),
|
|
15557
|
+
rotationOrder: oneOf(ORDERS),
|
|
15558
|
+
scale: (v) => typeof v === "number" ? num(v) : tuple(3)(v),
|
|
15559
|
+
heading: num,
|
|
15560
|
+
matrix: tuple(16)
|
|
15561
|
+
};
|
|
15562
|
+
var UV = object({ u0: num, v0: num, u1: num, v1: num }, ["u0", "v0", "u1", "v1"]);
|
|
15563
|
+
var INSTANCE = object({ ...TRANSFORM, color });
|
|
15564
|
+
var COMMON = {
|
|
15565
|
+
...TRANSFORM,
|
|
15566
|
+
kind: str,
|
|
15567
|
+
name: str,
|
|
15568
|
+
part: str,
|
|
15569
|
+
material: str,
|
|
15570
|
+
color,
|
|
15571
|
+
uv: UV,
|
|
15572
|
+
instances: list(INSTANCE),
|
|
15573
|
+
minDetail: range(0, 1, true),
|
|
15574
|
+
tags: list(str)
|
|
15575
|
+
};
|
|
15576
|
+
var vec2 = tuple(2);
|
|
15577
|
+
var BEVEL = (v) => v === false ? null : object({ thickness: num, size: num, offset: num, segments: int(1) })(v);
|
|
15578
|
+
var KINDS = {
|
|
15579
|
+
group: { fields: {} },
|
|
15580
|
+
box: { fields: { size: tuple(3), segments: tuple(3, int(1)) } },
|
|
15581
|
+
cylinder: { fields: { radiusTop: num, radiusBottom: num, height: num, radialSegments: int(1), heightSegments: int(1), openEnded: bool, thetaStart: num, thetaLength: num } },
|
|
15582
|
+
cone: { fields: { radius: num, height: num, radialSegments: int(1), heightSegments: int(1), openEnded: bool, thetaStart: num, thetaLength: num } },
|
|
15583
|
+
sphere: { fields: { radius: num, widthSegments: int(3), heightSegments: int(2), phiStart: num, phiLength: num, thetaStart: num, thetaLength: num } },
|
|
15584
|
+
plane: { fields: { width: num, height: num, widthSegments: int(1), heightSegments: int(1) } },
|
|
15585
|
+
circle: { fields: { radius: num, segments: int(3), thetaStart: num, thetaLength: num } },
|
|
15586
|
+
ring: { fields: { innerRadius: num, outerRadius: num, thetaSegments: int(3), phiSegments: int(1), thetaStart: num, thetaLength: num } },
|
|
15587
|
+
lathe: { fields: { points: list(vec2, 2), segments: int(1), phiStart: num, phiLength: num }, required: ["points"] },
|
|
15588
|
+
torus: { fields: { radius: num, tube: num, radialSegments: int(1), tubularSegments: int(1), arc: num } },
|
|
15589
|
+
extrude: {
|
|
15590
|
+
fields: { shape: object({ outer: list(vec2, 3), holes: list(list(vec2, 3)) }, ["outer"]), depth: num, steps: int(1), bevel: BEVEL },
|
|
15591
|
+
required: ["shape"]
|
|
15592
|
+
},
|
|
15593
|
+
difference: { fields: { size: tuple(3), subtract: list(object({ min: vec2, max: vec2 }, ["min", "max"])) }, required: ["size", "subtract"] },
|
|
15594
|
+
mesh: {
|
|
15595
|
+
fields: {
|
|
15596
|
+
positions: (v) => list(num)(v) ?? (v.length % 3 === 0 ? null : "expected a multiple of 3 numbers"),
|
|
15597
|
+
normals: list(num),
|
|
15598
|
+
uvs: list(num),
|
|
15599
|
+
indices: list(int(0))
|
|
15600
|
+
},
|
|
15601
|
+
required: ["positions"]
|
|
15602
|
+
},
|
|
15603
|
+
point: { fields: { data: () => null } },
|
|
15604
|
+
custom: { fields: { generator: str, params: () => null }, required: ["generator"] }
|
|
15605
|
+
};
|
|
15606
|
+
function mergeTransformed(pieces) {
|
|
15607
|
+
let total = 0;
|
|
15608
|
+
for (const piece2 of pieces) total += piece2.indices ? piece2.indices.length : piece2.positions.length / 3;
|
|
15609
|
+
const positions = new Float32Array(total * 3);
|
|
15610
|
+
const normals = new Float32Array(total * 3);
|
|
15611
|
+
const uvs = new Float32Array(total * 2);
|
|
15612
|
+
let at3 = 0;
|
|
15613
|
+
for (const piece2 of pieces) {
|
|
15614
|
+
const e = piece2.matrix;
|
|
15615
|
+
const nm = normalMatrix(e);
|
|
15616
|
+
const count = piece2.indices ? piece2.indices.length : piece2.positions.length / 3;
|
|
15617
|
+
const p = new Float32Array(count * 3);
|
|
15618
|
+
const n = new Float32Array(count * 3);
|
|
15619
|
+
for (let k = 0; k < count; k++) {
|
|
15620
|
+
const i = piece2.indices ? piece2.indices[k] : k;
|
|
15621
|
+
for (let c = 0; c < 3; c++) {
|
|
15622
|
+
p[k * 3 + c] = piece2.positions[i * 3 + c];
|
|
15623
|
+
if (piece2.normals) n[k * 3 + c] = piece2.normals[i * 3 + c];
|
|
15624
|
+
}
|
|
15625
|
+
if (piece2.uvs) {
|
|
15626
|
+
uvs[(at3 + k) * 2] = piece2.uvs[i * 2];
|
|
15627
|
+
uvs[(at3 + k) * 2 + 1] = piece2.uvs[i * 2 + 1];
|
|
15628
|
+
}
|
|
15629
|
+
}
|
|
15630
|
+
for (let k = 0; k < count; k++) {
|
|
15631
|
+
const q = transformPoint(e, p[k * 3], p[k * 3 + 1], p[k * 3 + 2]);
|
|
15632
|
+
positions[(at3 + k) * 3] = q[0];
|
|
15633
|
+
positions[(at3 + k) * 3 + 1] = q[1];
|
|
15634
|
+
positions[(at3 + k) * 3 + 2] = q[2];
|
|
15635
|
+
const x = n[k * 3];
|
|
15636
|
+
const y = n[k * 3 + 1];
|
|
15637
|
+
const z = n[k * 3 + 2];
|
|
15638
|
+
const vx2 = nm[0] * x + nm[3] * y + nm[6] * z;
|
|
15639
|
+
const vy2 = nm[1] * x + nm[4] * y + nm[7] * z;
|
|
15640
|
+
const vz2 = nm[2] * x + nm[5] * y + nm[8] * z;
|
|
15641
|
+
const s = 1 / (Math.sqrt(vx2 * vx2 + vy2 * vy2 + vz2 * vz2) || 1);
|
|
15642
|
+
normals[(at3 + k) * 3] = vx2 * s;
|
|
15643
|
+
normals[(at3 + k) * 3 + 1] = vy2 * s;
|
|
15644
|
+
normals[(at3 + k) * 3 + 2] = vz2 * s;
|
|
15645
|
+
}
|
|
15646
|
+
at3 += count;
|
|
15647
|
+
}
|
|
15648
|
+
return { positions, normals, uvs };
|
|
15649
|
+
}
|
|
15650
|
+
|
|
15651
|
+
// ../game-shapes-three/dist/index.js
|
|
15652
|
+
var isVisible = (object2) => {
|
|
15653
|
+
for (let node = object2; node; node = node.parent) if (!node.visible) return false;
|
|
15654
|
+
return true;
|
|
15655
|
+
};
|
|
15656
|
+
var plain = (attribute) => attribute !== void 0 && !attribute.isInterleavedBufferAttribute && attribute.array instanceof Float32Array && !attribute.normalized;
|
|
15657
|
+
function piece(geometry, matrix) {
|
|
15658
|
+
const position = geometry.getAttribute("position");
|
|
15659
|
+
const normal = geometry.getAttribute("normal");
|
|
15660
|
+
const uv = geometry.getAttribute("uv");
|
|
15661
|
+
const ok = plain(position) && (normal === void 0 || plain(normal)) && (uv === void 0 || plain(uv)) && position.itemSize === 3 && (uv === void 0 || uv.itemSize === 2);
|
|
15662
|
+
if (ok) {
|
|
15663
|
+
return { positions: position.array, ...normal ? { normals: normal.array } : {}, ...uv ? { uvs: uv.array } : {}, indices: geometry.index ? geometry.index.array : null, matrix: matrix.elements };
|
|
15664
|
+
}
|
|
15665
|
+
const flat = geometry.index ? geometry.toNonIndexed() : geometry;
|
|
15666
|
+
const read = (name, size) => {
|
|
15667
|
+
const attribute = flat.getAttribute(name);
|
|
15668
|
+
if (!attribute) return void 0;
|
|
15669
|
+
const out = new Float32Array(attribute.count * size);
|
|
15670
|
+
for (let i = 0; i < attribute.count; i++) for (let c = 0; c < size; c++) out[i * size + c] = c === 0 ? attribute.getX(i) : c === 1 ? attribute.getY(i) : attribute.getZ(i);
|
|
15671
|
+
return out;
|
|
15672
|
+
};
|
|
15673
|
+
const positions = read("position", 3);
|
|
15674
|
+
const normals = read("normal", 3);
|
|
15675
|
+
const uvs = read("uv", 2);
|
|
15676
|
+
if (flat !== geometry) flat.dispose();
|
|
15677
|
+
return { positions, ...normals ? { normals } : {}, ...uvs ? { uvs } : {}, indices: null, matrix: matrix.elements };
|
|
15678
|
+
}
|
|
15679
|
+
function mergeByMaterial(THREE, root, space) {
|
|
15680
|
+
const toSpace = space.matrixWorld.clone().invert();
|
|
15681
|
+
const byMaterial = /* @__PURE__ */ new Map();
|
|
15682
|
+
root.traverse((object2) => {
|
|
15683
|
+
const mesh2 = object2;
|
|
15684
|
+
if (!mesh2.isMesh || Array.isArray(mesh2.material) || !isVisible(mesh2)) return;
|
|
15685
|
+
const list2 = byMaterial.get(mesh2.material) ?? [];
|
|
15686
|
+
list2.push(piece(mesh2.geometry, new THREE.Matrix4().multiplyMatrices(toSpace, mesh2.matrixWorld)));
|
|
15687
|
+
byMaterial.set(mesh2.material, list2);
|
|
15688
|
+
});
|
|
15689
|
+
return [...byMaterial].map(([material, pieces]) => {
|
|
15690
|
+
const merged = mergeTransformed(pieces);
|
|
15691
|
+
const geometry = new THREE.BufferGeometry();
|
|
15692
|
+
geometry.setAttribute("position", new THREE.BufferAttribute(merged.positions, 3));
|
|
15693
|
+
geometry.setAttribute("normal", new THREE.BufferAttribute(merged.normals, 3));
|
|
15694
|
+
geometry.setAttribute("uv", new THREE.BufferAttribute(merged.uvs, 2));
|
|
15695
|
+
const mesh2 = new THREE.Mesh(geometry, material);
|
|
15696
|
+
mesh2.castShadow = false;
|
|
15697
|
+
mesh2.receiveShadow = true;
|
|
15698
|
+
return mesh2;
|
|
15699
|
+
});
|
|
15700
|
+
}
|
|
15701
|
+
|
|
15482
15702
|
// ../game-props3d/dist/index.js
|
|
15483
15703
|
var T = (id, interior, w, d, h, y, solid2, group) => ({ id, interior, w, d, h, y, solid: solid2, group });
|
|
15484
15704
|
var TYPE_DEFS = [
|
|
@@ -15541,55 +15761,24 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
15541
15761
|
T("open_door", true, 0.9, 0.15, 2.15, 0, false, "house_state")
|
|
15542
15762
|
];
|
|
15543
15763
|
var DEFS = Object.fromEntries(TYPE_DEFS.map((t) => [t.id, t]));
|
|
15544
|
-
var
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
const
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
for (const name of ATTRIBUTES) {
|
|
15563
|
-
const size = (geometries[0]?.getAttribute(name)).itemSize;
|
|
15564
|
-
const total = geometries.reduce((sum2, geometry) => sum2 + geometry.getAttribute(name).count, 0);
|
|
15565
|
-
const array = new Float32Array(total * size);
|
|
15566
|
-
let offset = 0;
|
|
15567
|
-
for (const geometry of geometries) {
|
|
15568
|
-
array.set(geometry.getAttribute(name).array, offset);
|
|
15569
|
-
offset += geometry.getAttribute(name).count * size;
|
|
15570
|
-
}
|
|
15571
|
-
merged.setAttribute(name, new THREE.BufferAttribute(array, size));
|
|
15572
|
-
}
|
|
15573
|
-
return merged;
|
|
15574
|
-
};
|
|
15575
|
-
function mergeByMaterial(THREE, root, space) {
|
|
15576
|
-
const toSpace = space.matrixWorld.clone().invert();
|
|
15577
|
-
const byMaterial = /* @__PURE__ */ new Map();
|
|
15578
|
-
root.traverse((object) => {
|
|
15579
|
-
const mesh2 = object;
|
|
15580
|
-
if (!mesh2.isMesh || Array.isArray(mesh2.material) || !isVisible(mesh2)) return;
|
|
15581
|
-
const list = byMaterial.get(mesh2.material) ?? [];
|
|
15582
|
-
list.push(bake(THREE, mesh2, new THREE.Matrix4().multiplyMatrices(toSpace, mesh2.matrixWorld)));
|
|
15583
|
-
byMaterial.set(mesh2.material, list);
|
|
15584
|
-
});
|
|
15585
|
-
return [...byMaterial].map(([material, geometries]) => {
|
|
15586
|
-
const merged = new THREE.Mesh(join(THREE, geometries), material);
|
|
15587
|
-
for (const geometry of geometries) geometry.dispose();
|
|
15588
|
-
merged.castShadow = false;
|
|
15589
|
-
merged.receiveShadow = true;
|
|
15590
|
-
return merged;
|
|
15591
|
-
});
|
|
15592
|
-
}
|
|
15764
|
+
var LEAF = (() => {
|
|
15765
|
+
const f = [0, 0, 0, -0.5, 0.4, 0, 0.5, 0.4, 0, 0, 1, 0];
|
|
15766
|
+
const positions = [];
|
|
15767
|
+
const normals = [];
|
|
15768
|
+
const uvs = [];
|
|
15769
|
+
const indices = [];
|
|
15770
|
+
for (const side of [1, -1]) {
|
|
15771
|
+
const base = positions.length / 3;
|
|
15772
|
+
for (let i = 0; i < 4; i++) {
|
|
15773
|
+
positions.push(f[i * 3], f[i * 3 + 1], f[i * 3 + 2]);
|
|
15774
|
+
normals.push(0, 0, side);
|
|
15775
|
+
uvs.push(f[i * 3] + 0.5, f[i * 3 + 1]);
|
|
15776
|
+
}
|
|
15777
|
+
if (side === 1) indices.push(base, base + 2, base + 1, base + 1, base + 2, base + 3);
|
|
15778
|
+
else indices.push(base, base + 1, base + 2, base + 1, base + 3, base + 2);
|
|
15779
|
+
}
|
|
15780
|
+
return { positions, normals, uvs, indices };
|
|
15781
|
+
})();
|
|
15593
15782
|
|
|
15594
15783
|
// src/data/models.json
|
|
15595
15784
|
var models_default = {
|
|
@@ -17177,7 +17366,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17177
17366
|
geometry.setAttribute("uv", flat.attributes.uv);
|
|
17178
17367
|
const position = new THREE.Vector3();
|
|
17179
17368
|
const normal = new THREE.Vector3();
|
|
17180
|
-
const
|
|
17369
|
+
const box3 = new THREE.Vector3(width, height, depth).divideScalar(2).subScalar(rounding);
|
|
17181
17370
|
const positions = geometry.attributes.position.array;
|
|
17182
17371
|
const normals = geometry.attributes.normal.array;
|
|
17183
17372
|
const uvs = geometry.attributes.uv.array;
|
|
@@ -17191,9 +17380,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17191
17380
|
normal.y -= Math.sign(normal.y) * halfSegment;
|
|
17192
17381
|
normal.z -= Math.sign(normal.z) * halfSegment;
|
|
17193
17382
|
normal.normalize();
|
|
17194
|
-
positions[i] =
|
|
17195
|
-
positions[i + 1] =
|
|
17196
|
-
positions[i + 2] =
|
|
17383
|
+
positions[i] = box3.x * Math.sign(position.x) + normal.x * rounding;
|
|
17384
|
+
positions[i + 1] = box3.y * Math.sign(position.y) + normal.y * rounding;
|
|
17385
|
+
positions[i + 2] = box3.z * Math.sign(position.z) + normal.z * rounding;
|
|
17197
17386
|
normals[i] = normal.x;
|
|
17198
17387
|
normals[i + 1] = normal.y;
|
|
17199
17388
|
normals[i + 2] = normal.z;
|
|
@@ -17211,8 +17400,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17211
17400
|
// src/models/kit.ts
|
|
17212
17401
|
var PI = Math.PI;
|
|
17213
17402
|
var createMaterials = (THREE) => {
|
|
17214
|
-
const standard = (
|
|
17215
|
-
const basic = (
|
|
17403
|
+
const standard = (color2, roughness = 0.7, metalness = 0.2, extra = {}) => new THREE.MeshStandardMaterial({ color: color2, roughness, metalness, ...extra });
|
|
17404
|
+
const basic = (color2, extra = {}) => new THREE.MeshBasicMaterial({ color: color2, ...extra });
|
|
17216
17405
|
const additive = { transparent: true, opacity: 0.95, blending: THREE.AdditiveBlending, depthWrite: false };
|
|
17217
17406
|
return {
|
|
17218
17407
|
metal: standard(3422010, 0.42, 0.75),
|
|
@@ -17304,10 +17493,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17304
17493
|
},
|
|
17305
17494
|
torus: (parent, geometry, material, x, y, z) => place(parent, shadowed(new THREE.Mesh(geometry, material)), x, y, z),
|
|
17306
17495
|
mark(parent, x, y, z) {
|
|
17307
|
-
const
|
|
17308
|
-
|
|
17309
|
-
parent.add(
|
|
17310
|
-
return
|
|
17496
|
+
const object2 = new THREE.Object3D();
|
|
17497
|
+
object2.position.set(x, y, z);
|
|
17498
|
+
parent.add(object2);
|
|
17499
|
+
return object2;
|
|
17311
17500
|
},
|
|
17312
17501
|
pivot(parent, x = 0, y = 0, z = 0) {
|
|
17313
17502
|
const group = new THREE.Group();
|
|
@@ -17327,32 +17516,32 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17327
17516
|
|
|
17328
17517
|
// src/models/break-action.ts
|
|
17329
17518
|
function buildBreakAction(kit, options) {
|
|
17330
|
-
const { M, box:
|
|
17519
|
+
const { M, box: box3, cylinderX, sphere: sphere2 } = kit;
|
|
17331
17520
|
const group = kit.group();
|
|
17332
17521
|
const L = (options.L ?? 0) / 1e3;
|
|
17333
17522
|
const barrel = (options.B ?? 0) / 1e3;
|
|
17334
17523
|
const parts = { family: "break", kick: 1.6, glow: [] };
|
|
17335
|
-
|
|
17336
|
-
for (let i = 0; i < 4; i++)
|
|
17524
|
+
box3(group, 0.09, 0.05, 0.042, M.steel, L - barrel - 0.04, -5e-3, 0);
|
|
17525
|
+
for (let i = 0; i < 4; i++) box3(group, 0.05, 2e-3, 0.043, M.dark, L - barrel - 0.04, 0.01 - i * 8e-3, 0);
|
|
17337
17526
|
const barrels = kit.pivot(group, L - barrel, -0.01, 0);
|
|
17338
17527
|
parts.barrels = barrels;
|
|
17339
17528
|
heatify(parts.glow, cylinderX(barrels, 0.0105, barrel, M.steel, barrel / 2, 0.01, 0.011, 18));
|
|
17340
17529
|
heatify(parts.glow, cylinderX(barrels, 0.0105, barrel, M.steel, barrel / 2, 0.01, -0.011, 18));
|
|
17341
|
-
|
|
17342
|
-
|
|
17530
|
+
box3(barrels, barrel, 4e-3, 8e-3, M.metal, barrel / 2, 0.022, 0);
|
|
17531
|
+
sphere2(barrels, 2e-3, M.white, barrel - 0.01, 0.026, 0, 1);
|
|
17343
17532
|
cylinderX(barrels, 75e-4, 4e-3, M.hole, barrel + 1e-3, 0.01, 0.011, 12);
|
|
17344
17533
|
cylinderX(barrels, 75e-4, 4e-3, M.hole, barrel + 1e-3, 0.01, -0.011, 12);
|
|
17345
|
-
|
|
17534
|
+
box3(barrels, 0.22, 0.03, 0.038, M.wood, 0.12, -0.01, 0);
|
|
17346
17535
|
parts.breech = [kit.mark(barrels, 4e-3, 0.01, 0.011), kit.mark(barrels, 4e-3, 0.01, -0.011)];
|
|
17347
|
-
|
|
17348
|
-
|
|
17349
|
-
|
|
17350
|
-
|
|
17351
|
-
parts.trigger =
|
|
17352
|
-
|
|
17353
|
-
|
|
17354
|
-
|
|
17355
|
-
parts.safety =
|
|
17536
|
+
box3(group, 0.12, 0.042, 0.032, M.wood, L - barrel - 0.14, -0.022, 0, 0.14);
|
|
17537
|
+
box3(group, 0.28, 0.07, 0.036, M.wood, 0.15, -0.05, 0, 0.08);
|
|
17538
|
+
box3(group, 0.012, 0.13, 0.04, M.rubber, 6e-3, -0.06, 0);
|
|
17539
|
+
box3(group, 4e-3, 0.014, 4e-3, M.dark, L - barrel - 0.05, -0.04, 0);
|
|
17540
|
+
parts.trigger = box3(group, 4e-3, 0.014, 4e-3, M.dark, L - barrel - 0.035, -0.04, 0);
|
|
17541
|
+
box3(group, 0.04, 4e-3, 0.01, M.steel, L - barrel - 0.045, -0.05, 0);
|
|
17542
|
+
box3(group, 0.012, 0.016, 6e-3, M.dark, L - barrel - 0.08, 0.022, 0.012, 0.5);
|
|
17543
|
+
box3(group, 0.012, 0.016, 6e-3, M.dark, L - barrel - 0.08, 0.022, -0.012, 0.5);
|
|
17544
|
+
parts.safety = box3(group, 0.02, 6e-3, 8e-3, M.steel, L - barrel - 0.07, 0.025, 0);
|
|
17356
17545
|
parts.muzzle = kit.mark(barrels, barrel + 0.01, 0.01, 0);
|
|
17357
17546
|
parts.eject = parts.breech[0];
|
|
17358
17547
|
return { group, parts };
|
|
@@ -17369,21 +17558,21 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17369
17558
|
function deriveFrames(THREE, model) {
|
|
17370
17559
|
const { root, inner, parts } = model;
|
|
17371
17560
|
root.updateMatrixWorld(true);
|
|
17372
|
-
const
|
|
17373
|
-
const span =
|
|
17561
|
+
const box3 = new THREE.Box3().setFromObject(root);
|
|
17562
|
+
const span = box3.max.x - box3.min.x;
|
|
17374
17563
|
const toInnerX = (x) => (x - inner.position.x) / inner.scale.x;
|
|
17375
17564
|
const muzzle2 = parts.muzzle?.position;
|
|
17376
|
-
const length2 = muzzle2 ? muzzle2.x - 0.01 : toInnerX(
|
|
17377
|
-
const receiverStart = toInnerX(
|
|
17378
|
-
const receiverEnd = toInnerX(
|
|
17565
|
+
const length2 = muzzle2 ? muzzle2.x - 0.01 : toInnerX(box3.max.x);
|
|
17566
|
+
const receiverStart = toInnerX(box3.min.x + span * RECEIVER_START_FRACTION);
|
|
17567
|
+
const receiverEnd = toInnerX(box3.min.x + span * RECEIVER_END_FRACTION);
|
|
17379
17568
|
return {
|
|
17380
17569
|
length: length2,
|
|
17381
|
-
barrelY: muzzle2?.y ?? (
|
|
17570
|
+
barrelY: muzzle2?.y ?? (box3.max.y + box3.min.y) / 2,
|
|
17382
17571
|
barrelRadius: DEFAULT_BARREL_RADIUS,
|
|
17383
17572
|
receiverStart,
|
|
17384
17573
|
receiverEnd,
|
|
17385
|
-
receiverHeight: (
|
|
17386
|
-
receiverWidth: Math.min(DEFAULT_RECEIVER_WIDTH,
|
|
17574
|
+
receiverHeight: (box3.max.y - box3.min.y) * RECEIVER_HEIGHT_FRACTION,
|
|
17575
|
+
receiverWidth: Math.min(DEFAULT_RECEIVER_WIDTH, box3.max.z - box3.min.z),
|
|
17387
17576
|
handguardEnd: receiverEnd + (length2 - receiverEnd) * HANDGUARD_FRACTION,
|
|
17388
17577
|
magazineX: parts.mag ? parts.mag.position.x : (receiverStart + receiverEnd) / 2,
|
|
17389
17578
|
gripX: receiverStart + DEFAULT_GRIP_OFFSET,
|
|
@@ -17435,33 +17624,33 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17435
17624
|
// src/models/details.ts
|
|
17436
17625
|
var PI2 = Math.PI;
|
|
17437
17626
|
function rail(kit, parent, x, length2, y, z, width, rotationX = 0) {
|
|
17438
|
-
const { M, box:
|
|
17627
|
+
const { M, box: box3 } = kit;
|
|
17439
17628
|
const pivot = kit.pivot(parent, 0, y, z);
|
|
17440
17629
|
pivot.rotation.x = rotationX;
|
|
17441
|
-
|
|
17630
|
+
box3(pivot, length2, 5e-3, width, M.dark, x + length2 / 2, 0, 0);
|
|
17442
17631
|
const slots = Math.floor(length2 / 95e-4);
|
|
17443
|
-
for (let i = 0; i < slots; i++)
|
|
17632
|
+
for (let i = 0; i < slots; i++) box3(pivot, 52e-4, 35e-4, width * 1.12, M.metal, x + 6e-3 + i * 95e-4, 35e-4, 0);
|
|
17444
17633
|
return pivot;
|
|
17445
17634
|
}
|
|
17446
17635
|
function vents(kit, parent, x, length2, y, z, count, height) {
|
|
17447
17636
|
for (let i = 0; i < count; i++) kit.box(parent, length2 / count * 0.45, height, 3e-3, kit.M.hole, x + (i + 0.5) * length2 / count, y, z);
|
|
17448
17637
|
}
|
|
17449
17638
|
function scope(kit, parent, kind, cx, cy, cz = 0) {
|
|
17450
|
-
const { M, box:
|
|
17639
|
+
const { M, box: box3, cylinderX, cylinderY, cylinderZ, THREE } = kit;
|
|
17451
17640
|
if (kind === 1) {
|
|
17452
|
-
|
|
17641
|
+
box3(parent, 0.044, 0.01, 0.028, M.dark, cx, cy + 5e-3, cz);
|
|
17453
17642
|
cylinderX(parent, 0.0155, 0.034, M.dark, cx + 4e-3, cy + 0.026, cz, 18);
|
|
17454
17643
|
cylinderX(parent, 0.0125, 2e-3, M.lens, cx + 0.022, cy + 0.026, cz, 18);
|
|
17455
17644
|
cylinderY(parent, 4e-3, 6e-3, M.dark, cx + 4e-3, cy + 0.044, cz, 10);
|
|
17456
17645
|
return;
|
|
17457
17646
|
}
|
|
17458
17647
|
if (kind === 2) {
|
|
17459
|
-
|
|
17648
|
+
box3(parent, 0.07, 0.012, 0.026, M.dark, cx, cy + 6e-3, cz);
|
|
17460
17649
|
cylinderX(parent, 0.016, 0.1, M.dark, cx - 0.01, cy + 0.032, cz, 18);
|
|
17461
17650
|
cylinderX(parent, 0.016, 0.035, M.dark, cx + 0.055, cy + 0.032, cz, 18, 0.02);
|
|
17462
17651
|
cylinderX(parent, 0.017, 2e-3, M.lens, cx + 0.073, cy + 0.032, cz, 18);
|
|
17463
17652
|
cylinderY(parent, 7e-3, 0.012, M.dark, cx, cy + 0.052, cz, 12);
|
|
17464
|
-
|
|
17653
|
+
box3(parent, 0.03, 0.01, 0.012, M.dark, cx - 0.01, cy + 0.054, cz);
|
|
17465
17654
|
return;
|
|
17466
17655
|
}
|
|
17467
17656
|
const sleeve = kind === 4 ? 0.2 : 0.32;
|
|
@@ -17476,9 +17665,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17476
17665
|
cylinderY(parent, 0.011, 4e-3, M.metal, cx, cy + 0.078, cz, 14);
|
|
17477
17666
|
cylinderZ(parent, 0.01, 0.022, M.dark, cx, cy + 0.045, cz + 0.022, 14);
|
|
17478
17667
|
for (const offset of [-0.07, 0.07]) {
|
|
17479
|
-
const
|
|
17480
|
-
|
|
17481
|
-
|
|
17668
|
+
const ring3 = kit.torus(parent, new THREE.TorusGeometry(0.0155, 3e-3, 8, 20), M.dark, cx + offset, cy + 0.045, cz);
|
|
17669
|
+
ring3.rotation.y = PI2 / 2;
|
|
17670
|
+
box3(parent, 0.016, 0.03, 0.022, M.dark, cx + offset, cy + 0.018, cz);
|
|
17482
17671
|
}
|
|
17483
17672
|
}
|
|
17484
17673
|
var buttpad = (kit, parent, x, y, height, width) => void kit.box(parent, 0.012, height, width, kit.M.rubber, x, y, 0);
|
|
@@ -17486,47 +17675,47 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17486
17675
|
|
|
17487
17676
|
// src/models/bullpup.ts
|
|
17488
17677
|
function buildBullpup(kit, options) {
|
|
17489
|
-
const { M, box:
|
|
17678
|
+
const { M, box: box3, cylinderX } = kit;
|
|
17490
17679
|
const group = kit.group();
|
|
17491
17680
|
const L = (options.L ?? 0) / 1e3;
|
|
17492
17681
|
const barrel = (options.B ?? 0) / 1e3;
|
|
17493
17682
|
const bodyLength = Math.max(0.32, L - barrel * 0.72);
|
|
17494
17683
|
const body = options.shot ? M.poly : M.olive;
|
|
17495
17684
|
const parts = { family: options.shot ? "pump" : "rifle", stroke: 0.06, glow: [] };
|
|
17496
|
-
|
|
17497
|
-
|
|
17498
|
-
|
|
17685
|
+
box3(group, bodyLength, 0.075, 0.042, body, bodyLength / 2, 0, 0);
|
|
17686
|
+
box3(group, bodyLength * 0.9, 0.02, 0.044, M.dark, bodyLength * 0.5, -0.02, 0);
|
|
17687
|
+
box3(group, 0.032, 0.13, 0.044, M.rubber, 0.016, -0.025, 0);
|
|
17499
17688
|
const gx = bodyLength * 0.8;
|
|
17500
17689
|
const grip = kit.pivot(group, gx, -0.085, 0);
|
|
17501
17690
|
grip.rotation.z = -0.25;
|
|
17502
|
-
|
|
17503
|
-
|
|
17504
|
-
parts.trigger =
|
|
17691
|
+
box3(grip, 0.03, 0.1, 0.03, M.poly, 0, 0, 0);
|
|
17692
|
+
box3(group, 0.1, 6e-3, 0.03, body, gx + 0.01, -0.06, 0);
|
|
17693
|
+
parts.trigger = box3(group, 4e-3, 0.016, 4e-3, M.dark, gx + 0.02, -0.05, 0, 0.15);
|
|
17505
17694
|
heatify(parts.glow, cylinderX(group, options.shot ? 0.0105 : 85e-4, barrel, M.metal, L - barrel / 2, 0.012, 0, 16));
|
|
17506
17695
|
cylinderX(group, 6e-3, 4e-3, M.hole, L + 1e-3, 0.012, 0, 12);
|
|
17507
|
-
|
|
17696
|
+
box3(group, 0.05, 0.024, 4e-3, M.hole, bodyLength * 0.25, 5e-3, 0.0212);
|
|
17508
17697
|
const bolt = kit.pivot(group);
|
|
17509
17698
|
parts.bolt = bolt;
|
|
17510
|
-
|
|
17699
|
+
box3(bolt, 0.044, 0.02, 6e-3, M.steelL, bodyLength * 0.25, 5e-3, 0.02);
|
|
17511
17700
|
if (options.shot) {
|
|
17512
17701
|
cylinderX(group, 0.012, bodyLength * 0.75, M.metal, bodyLength * 0.55, -0.025, 0.014, 14);
|
|
17513
17702
|
cylinderX(group, 0.012, bodyLength * 0.75, M.metal, bodyLength * 0.55, -0.025, -0.014, 14);
|
|
17514
17703
|
const pump = kit.pivot(group);
|
|
17515
17704
|
parts.pump = pump;
|
|
17516
|
-
|
|
17517
|
-
for (let i = 0; i < 6; i++)
|
|
17705
|
+
box3(pump, 0.15, 0.045, 0.052, M.poly, bodyLength + 0.06, -0.015, 0);
|
|
17706
|
+
for (let i = 0; i < 6; i++) box3(pump, 6e-3, 0.047, 0.054, M.dark, bodyLength + 5e-3 + i * 0.022, -0.015, 0);
|
|
17518
17707
|
rail(kit, group, bodyLength * 0.15, bodyLength * 0.8, 0.04, 0, 0.02);
|
|
17519
17708
|
parts.loadPort = kit.mark(group, bodyLength * 0.2, -0.04, 0);
|
|
17520
17709
|
} else {
|
|
17521
17710
|
const magazine = kit.pivot(group, gx - 0.11, -0.03, 0);
|
|
17522
17711
|
magazine.rotation.z = 0.14;
|
|
17523
17712
|
parts.mag = magazine;
|
|
17524
|
-
|
|
17713
|
+
box3(magazine, 0.05, 0.14, 0.026, M.glass, 0, -0.07, 0);
|
|
17525
17714
|
for (let i = 0; i < 6; i++) cylinderX(magazine, 3e-3, 0.04, M.brass, 0, -0.01 - i * 0.02, 0, 6);
|
|
17526
17715
|
parts.magDrop = 0.18;
|
|
17527
17716
|
scope(kit, group, 2, bodyLength * 0.5, 0.04, 0);
|
|
17528
|
-
|
|
17529
|
-
|
|
17717
|
+
box3(group, 0.2, 0.03, 0.02, body, bodyLength * 0.62, 0.048, 0);
|
|
17718
|
+
box3(group, 0.026, 0.075, 0.026, body, bodyLength + 0.05, -0.05, 0, 0.1);
|
|
17530
17719
|
}
|
|
17531
17720
|
parts.muzzle = kit.mark(group, L + 0.01, 0.012, 0);
|
|
17532
17721
|
parts.eject = kit.mark(group, bodyLength * 0.25, 5e-3, 0.03);
|
|
@@ -17547,7 +17736,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17547
17736
|
cylinderX(group, 4e-3, 0.022, M.fire, x + 0.012, y, 0, 6, 0).userData.flame = 1;
|
|
17548
17737
|
};
|
|
17549
17738
|
function buildFlamethrower(kit, group, parts) {
|
|
17550
|
-
const { M, box:
|
|
17739
|
+
const { M, box: box3, cylinderX, cylinderY, sphere: sphere2 } = kit;
|
|
17551
17740
|
parts.kick = 0.15;
|
|
17552
17741
|
heatify(parts.glow, cylinderX(group, 0.016, 0.62, M.steel, 0.42, 0, 0, 14));
|
|
17553
17742
|
cylinderX(group, 0.022, 0.1, M.dark, 0.78, 0, 0, 14);
|
|
@@ -17557,52 +17746,52 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17557
17746
|
pilot(kit, group, 0.92, -0.012);
|
|
17558
17747
|
const foreGrip = kit.pivot(group, 0.6, -0.02, 0);
|
|
17559
17748
|
foreGrip.rotation.z = -0.1;
|
|
17560
|
-
|
|
17749
|
+
box3(foreGrip, 0.03, 0.1, 0.03, M.wood, 0, -0.05, 0);
|
|
17561
17750
|
const lever = kit.pivot(group, 0.62, -0.02, 0);
|
|
17562
|
-
parts.trigger =
|
|
17751
|
+
parts.trigger = box3(lever, 8e-3, 0.05, 6e-3, M.metal, 0.02, -0.03, 0, 0.3);
|
|
17563
17752
|
const rearGrip = kit.pivot(group, 0.17, -0.02, 0);
|
|
17564
17753
|
rearGrip.rotation.z = -0.28;
|
|
17565
|
-
|
|
17566
|
-
|
|
17754
|
+
box3(rearGrip, 0.03, 0.1, 0.03, M.wood, 0, -0.05, 0);
|
|
17755
|
+
box3(group, 0.05, 4e-3, 0.012, M.metal, 0.2, -0.035, 0);
|
|
17567
17756
|
cylinderX(group, 0.02, 0.04, M.metal, 0.1, 0, 0, 12);
|
|
17568
17757
|
hose(kit, group, [[0.08, 0, 0], [0, -0.04, 0], [-0.08, -0.2, 0.05], [-0.18, -0.32, 0.08], [-0.25, -0.33, 0.08]], 0.011, M.rubber);
|
|
17569
17758
|
for (const z of [-0.1, 0.1]) {
|
|
17570
17759
|
cylinderY(group, 0.085, 0.5, M.olive, -0.3, -0.05, z, 20);
|
|
17571
|
-
|
|
17572
|
-
|
|
17760
|
+
sphere2(group, 0.085, M.olive, -0.3, 0.2, z, 2).scale.y = 0.45;
|
|
17761
|
+
sphere2(group, 0.085, M.olive, -0.3, -0.3, z, 2).scale.y = 0.45;
|
|
17573
17762
|
cylinderY(group, 0.03, 0.03, M.metal, -0.3, 0.24, z, 12);
|
|
17574
17763
|
}
|
|
17575
|
-
|
|
17576
|
-
|
|
17764
|
+
sphere2(group, 0.075, M.olive, -0.3, 0.1, 0, 2).position.x = -0.39;
|
|
17765
|
+
box3(group, 0.03, 0.6, 0.24, M.dark, -0.4, -0.05, 0);
|
|
17577
17766
|
cylinderY(group, 0.03, 0.012, M.metal, -0.39, 0.18, 0, 14);
|
|
17578
17767
|
const gauge = kit.pivot(group, -0.39, 0.18, 3e-3);
|
|
17579
17768
|
parts.gauge = gauge;
|
|
17580
|
-
|
|
17769
|
+
box3(gauge, 2e-3, 0.022, 2e-3, M.red, 0, 8e-3, 0.012);
|
|
17581
17770
|
parts.muzzle = kit.pivot(group, 0.94, 0, 0);
|
|
17582
17771
|
parts.rear = kit.pivot(group, 0.1, 0, 0);
|
|
17583
17772
|
}
|
|
17584
17773
|
function buildImprovisedFlamethrower(kit, group, parts) {
|
|
17585
|
-
const { M, box:
|
|
17774
|
+
const { M, box: box3, cylinderX, cylinderY, sphere: sphere2 } = kit;
|
|
17586
17775
|
parts.kick = 0.12;
|
|
17587
17776
|
heatify(parts.glow, cylinderX(group, 0.011, 0.66, M.pipe, 0.38, 0, 0, 12));
|
|
17588
17777
|
heatify(parts.glow, cylinderX(group, 0.015, 0.06, M.steel, 0.74, 0, 0, 12, 0.01));
|
|
17589
17778
|
cylinderX(group, 6e-3, 0.05, M.metal, 0.735, -0.02, 0, 8);
|
|
17590
17779
|
pilot(kit, group, 0.77, -0.02);
|
|
17591
17780
|
cylinderY(group, 0.012, 0.04, M.redPaint, 0.72, -0.055, 0, 10);
|
|
17592
|
-
|
|
17781
|
+
box3(group, 0.02, 0.03, 0.012, M.dark, 0.72, -0.085, 0);
|
|
17593
17782
|
cylinderX(group, 0.06, 0.42, M.redPaint, 0.3, -0.09, 0, 22);
|
|
17594
|
-
|
|
17595
|
-
|
|
17783
|
+
sphere2(group, 0.06, M.redPaint, 0.51, -0.09, 0, 2).scale.x = 0.5;
|
|
17784
|
+
sphere2(group, 0.06, M.redPaint, 0.09, -0.09, 0, 2).scale.x = 0.5;
|
|
17596
17785
|
cylinderX(group, 0.02, 0.04, M.dark, 0.04, -0.09, 0, 12);
|
|
17597
|
-
|
|
17786
|
+
box3(group, 0.02, 0.06, 5e-3, M.white, 0.3, -0.09, 0.06);
|
|
17598
17787
|
for (const x of [0.15, 0.3, 0.45]) cylinderX(group, 0.063, 0.03, M.tape, x, -0.09, 0, 22);
|
|
17599
17788
|
cylinderX(group, 0.016, 0.03, M.tape, 0.3, 0, 0, 12);
|
|
17600
17789
|
hose(kit, group, [[0.04, -0.09, 0], [-0.02, -0.06, 0.02], [0, 0, 0.02], [0.05, 0, 0]], 7e-3, M.rubber);
|
|
17601
17790
|
const rearGrip = kit.pivot(group, 0.12, -0.01, 0);
|
|
17602
17791
|
rearGrip.rotation.z = -0.3;
|
|
17603
|
-
|
|
17792
|
+
box3(rearGrip, 0.03, 0.1, 0.03, M.wood, 0, -0.05, 0);
|
|
17604
17793
|
const lever = kit.pivot(group, 0.17, -0.02, 0);
|
|
17605
|
-
parts.trigger =
|
|
17794
|
+
parts.trigger = box3(lever, 8e-3, 0.04, 6e-3, M.metal, 0, -0.02, 0, 0.2);
|
|
17606
17795
|
parts.muzzle = kit.pivot(group, 0.78, 0, 0);
|
|
17607
17796
|
parts.rear = kit.pivot(group, 0.05, 0, 0);
|
|
17608
17797
|
}
|
|
@@ -17630,14 +17819,14 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17630
17819
|
return round3;
|
|
17631
17820
|
}
|
|
17632
17821
|
function buildFlyingRocket(kit, launcherType) {
|
|
17633
|
-
const { M, box:
|
|
17822
|
+
const { M, box: box3, cylinderX } = kit;
|
|
17634
17823
|
const rocket = kit.group();
|
|
17635
17824
|
const diameter = launcherType === "at4" || launcherType === "carl" ? 0.041 : 0.032;
|
|
17636
17825
|
cylinderX(rocket, diameter * 0.5, 0.2, M.dark, -0.1, 0, 0, 10);
|
|
17637
17826
|
cylinderX(rocket, diameter, 0.3, M.olive, 0.15, 0, 0, 18);
|
|
17638
17827
|
cylinderX(rocket, diameter, 0.12, M.olive, 0.36, 0, 0, 18, diameter * 0.25);
|
|
17639
17828
|
for (let i = 0; i < 4; i++) {
|
|
17640
|
-
const fin =
|
|
17829
|
+
const fin = box3(rocket, 0.06, 2e-3, diameter * 1.4, M.metal, -0.17, 0, 0);
|
|
17641
17830
|
fin.rotation.x = i * PI3 / 4;
|
|
17642
17831
|
}
|
|
17643
17832
|
return rocket;
|
|
@@ -17645,7 +17834,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17645
17834
|
|
|
17646
17835
|
// src/models/launcher-rocket.ts
|
|
17647
17836
|
function buildRpg(kit, group, parts) {
|
|
17648
|
-
const { M, box:
|
|
17837
|
+
const { M, box: box3, cylinderX } = kit;
|
|
17649
17838
|
parts.kick = 1.6;
|
|
17650
17839
|
cylinderX(group, 0.036, 0.13, M.dark, 0.065, 0, 0, 20, 0.021);
|
|
17651
17840
|
cylinderX(group, 0.038, 0.012, M.metal, 0, 0, 0, 20);
|
|
@@ -17654,25 +17843,25 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17654
17843
|
cylinderX(group, 0.031, 0.012, M.metal, 0.32, 0, 0, 16);
|
|
17655
17844
|
cylinderX(group, 0.031, 0.012, M.metal, 0.62, 0, 0, 16);
|
|
17656
17845
|
cylinderX(group, 0.024, 0.02, M.metal, 0.94, 0, 0, 16);
|
|
17657
|
-
|
|
17846
|
+
box3(group, 0.09, 0.03, 0.032, M.metal, 0.46, -0.028, 0);
|
|
17658
17847
|
const frontGrip = kit.pivot(group, 0.4, -0.04, 0);
|
|
17659
17848
|
frontGrip.rotation.z = -0.22;
|
|
17660
|
-
|
|
17849
|
+
box3(frontGrip, 0.03, 0.1, 0.03, M.wood, 0, -0.05, 0);
|
|
17661
17850
|
const rearGrip = kit.pivot(group, 0.5, -0.04, 0);
|
|
17662
17851
|
rearGrip.rotation.z = -0.18;
|
|
17663
|
-
|
|
17664
|
-
|
|
17665
|
-
|
|
17666
|
-
parts.trigger =
|
|
17852
|
+
box3(rearGrip, 0.03, 0.1, 0.03, M.wood, 0, -0.05, 0);
|
|
17853
|
+
box3(group, 0.06, 4e-3, 0.012, M.metal, 0.53, -0.05, 0);
|
|
17854
|
+
box3(group, 4e-3, 0.025, 0.012, M.metal, 0.56, -0.04, 0);
|
|
17855
|
+
parts.trigger = box3(group, 4e-3, 0.018, 4e-3, M.dark, 0.535, -0.045, 0, 0.15);
|
|
17667
17856
|
const hammer = kit.pivot(group, 0.44, -0.012, 0);
|
|
17668
17857
|
parts.hammer = hammer;
|
|
17669
|
-
|
|
17670
|
-
|
|
17671
|
-
|
|
17672
|
-
|
|
17858
|
+
box3(hammer, 0.012, 0.02, 0.01, M.dark, 0, 0, 0);
|
|
17859
|
+
box3(group, 6e-3, 0.03, 6e-3, M.dark, 0.78, 0.032, 0);
|
|
17860
|
+
box3(group, 0.02, 0.022, 0.014, M.dark, 0.46, 0.032, 0);
|
|
17861
|
+
box3(group, 0.12, 0.042, 0.032, M.dark, 0.5, 0.04, -0.04);
|
|
17673
17862
|
cylinderX(group, 0.013, 0.05, M.rubber, 0.42, 0.048, -0.04, 14);
|
|
17674
17863
|
cylinderX(group, 0.016, 4e-3, M.lens, 0.565, 0.048, -0.04, 14);
|
|
17675
|
-
|
|
17864
|
+
box3(group, 0.04, 0.012, 0.012, M.metal, 0.5, 0.016, -0.03);
|
|
17676
17865
|
const round3 = buildRocketGrenade(kit);
|
|
17677
17866
|
round3.position.x = 0.95;
|
|
17678
17867
|
group.add(round3);
|
|
@@ -17683,7 +17872,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17683
17872
|
parts.rear = kit.pivot(group, 0, 0, 0);
|
|
17684
17873
|
}
|
|
17685
17874
|
function buildM72(kit, group, parts) {
|
|
17686
|
-
const { M, box:
|
|
17875
|
+
const { M, box: box3, cylinderX, cylinderY } = kit;
|
|
17687
17876
|
parts.kick = 1.1;
|
|
17688
17877
|
parts.disposable = true;
|
|
17689
17878
|
heatify(parts.glow, cylinderX(group, 0.0365, 0.6, M.olive, 0.58, 0, 0, 20));
|
|
@@ -17692,40 +17881,40 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17692
17881
|
cylinderX(group, 0.035, 0.025, M.rubber, 0.012, 0, 0, 20);
|
|
17693
17882
|
cylinderX(group, 0.037, 0.015, M.yellow, 0.8, 0, 0, 20);
|
|
17694
17883
|
cylinderX(group, 0.037, 0.012, M.dark, 0.3, 0, 0, 20);
|
|
17695
|
-
|
|
17696
|
-
|
|
17697
|
-
|
|
17884
|
+
box3(group, 4e-3, 0.05, 0.05, M.dark, 0.79, 0.055, 0);
|
|
17885
|
+
box3(group, 4e-3, 6e-3, 0.04, M.dark, 0.79, 0.078, 0);
|
|
17886
|
+
box3(group, 4e-3, 0.035, 0.024, M.dark, 0.38, 0.05, 0);
|
|
17698
17887
|
cylinderY(group, 4e-3, 6e-3, M.lens, 0.38, 0.064, 0, 8);
|
|
17699
|
-
parts.trigger =
|
|
17700
|
-
|
|
17701
|
-
|
|
17702
|
-
|
|
17888
|
+
parts.trigger = box3(group, 0.05, 0.016, 0.024, M.rubber, 0.5, 0.042, 0);
|
|
17889
|
+
box3(group, 0.1, 0.01, 0.03, M.dark, 0.47, 0.036, 0);
|
|
17890
|
+
box3(group, 0.02, 0.03, 0.01, M.dark, 0.66, -0.035, 0.03);
|
|
17891
|
+
box3(group, 8e-3, 0.03, 8e-3, M.metal, 0.25, -0.04, 0.03);
|
|
17703
17892
|
parts.muzzle = kit.pivot(group, 0.881, 0, 0);
|
|
17704
17893
|
parts.rear = kit.pivot(group, 0, 0, 0);
|
|
17705
17894
|
}
|
|
17706
17895
|
function buildAt4(kit, group, parts) {
|
|
17707
|
-
const { M, box:
|
|
17896
|
+
const { M, box: box3, cylinderX } = kit;
|
|
17708
17897
|
parts.kick = 1.3;
|
|
17709
17898
|
parts.disposable = true;
|
|
17710
17899
|
heatify(parts.glow, cylinderX(group, 0.05, 0.86, M.olive, 0.51, 0, 0, 24));
|
|
17711
17900
|
cylinderX(group, 0.056, 0.08, M.dark, 0.98, 0, 0, 24);
|
|
17712
17901
|
cylinderX(group, 0.058, 0.07, M.dark, 0.04, 0, 0, 24, 0.05);
|
|
17713
17902
|
cylinderX(group, 0.051, 0.015, M.yellow, 0.86, 0, 0, 24);
|
|
17714
|
-
|
|
17715
|
-
|
|
17716
|
-
parts.trigger =
|
|
17717
|
-
|
|
17718
|
-
|
|
17903
|
+
box3(group, 0.16, 0.026, 0.05, M.dark, 0.42, 0.058, 0);
|
|
17904
|
+
box3(group, 0.03, 0.012, 0.016, M.red, 0.47, 0.075, 0);
|
|
17905
|
+
parts.trigger = box3(group, 0.022, 0.012, 0.018, M.rubber, 0.5, 0.074, 0);
|
|
17906
|
+
box3(group, 0.012, 0.07, 0.02, M.dark, 0.35, 0.09, -0.035);
|
|
17907
|
+
box3(group, 0.012, 0.05, 0.02, M.dark, 0.71, 0.08, -0.035);
|
|
17719
17908
|
const grip = kit.pivot(group, 0.68, -0.05, 0);
|
|
17720
17909
|
grip.rotation.z = -0.15;
|
|
17721
|
-
|
|
17722
|
-
|
|
17723
|
-
|
|
17910
|
+
box3(grip, 0.035, 0.11, 0.032, M.dark, 0, -0.05, 0);
|
|
17911
|
+
box3(group, 0.14, 0.035, 0.06, M.rubber, 0.32, -0.06, 0);
|
|
17912
|
+
box3(group, 0.3, 0.012, 0.055, M.dark, 0.5, -0.05, 0);
|
|
17724
17913
|
parts.muzzle = kit.pivot(group, 1.02, 0, 0);
|
|
17725
17914
|
parts.rear = kit.pivot(group, 0, 0, 0);
|
|
17726
17915
|
}
|
|
17727
17916
|
function buildCarlGustaf(kit, group, parts) {
|
|
17728
|
-
const { M, box:
|
|
17917
|
+
const { M, box: box3, cylinderX } = kit;
|
|
17729
17918
|
parts.kick = 1.4;
|
|
17730
17919
|
heatify(parts.glow, cylinderX(group, 0.045, 0.72, M.dark, 0.59, 0, 0, 24));
|
|
17731
17920
|
cylinderX(group, 0.05, 0.04, M.rubber, 0.93, 0, 0, 24);
|
|
@@ -17733,23 +17922,23 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17733
17922
|
parts.breech = [breech];
|
|
17734
17923
|
cylinderX(breech, 0.06, 0.16, M.dark, -0.1, 0, -0.05, 24, 0.046);
|
|
17735
17924
|
cylinderX(breech, 0.062, 0.015, M.metal, -0.18, 0, -0.05, 24);
|
|
17736
|
-
|
|
17925
|
+
box3(group, 0.025, 0.03, 0.02, M.metal, 0.22, 0, 0.052);
|
|
17737
17926
|
const foreGrip = kit.pivot(group, 0.62, -0.05, 0);
|
|
17738
17927
|
foreGrip.rotation.z = -0.2;
|
|
17739
|
-
|
|
17740
|
-
parts.trigger =
|
|
17741
|
-
|
|
17928
|
+
box3(foreGrip, 0.035, 0.11, 0.034, M.dark, 0, -0.05, 0);
|
|
17929
|
+
parts.trigger = box3(group, 4e-3, 0.018, 4e-3, M.dark, 0.66, -0.06, 0, 0.15);
|
|
17930
|
+
box3(group, 0.06, 4e-3, 0.012, M.metal, 0.66, -0.07, 0);
|
|
17742
17931
|
const rearGrip = kit.pivot(group, 0.4, -0.05, 0);
|
|
17743
17932
|
rearGrip.rotation.z = -0.25;
|
|
17744
|
-
|
|
17745
|
-
|
|
17746
|
-
|
|
17933
|
+
box3(rearGrip, 0.035, 0.1, 0.034, M.dark, 0, -0.05, 0);
|
|
17934
|
+
box3(group, 0.13, 0.04, 0.07, M.rubber, 0.28, -0.065, 0);
|
|
17935
|
+
box3(group, 0.16, 0.05, 0.045, M.dark, 0.56, 0.07, -0.035);
|
|
17747
17936
|
cylinderX(group, 0.016, 0.05, M.rubber, 0.46, 0.075, -0.035, 14);
|
|
17748
17937
|
cylinderX(group, 0.02, 4e-3, M.lens, 0.645, 0.075, -0.035, 14);
|
|
17749
|
-
|
|
17750
|
-
|
|
17751
|
-
|
|
17752
|
-
|
|
17938
|
+
box3(group, 0.06, 0.02, 0.02, M.metal, 0.56, 0.04, -0.03);
|
|
17939
|
+
box3(group, 0.22, 0.01, 0.02, M.dark, 0.6, 0.06, 0.03);
|
|
17940
|
+
box3(group, 0.01, 0.03, 0.02, M.dark, 0.5, 0.05, 0.03);
|
|
17941
|
+
box3(group, 0.01, 0.03, 0.02, M.dark, 0.7, 0.05, 0.03);
|
|
17753
17942
|
parts.makeRound = () => buildRecoillessRound(kit);
|
|
17754
17943
|
parts.muzzle = kit.pivot(group, 0.95, 0, 0);
|
|
17755
17944
|
parts.rear = kit.pivot(group, 0.05, 0, 0);
|
|
@@ -17800,37 +17989,37 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17800
17989
|
cylinderX(barrels, CLUSTER_RADIUS + BARREL_RADIUS * 1.8, 0.03, M.dark, BARREL_END - 0.015, 0, 0, 24);
|
|
17801
17990
|
}
|
|
17802
17991
|
function buildHousing(kit, parts, group) {
|
|
17803
|
-
const { M, box:
|
|
17804
|
-
|
|
17992
|
+
const { M, box: box3, cylinderX, cylinderZ } = kit;
|
|
17993
|
+
box3(group, 0.3, 0.14, 0.15, M.metal, 0.18, 0, 0);
|
|
17805
17994
|
cylinderX(group, 0.052, 0.12, M.dark, 0.06, 0, 0, 20);
|
|
17806
17995
|
cylinderX(group, 0.062, 0.2, M.dark, 0.38, 0, 0, 22);
|
|
17807
17996
|
for (let i = 0; i < 4; i++) cylinderX(group, 0.064, 8e-3, M.steel, 0.3 + i * 0.05, 0, 0, 22);
|
|
17808
|
-
|
|
17809
|
-
|
|
17810
|
-
|
|
17811
|
-
|
|
17997
|
+
box3(group, 0.04, 0.05, 0.2, M.dark, 0.1, 0.095, 0);
|
|
17998
|
+
box3(group, 0.2, 0.012, 0.045, M.dark, 0.22, 0.158, 0);
|
|
17999
|
+
box3(group, 0.012, 0.05, 0.045, M.dark, 0.13, 0.13, 0);
|
|
18000
|
+
box3(group, 0.012, 0.05, 0.045, M.dark, 0.31, 0.13, 0);
|
|
17812
18001
|
for (const side of [-1, 1]) {
|
|
17813
|
-
|
|
18002
|
+
box3(group, 0.03, 0.03, 0.1, M.poly, 0.06, -0.01, side * 0.14);
|
|
17814
18003
|
cylinderZ(group, 0.016, 0.07, M.poly, 0.06, -0.01, side * 0.2, 14);
|
|
17815
18004
|
}
|
|
17816
|
-
parts.trigger =
|
|
17817
|
-
parts.safety =
|
|
18005
|
+
parts.trigger = box3(group, 0.012, 0.02, 0.016, M.dark, 0.1, 0.085, 0.14, 0.3);
|
|
18006
|
+
parts.safety = box3(group, 0.014, 6e-3, 0.01, M.dark, 0.2, 0.073, -0.076, 0.4);
|
|
17818
18007
|
}
|
|
17819
18008
|
function buildFeed(kit, parts, group) {
|
|
17820
|
-
const { M, box:
|
|
18009
|
+
const { M, box: box3, cylinderX } = kit;
|
|
17821
18010
|
const belt = kit.pivot(group, 0.2, -0.13, -0.16);
|
|
17822
18011
|
parts.belt = belt;
|
|
17823
|
-
|
|
17824
|
-
|
|
18012
|
+
box3(belt, 0.16, 0.12, 0.1, M.olive, 0, 0, 0);
|
|
18013
|
+
box3(belt, 0.162, 0.012, 0.102, M.dark, 0, 0.056, 0);
|
|
17825
18014
|
for (let i = 0; i < 8; i++) cylinderX(belt, 46e-4, 0.04, M.brass, -0.07 + i * 0.02, 0.075, 0.04, 10);
|
|
17826
|
-
|
|
18015
|
+
box3(group, 0.1, 0.03, 0.1, M.metal, 0.22, -0.06, -0.1, 0, 0, 0.5);
|
|
17827
18016
|
const cover = kit.pivot(group, 0.1, 0.075, 0);
|
|
17828
18017
|
parts.cover = cover;
|
|
17829
|
-
|
|
18018
|
+
box3(cover, 0.24, 0.012, 0.15, M.metal, 0.12, 6e-3, 0);
|
|
17830
18019
|
const bolt = kit.pivot(group);
|
|
17831
18020
|
parts.bolt = bolt;
|
|
17832
18021
|
parts.stroke = 0.03;
|
|
17833
|
-
|
|
18022
|
+
box3(bolt, 0.03, 0.012, 0.012, M.steelL, 0.28, 0.02, 0.078);
|
|
17834
18023
|
}
|
|
17835
18024
|
function buildM134(kit) {
|
|
17836
18025
|
const group = kit.group();
|
|
@@ -17860,36 +18049,36 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17860
18049
|
|
|
17861
18050
|
// src/models/m2.ts
|
|
17862
18051
|
function buildM2(kit) {
|
|
17863
|
-
const { M, box:
|
|
18052
|
+
const { M, box: box3, cylinderX, cylinderZ } = kit;
|
|
17864
18053
|
const group = kit.group();
|
|
17865
18054
|
const parts = { family: "belt", kick: 2.2, stroke: 0.08, glow: [] };
|
|
17866
|
-
|
|
18055
|
+
box3(group, 0.52, 0.13, 0.12, M.metal, 0.36, 0, 0);
|
|
17867
18056
|
for (let i = 0; i < 5; i++) cylinderZ(group, 6e-3, 0.124, M.dark, 0.15 + i * 0.1, -0.03, 0, 10);
|
|
17868
18057
|
heatify(parts.glow, cylinderX(group, 0.016, 1.14, M.metal, 1.14, 0.01, 0, 16));
|
|
17869
18058
|
cylinderX(group, 0.034, 0.24, M.dark, 0.74, 0.01, 0, 16);
|
|
17870
18059
|
for (let i = 0; i < 6; i++) cylinderX(group, 0.036, 0.012, M.metal, 0.66 + i * 0.035, 0.01, 0, 16);
|
|
17871
18060
|
cylinderX(group, 0.022, 0.05, M.dark, 1.69, 0.01, 0, 16);
|
|
17872
|
-
|
|
17873
|
-
|
|
17874
|
-
|
|
18061
|
+
box3(group, 0.04, 0.09, 0.03, M.wood, 0.05, -0.02, 0.05);
|
|
18062
|
+
box3(group, 0.04, 0.09, 0.03, M.wood, 0.05, -0.02, -0.05);
|
|
18063
|
+
box3(group, 0.06, 0.02, 0.12, M.metal, 0.09, -0.02, 0);
|
|
17875
18064
|
const belt = kit.pivot(group, 0.38, -0.05, -0.12);
|
|
17876
18065
|
parts.belt = belt;
|
|
17877
|
-
|
|
18066
|
+
box3(belt, 0.16, 0.12, 0.09, M.olive, 0, 0, 0);
|
|
17878
18067
|
for (let i = 0; i < 8; i++) cylinderX(belt, 6e-3, 0.05, M.brass, -0.08 + i * 0.02, 0.08, 0.04, 8);
|
|
17879
18068
|
const cover = kit.pivot(group, 0.12, 0.065, 0);
|
|
17880
18069
|
parts.cover = cover;
|
|
17881
|
-
|
|
17882
|
-
|
|
18070
|
+
box3(cover, 0.4, 0.012, 0.12, M.metal, 0.2, 6e-3, 0);
|
|
18071
|
+
box3(group, 0.04, 0.05, 0.04, M.dark, 0.66, 0.1, 0);
|
|
17883
18072
|
const bolt = kit.pivot(group);
|
|
17884
18073
|
parts.bolt = bolt;
|
|
17885
|
-
|
|
18074
|
+
box3(bolt, 0.03, 0.03, 0.02, M.metal, 0.5, 0, 0.07);
|
|
17886
18075
|
const tripod = kit.group();
|
|
17887
18076
|
tripod.position.set(0.42, -0.1, 0);
|
|
17888
18077
|
group.add(tripod);
|
|
17889
|
-
|
|
17890
|
-
|
|
17891
|
-
|
|
17892
|
-
|
|
18078
|
+
box3(tripod, 0.03, 0.06, 0.03, M.metal, 0, 0, 0);
|
|
18079
|
+
box3(tripod, 0.012, 0.62, 0.012, M.metal, -0.2, -0.25, 0, 0.75);
|
|
18080
|
+
box3(tripod, 0.012, 0.62, 0.012, M.metal, 0.22, -0.25, 0.16, -0.75, 0, 0.3);
|
|
18081
|
+
box3(tripod, 0.012, 0.62, 0.012, M.metal, 0.22, -0.25, -0.16, -0.75, 0, -0.3);
|
|
17893
18082
|
parts.muzzle = kit.mark(group, 1.72, 0.01, 0);
|
|
17894
18083
|
parts.eject = kit.mark(group, 0.3, -0.07, 0);
|
|
17895
18084
|
return { group, parts };
|
|
@@ -17897,26 +18086,26 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17897
18086
|
|
|
17898
18087
|
// src/models/p90.ts
|
|
17899
18088
|
function buildP90(kit) {
|
|
17900
|
-
const { M, box:
|
|
18089
|
+
const { M, box: box3, cylinderX } = kit;
|
|
17901
18090
|
const group = kit.group();
|
|
17902
18091
|
const parts = { family: "p90", stroke: 0.04, kick: 0.6, glow: [] };
|
|
17903
|
-
|
|
17904
|
-
|
|
17905
|
-
|
|
17906
|
-
|
|
17907
|
-
|
|
18092
|
+
box3(group, 0.4, 0.07, 0.055, M.poly, 0.2, 0, 0);
|
|
18093
|
+
box3(group, 0.12, 0.075, 0.05, M.poly, 0.2, -0.07, 0);
|
|
18094
|
+
box3(group, 0.08, 0.04, 0.03, M.hole, 0.21, -0.06, 0);
|
|
18095
|
+
box3(group, 0.06, 0.13, 0.056, M.poly, 0.03, -0.03, 0);
|
|
18096
|
+
box3(group, 0.05, 0.03, 0.056, M.poly, 0.33, -0.04, 0);
|
|
17908
18097
|
heatify(parts.glow, cylinderX(group, 8e-3, 0.09, M.metal, 0.43, 0, 0, 16));
|
|
17909
18098
|
const magazine = kit.pivot(group, 0.22, 0.047, 0);
|
|
17910
18099
|
parts.mag = magazine;
|
|
17911
18100
|
parts.magDir = 1;
|
|
17912
18101
|
parts.magDrop = 0.08;
|
|
17913
|
-
|
|
18102
|
+
box3(magazine, 0.3, 0.022, 0.05, M.glass, 0, 0, 0);
|
|
17914
18103
|
for (let i = 0; i < 12; i++) cylinderX(magazine, 28e-4, 0.02, M.brass, -0.12 + i * 0.022, 0, 0, 6);
|
|
17915
18104
|
scope(kit, group, 1, 0.24, 0.06, 0);
|
|
17916
18105
|
const bolt = kit.pivot(group);
|
|
17917
18106
|
parts.bolt = bolt;
|
|
17918
|
-
|
|
17919
|
-
parts.trigger =
|
|
18107
|
+
box3(bolt, 0.02, 0.012, 0.012, M.dark, 0.3, 0.02, 0.03);
|
|
18108
|
+
parts.trigger = box3(group, 4e-3, 0.016, 4e-3, M.dark, 0.24, -0.045, 0);
|
|
17920
18109
|
parts.muzzle = kit.mark(group, 0.48, 0, 0);
|
|
17921
18110
|
parts.eject = kit.mark(group, 0.2, -0.07, 0);
|
|
17922
18111
|
return { group, parts };
|
|
@@ -17938,28 +18127,28 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17938
18127
|
// src/models/pistol-slide.ts
|
|
17939
18128
|
var PI5 = Math.PI;
|
|
17940
18129
|
function buildSlide(kit, slide2, parts, options, style, size, metal2) {
|
|
17941
|
-
const { M, box:
|
|
18130
|
+
const { M, box: box3, cylinderX } = kit;
|
|
17942
18131
|
const { length: L, width: w } = size;
|
|
17943
18132
|
const slideHeight = style.inset ? size.height * 0.92 : size.height;
|
|
17944
18133
|
const slideWidth = style.inset ? w * 0.86 : w;
|
|
17945
18134
|
kit.roundness = style.rf;
|
|
17946
|
-
if (style.tri)
|
|
18135
|
+
if (style.tri) box3(slide2, L * 0.42, slideHeight, slideWidth, metal2, L * 0.21, 0, 0);
|
|
17947
18136
|
else if (style.open) {
|
|
17948
|
-
|
|
17949
|
-
|
|
17950
|
-
} else
|
|
17951
|
-
if (style.slope)
|
|
18137
|
+
box3(slide2, L * 0.45, slideHeight, slideWidth, metal2, L * 0.225, 0, 0);
|
|
18138
|
+
box3(slide2, L * 0.55, slideHeight * 0.62, slideWidth, metal2, L * 0.72, -slideHeight * 0.19, 0);
|
|
18139
|
+
} else box3(slide2, L, slideHeight, slideWidth, metal2, L / 2, 0, 0);
|
|
18140
|
+
if (style.slope) box3(slide2, L * 0.25, slideHeight * 0.5, slideWidth * 0.98, metal2, L * 0.86, slideHeight * 0.35, 0, -0.22);
|
|
17952
18141
|
kit.roundness = null;
|
|
17953
|
-
for (let i = 0; i < (style.flush ? 9 : 7); i++)
|
|
17954
|
-
if (style.frontSer) for (let i = 0; i < 5; i++)
|
|
18142
|
+
for (let i = 0; i < (style.flush ? 9 : 7); i++) box3(slide2, 22e-4, slideHeight * 0.72, slideWidth + 14e-4, M.dark, 7e-3 + i * 52e-4, -2e-3, 0, 0);
|
|
18143
|
+
if (style.frontSer) for (let i = 0; i < 5; i++) box3(slide2, 22e-4, slideHeight * 0.6, slideWidth + 14e-4, M.dark, L * 0.76 + i * 52e-4, -3e-3, 0);
|
|
17955
18144
|
if (style.port) {
|
|
17956
|
-
|
|
17957
|
-
|
|
17958
|
-
|
|
18145
|
+
box3(slide2, L * style.port, 4e-3, slideWidth * 0.55, M.hole, L * 0.6, slideHeight / 2 - 1e-3, slideWidth * 0.12);
|
|
18146
|
+
box3(slide2, L * style.port * 0.85, 3e-3, slideWidth * 0.4, M.steelL, L * 0.6, slideHeight / 2 - 4e-4, slideWidth * 0.1);
|
|
18147
|
+
box3(slide2, 0.012, 4e-3, 2e-3, M.dark, L * 0.55, slideHeight * 0.15, slideWidth / 2 + 8e-4);
|
|
17959
18148
|
}
|
|
17960
18149
|
if (style.open) {
|
|
17961
18150
|
heatify(parts.glow, cylinderX(slide2, 62e-4, L * 0.56, M.steelL, L * 0.7, slideHeight * 0.12, 0, 18));
|
|
17962
|
-
|
|
18151
|
+
box3(slide2, 0.03, 4e-3, slideWidth * 0.6, M.hole, L * 0.48, slideHeight / 2 - 1e-3, 0);
|
|
17963
18152
|
}
|
|
17964
18153
|
if (style.tri) {
|
|
17965
18154
|
const tube = new kit.THREE.Mesh(new kit.THREE.CylinderGeometry(0.016, 0.016, L * 0.6, 3), metal2);
|
|
@@ -17969,8 +18158,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17969
18158
|
tube.position.set(L * 0.7, slideHeight * 0.08, 0);
|
|
17970
18159
|
slide2.add(tube);
|
|
17971
18160
|
heatify(parts.glow, tube);
|
|
17972
|
-
|
|
17973
|
-
for (let i = 0; i < 6; i++)
|
|
18161
|
+
box3(slide2, L * 0.6, 6e-3, 0.012, metal2, L * 0.7, slideHeight * 0.38, 0);
|
|
18162
|
+
for (let i = 0; i < 6; i++) box3(slide2, 8e-3, 3e-3, 0.013, M.hole, L * 0.45 + i * 0.04, slideHeight * 0.41, 0);
|
|
17974
18163
|
}
|
|
17975
18164
|
if (style.bushing) {
|
|
17976
18165
|
heatify(parts.glow, cylinderX(slide2, 78e-4, 6e-3, M.steelL, L + 2e-3, 1e-3, 0, 18));
|
|
@@ -17981,22 +18170,22 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
17981
18170
|
cylinderX(slide2, 34e-4, 5e-3, M.hole, L + 25e-4, muzzleY, 0, 12);
|
|
17982
18171
|
const top = slideHeight / 2;
|
|
17983
18172
|
if (style.sight === "u" || style.sight === "3dot") {
|
|
17984
|
-
|
|
17985
|
-
|
|
17986
|
-
|
|
17987
|
-
if (style.sight === "u")
|
|
17988
|
-
else
|
|
18173
|
+
box3(slide2, 4e-3, 7e-3, 4e-3, M.dark, L - 8e-3, top + 35e-4, 0);
|
|
18174
|
+
box3(slide2, 22e-4, 22e-4, 46e-4, M.white, L - 8e-3, top + 58e-4, 0);
|
|
18175
|
+
box3(slide2, 8e-3, 7e-3, 0.016, M.dark, 9e-3, top + 35e-4, 0);
|
|
18176
|
+
if (style.sight === "u") box3(slide2, 4e-3, 2e-3, 0.0122, M.white, 9e-3, top + 6e-3, 0);
|
|
18177
|
+
else box3(slide2, 22e-4, 22e-4, 0.0166, M.white, 9e-3, top + 58e-4, 0);
|
|
17989
18178
|
} else {
|
|
17990
|
-
|
|
17991
|
-
|
|
18179
|
+
box3(slide2, 6e-3, 4e-3, 3e-3, M.dark, L - 6e-3, top + 2e-3, 0);
|
|
18180
|
+
box3(slide2, 6e-3, 4e-3, 0.012, M.dark, 8e-3, top + 2e-3, 0);
|
|
17992
18181
|
}
|
|
17993
18182
|
if (style.decock === "slide") {
|
|
17994
|
-
|
|
17995
|
-
|
|
18183
|
+
box3(slide2, 0.012, 8e-3, 4e-3, M.dark, 0.02, slideHeight * 0.15, slideWidth / 2 + 2e-3, 0.3);
|
|
18184
|
+
box3(slide2, 0.012, 8e-3, 4e-3, M.dark, 0.02, slideHeight * 0.15, -slideWidth / 2 - 2e-3, 0.3);
|
|
17996
18185
|
}
|
|
17997
|
-
if (style.safety === "slide") parts.safety =
|
|
18186
|
+
if (style.safety === "slide") parts.safety = box3(slide2, 0.012, 8e-3, 4e-3, M.dark, 0.018, slideHeight * 0.1, -slideWidth / 2 - 2e-3, 0.2);
|
|
17998
18187
|
if (options.sel) {
|
|
17999
|
-
const selector =
|
|
18188
|
+
const selector = box3(slide2, 0.01, 8e-3, 3e-3, M.dark, 0.014, -slideHeight * 0.2, slideWidth / 2 + 14e-4);
|
|
18000
18189
|
parts.safety ?? (parts.safety = selector);
|
|
18001
18190
|
}
|
|
18002
18191
|
}
|
|
@@ -18019,29 +18208,29 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18019
18208
|
// src/models/pistol.ts
|
|
18020
18209
|
var PI6 = Math.PI;
|
|
18021
18210
|
function buildFrame(kit, group, parts, options, style, size, materials) {
|
|
18022
|
-
const { M, box:
|
|
18211
|
+
const { M, box: box3, cylinderZ, sphere: sphere2 } = kit;
|
|
18023
18212
|
const { length: L, height: h, width: w } = size;
|
|
18024
18213
|
const fm = materials.frame;
|
|
18025
18214
|
if (style.inset) {
|
|
18026
|
-
|
|
18027
|
-
|
|
18215
|
+
box3(group, L * 0.9, h * 0.35, w * 0.12, fm, L * 0.47, -h * 0.32, w * 0.47);
|
|
18216
|
+
box3(group, L * 0.9, h * 0.35, w * 0.12, fm, L * 0.47, -h * 0.32, -w * 0.47);
|
|
18028
18217
|
}
|
|
18029
18218
|
const frameLength = style.tri ? L * 0.66 : L * 0.8;
|
|
18030
18219
|
kit.roundness = style.rf;
|
|
18031
|
-
|
|
18220
|
+
box3(group, frameLength, 0.016, w * 0.92, fm, frameLength / 2 + L * 0.06, -h / 2 - 8e-3, 0);
|
|
18032
18221
|
kit.roundness = null;
|
|
18033
|
-
if (style.rail) for (let i = 0; i < (style.slope ? 5 : 3); i++)
|
|
18222
|
+
if (style.rail) for (let i = 0; i < (style.slope ? 5 : 3); i++) box3(group, 4e-3, 3e-3, w * 0.96, M.dark, L * 0.62 + i * 9e-3, -h / 2 - 0.017, 0);
|
|
18034
18223
|
const isGlock = options.st === "glock" || !options.st;
|
|
18035
18224
|
if (isGlock) {
|
|
18036
|
-
|
|
18037
|
-
|
|
18225
|
+
box3(group, 8e-3, 4e-3, 3e-3, M.dark, L * 0.5, -h / 2 - 3e-3, -w / 2 - 12e-4);
|
|
18226
|
+
box3(group, 8e-3, 4e-3, 3e-3, M.dark, L * 0.5, -h / 2 - 3e-3, w / 2 + 12e-4);
|
|
18038
18227
|
}
|
|
18039
18228
|
if (style.slideStop) {
|
|
18040
|
-
|
|
18041
|
-
|
|
18042
|
-
} else
|
|
18043
|
-
if (style.decock === "frame")
|
|
18044
|
-
if (style.safety === "thumb") parts.safety =
|
|
18229
|
+
box3(group, 0.03, 6e-3, 3e-3, M.dark, L * 0.42, -h / 2 - 2e-3, -w / 2 - 14e-4);
|
|
18230
|
+
sphere2(group, 28e-4, M.dark, L * 0.55, -h / 2 - 3e-3, w / 2 + 1e-3, 1);
|
|
18231
|
+
} else box3(group, 0.012, 4e-3, 3e-3, M.dark, L * 0.45, -h / 2 - 3e-3, -w / 2 - 12e-4);
|
|
18232
|
+
if (style.decock === "frame") box3(group, 0.01, 0.012, 3e-3, M.dark, L * 0.38, -h / 2 - 0.012, -w / 2 - 14e-4, 0.6);
|
|
18233
|
+
if (style.safety === "thumb") parts.safety = box3(group, 0.014, 6e-3, 4e-3, M.dark, 0.02, -h / 2 - 2e-3, -w / 2 - 16e-4);
|
|
18045
18234
|
const gripLength = options.gl ?? 0.105;
|
|
18046
18235
|
const gx = 0.034 + (L - 0.2) * 0.15;
|
|
18047
18236
|
const gy = -h / 2 - gripLength / 2 + 6e-3;
|
|
@@ -18051,41 +18240,41 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18051
18240
|
const gripDepth = style.grip === "chunky" ? 0.036 : 0.032;
|
|
18052
18241
|
kit.roundness = 0.3;
|
|
18053
18242
|
if (style.grip === "wood" || style.grip === "star") {
|
|
18054
|
-
|
|
18055
|
-
|
|
18056
|
-
|
|
18243
|
+
box3(grip, gripDepth * 0.86, gripLength, w * 0.9, fm, 0, 0, 0);
|
|
18244
|
+
box3(grip, gripDepth * 0.8, gripLength * 0.86, 4e-3, materials.grip, 1e-3, -2e-3, w * 0.47);
|
|
18245
|
+
box3(grip, gripDepth * 0.8, gripLength * 0.86, 4e-3, materials.grip, 1e-3, -2e-3, -w * 0.47);
|
|
18057
18246
|
if (style.grip === "wood") {
|
|
18058
|
-
for (let i = 0; i < 6; i++) for (let j = 0; j < 2; j++)
|
|
18247
|
+
for (let i = 0; i < 6; i++) for (let j = 0; j < 2; j++) box3(grip, 3e-3, 3e-3, 12e-4, M.woodL, -6e-3 + j * 0.012, -gripLength * 0.3 + i * 0.012, w * 0.495, 0, 0, 0);
|
|
18059
18248
|
cylinderZ(grip, 35e-4, 15e-4, M.brass, 0, gripLength * 0.25, w * 0.5, 10);
|
|
18060
18249
|
cylinderZ(grip, 35e-4, 15e-4, M.brass, 0, -gripLength * 0.3, w * 0.5, 10);
|
|
18061
18250
|
} else cylinderZ(grip, 8e-3, 15e-4, M.dark, 0, gripLength * 0.1, w * 0.5, 5);
|
|
18062
|
-
} else
|
|
18251
|
+
} else box3(grip, gripDepth, gripLength, gripWidth, materials.grip, 0, 0, 0);
|
|
18063
18252
|
kit.roundness = null;
|
|
18064
18253
|
if (style.grip === "finger") {
|
|
18065
|
-
for (let i = 0; i < 3; i++)
|
|
18066
|
-
for (let i = 0; i < 5; i++) for (let j = 0; j < 3; j++)
|
|
18254
|
+
for (let i = 0; i < 3; i++) box3(grip, 6e-3, 0.012, gripWidth * 0.98, materials.grip, gripDepth / 2 + 2e-3, gripLength * 0.18 - i * 0.022, 0);
|
|
18255
|
+
for (let i = 0; i < 5; i++) for (let j = 0; j < 3; j++) box3(grip, 3e-3, 3e-3, 12e-4, M.dark, -8e-3 + j * 8e-3, -gripLength * 0.25 + i * 0.012, gripWidth / 2 + 4e-4);
|
|
18067
18256
|
}
|
|
18068
|
-
if (style.grip === "panel" || style.grip === "rubber" || style.grip === "chunky") for (let i = 0; i < 6; i++)
|
|
18069
|
-
if (style.grip === "chunky")
|
|
18257
|
+
if (style.grip === "panel" || style.grip === "rubber" || style.grip === "chunky") for (let i = 0; i < 6; i++) box3(grip, gripDepth * 0.75, 25e-4, gripWidth + 1e-3, M.dark, 2e-3, -gripLength / 2 + 0.018 + i * 0.013, 0);
|
|
18258
|
+
if (style.grip === "chunky") box3(grip, 8e-3, gripLength * 0.8, gripWidth * 0.9, materials.grip, gripDepth / 2 + 2e-3, -4e-3, 0);
|
|
18070
18259
|
if (style.beaver) {
|
|
18071
|
-
|
|
18072
|
-
|
|
18073
|
-
} else
|
|
18260
|
+
box3(group, 0.026, 8e-3, w * 0.9, fm, -4e-3, -h / 2 - 4e-3, 0, 0.25);
|
|
18261
|
+
box3(grip, 6e-3, gripLength * 0.55, w * 0.9, fm, -gripDepth * 0.5 - 2e-3, gripLength * 0.18, 0);
|
|
18262
|
+
} else box3(group, 0.02, 9e-3, w * 0.9, fm, 4e-3, -h / 2 - 6e-3, 0);
|
|
18074
18263
|
if (style.lanyard) {
|
|
18075
|
-
const
|
|
18076
|
-
|
|
18264
|
+
const ring3 = kit.torus(grip, new kit.THREE.TorusGeometry(5e-3, 13e-4, 6, 12), M.dark, -0.012, -gripLength / 2 + 4e-3, 0);
|
|
18265
|
+
ring3.position.set(-0.012, -gripLength / 2 + 4e-3, 0);
|
|
18077
18266
|
}
|
|
18078
18267
|
const magazine = kit.pivot(grip);
|
|
18079
18268
|
parts.mag = magazine;
|
|
18080
18269
|
parts.magDrop = gripLength * 1.15;
|
|
18081
|
-
|
|
18082
|
-
if (style.grip === "chunky")
|
|
18083
|
-
else if (style.flush || style.grip === "wood")
|
|
18084
|
-
else
|
|
18270
|
+
box3(magazine, 0.022, gripLength * 0.94, w * 0.72, M.dark, 3e-3, -4e-3, 0);
|
|
18271
|
+
if (style.grip === "chunky") box3(magazine, 0.04, 0.01, gripWidth * 1.02, M.poly, 3e-3, -gripLength / 2 - 4e-3, 0);
|
|
18272
|
+
else if (style.flush || style.grip === "wood") box3(magazine, 0.028, 4e-3, w * 0.9, M.steel, 3e-3, -gripLength / 2 - 1e-3, 0);
|
|
18273
|
+
else box3(magazine, 0.031, 6e-3, gripWidth * 1.02, M.dark, 3e-3, -gripLength / 2 - 2e-3, 0);
|
|
18085
18274
|
return { gx, ty: -h / 2 };
|
|
18086
18275
|
}
|
|
18087
18276
|
function buildPistol(kit, options) {
|
|
18088
|
-
const { M, box:
|
|
18277
|
+
const { M, box: box3 } = kit;
|
|
18089
18278
|
const style = { ...STYLES[options.st ?? "glock"] };
|
|
18090
18279
|
const group = kit.group();
|
|
18091
18280
|
const parts = { family: "pistol", kick: options.deagle ? 1.8 : 0.6, glow: [] };
|
|
@@ -18100,31 +18289,31 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18100
18289
|
buildSlide(kit, slide2, parts, options, style, size, slideMetal);
|
|
18101
18290
|
const { gx, ty } = buildFrame(kit, group, parts, options, style, size, { frame: frameMetal, grip: gripMaterial });
|
|
18102
18291
|
if (style.guard === "square") {
|
|
18103
|
-
|
|
18104
|
-
|
|
18105
|
-
|
|
18292
|
+
box3(group, 0.046, 4e-3, 9e-3, frameMetal, gx + 0.05, ty - 0.034, 0);
|
|
18293
|
+
box3(group, 4e-3, 0.03, 9e-3, frameMetal, gx + 0.074, ty - 0.02, 0);
|
|
18294
|
+
box3(group, 6e-3, 4e-3, 9e-3, frameMetal, gx + 0.075, ty - 0.034, 0);
|
|
18106
18295
|
} else if (style.guard === "hook") {
|
|
18107
|
-
|
|
18108
|
-
|
|
18109
|
-
|
|
18296
|
+
box3(group, 0.046, 4e-3, 9e-3, frameMetal, gx + 0.05, ty - 0.034, 0);
|
|
18297
|
+
box3(group, 4e-3, 0.03, 9e-3, frameMetal, gx + 0.073, ty - 0.02, 0, 0.2);
|
|
18298
|
+
box3(group, 8e-3, 6e-3, 9e-3, frameMetal, gx + 0.074, ty - 0.037, 0, 0.4);
|
|
18110
18299
|
} else {
|
|
18111
18300
|
const guard = kit.torus(group, new kit.THREE.TorusGeometry(0.019, 22e-4, 6, 16, PI6), frameMetal, gx + 0.05, ty - 0.014, 0);
|
|
18112
18301
|
guard.rotation.z = PI6;
|
|
18113
18302
|
guard.scale.set(1.2, 1, 1);
|
|
18114
18303
|
}
|
|
18115
18304
|
const isGlock = options.st === "glock" || !options.st;
|
|
18116
|
-
parts.trigger =
|
|
18117
|
-
if (isGlock)
|
|
18305
|
+
parts.trigger = box3(group, 4e-3, 0.014, 4e-3, isGlock ? M.dark : M.steel, gx + 0.042, ty - 0.022, 0, 0.2);
|
|
18306
|
+
if (isGlock) box3(parts.trigger, 15e-4, 8e-3, 45e-4, M.metal, 0, -1e-3, 0);
|
|
18118
18307
|
if (style.hammer) {
|
|
18119
18308
|
const hammer = kit.pivot(group, 3e-3, h / 2 - 8e-3, 0);
|
|
18120
18309
|
parts.hammer = hammer;
|
|
18121
18310
|
if (style.hammer === "ring") {
|
|
18122
|
-
|
|
18311
|
+
box3(hammer, 6e-3, 0.012, 6e-3, M.dark, -2e-3, 4e-3, 0, 0.3);
|
|
18123
18312
|
kit.torus(hammer, new kit.THREE.TorusGeometry(45e-4, 16e-4, 6, 12), M.dark, -4e-3, 0.012, 0);
|
|
18124
|
-
} else if (style.hammer === "big")
|
|
18313
|
+
} else if (style.hammer === "big") box3(hammer, 0.014, 0.02, 9e-3, M.dark, -4e-3, 7e-3, 0, 0.35);
|
|
18125
18314
|
else {
|
|
18126
|
-
|
|
18127
|
-
|
|
18315
|
+
box3(hammer, 8e-3, 0.016, 7e-3, M.dark, -2e-3, 6e-3, 0, 0.3);
|
|
18316
|
+
box3(hammer, 8e-3, 4e-3, 8e-3, M.dark, -6e-3, 0.013, 0, 0.3);
|
|
18128
18317
|
}
|
|
18129
18318
|
}
|
|
18130
18319
|
parts.muzzle = kit.mark(group, L + 6e-3, style.tri ? h * 0.08 : 2e-3, 0);
|
|
@@ -18136,45 +18325,45 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18136
18325
|
var PI7 = Math.PI;
|
|
18137
18326
|
var DEFAULT_CHAMBERS = 6;
|
|
18138
18327
|
function buildRevolver(kit, options) {
|
|
18139
|
-
const { M, box:
|
|
18328
|
+
const { M, box: box3, cylinderX } = kit;
|
|
18140
18329
|
const group = kit.group();
|
|
18141
18330
|
const parts = { family: "revolver", kick: options.cal === ".44 Magnum" ? 1.5 : 0.9, glow: [] };
|
|
18142
18331
|
const barrel = (options.B ?? 0) / 1e3;
|
|
18143
18332
|
const chambers = options.chambers ?? DEFAULT_CHAMBERS;
|
|
18144
18333
|
const metal2 = options.steel ? M.steel : M.metal;
|
|
18145
|
-
|
|
18146
|
-
|
|
18147
|
-
|
|
18334
|
+
box3(group, 0.08, 0.044, 0.024, metal2, 0.07, 0, 0);
|
|
18335
|
+
box3(group, 0.036, 0.012, 0.022, metal2, 0.096, 0.022, 0);
|
|
18336
|
+
box3(group, 0.024, 0.012, 4e-3, M.dark, 0.055, 6e-3, -0.013);
|
|
18148
18337
|
const crane = kit.pivot(group, 0.077, -0.024, 0);
|
|
18149
18338
|
parts.crane = crane;
|
|
18150
|
-
const
|
|
18151
|
-
parts.cylinder =
|
|
18152
|
-
cylinderX(
|
|
18339
|
+
const cylinder2 = kit.pivot(crane, 0, 0.022, 0);
|
|
18340
|
+
parts.cylinder = cylinder2;
|
|
18341
|
+
cylinderX(cylinder2, 0.0215, 0.042, metal2, 0, 0, 0, 24);
|
|
18153
18342
|
for (let i = 0; i < chambers; i++) {
|
|
18154
18343
|
const angle = i * 2 * PI7 / chambers;
|
|
18155
|
-
|
|
18344
|
+
box3(cylinder2, 0.026, 5e-3, 5e-3, M.dark, 0, Math.cos(angle) * 0.0205, Math.sin(angle) * 0.0205, 0, 0, angle);
|
|
18156
18345
|
}
|
|
18157
18346
|
parts.chambers = [];
|
|
18158
18347
|
for (let i = 0; i < chambers; i++) {
|
|
18159
18348
|
const angle = i * 2 * PI7 / chambers + PI7 / chambers;
|
|
18160
|
-
parts.chambers.push(kit.mark(
|
|
18161
|
-
cylinderX(
|
|
18349
|
+
parts.chambers.push(kit.mark(cylinder2, -0.022, Math.cos(angle) * 0.013, Math.sin(angle) * 0.013));
|
|
18350
|
+
cylinderX(cylinder2, 46e-4, 2e-3, M.brass, -0.0215, Math.cos(angle) * 0.013, Math.sin(angle) * 0.013, 12);
|
|
18162
18351
|
}
|
|
18163
18352
|
heatify(parts.glow, cylinderX(group, 88e-4, barrel, metal2, 0.112 + barrel / 2, 9e-3, 0, 18));
|
|
18164
|
-
|
|
18353
|
+
box3(group, barrel * 0.92, 0.015, 0.013, metal2, 0.112 + barrel * 0.46, -5e-3, 0);
|
|
18165
18354
|
cylinderX(group, 4e-3, 5e-3, M.hole, 0.112 + barrel + 15e-4, 9e-3, 0, 12);
|
|
18166
|
-
|
|
18167
|
-
|
|
18355
|
+
box3(group, 0.012, 9e-3, 4e-3, M.dark, 0.112 + barrel - 8e-3, 0.021, 0, -0.3);
|
|
18356
|
+
box3(group, 0.012, 6e-3, 0.012, M.dark, 0.105, 0.031, 0);
|
|
18168
18357
|
const hammer = kit.pivot(group, 0.036, 0.018, 0);
|
|
18169
|
-
|
|
18358
|
+
box3(hammer, 0.01, 0.02, 8e-3, M.dark, -4e-3, 8e-3, 0, 0.45);
|
|
18170
18359
|
parts.hammer = hammer;
|
|
18171
18360
|
const grip = kit.pivot(group, 0.024, -0.062, 0);
|
|
18172
18361
|
grip.rotation.z = -0.38;
|
|
18173
|
-
|
|
18174
|
-
if (!options.wood) for (let i = 0; i < 4; i++)
|
|
18175
|
-
|
|
18176
|
-
|
|
18177
|
-
parts.trigger =
|
|
18362
|
+
box3(grip, 0.034, 0.1, 0.031, options.wood ? M.wood : M.rubber, 0, 0, 0);
|
|
18363
|
+
if (!options.wood) for (let i = 0; i < 4; i++) box3(grip, 6e-3, 0.07, 0.033, M.dark, -0.012 + i * 8e-3, 0, 0);
|
|
18364
|
+
box3(group, 0.038, 4e-3, 8e-3, metal2, 0.062, -0.036, 0);
|
|
18365
|
+
box3(group, 4e-3, 0.022, 8e-3, metal2, 0.08, -0.026, 0, 0.2);
|
|
18366
|
+
parts.trigger = box3(group, 4e-3, 0.015, 4e-3, M.dark, 0.06, -0.027, 0, 0.2);
|
|
18178
18367
|
parts.muzzle = kit.mark(group, 0.112 + barrel + 6e-3, 9e-3, 0);
|
|
18179
18368
|
parts.eject = kit.mark(group, 0.077, 0, 0);
|
|
18180
18369
|
return { group, parts };
|
|
@@ -18182,11 +18371,11 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18182
18371
|
|
|
18183
18372
|
// src/models/attachments/muzzle-brake.ts
|
|
18184
18373
|
function buildBrake(kit, parent, kind, x, y, barrelRadius, heat = () => void 0) {
|
|
18185
|
-
const { M, box:
|
|
18374
|
+
const { M, box: box3, cylinderX } = kit;
|
|
18186
18375
|
const scale = kind === 2 ? 3.2 : 2;
|
|
18187
18376
|
const length2 = kind === 2 ? 0.12 : 0.06;
|
|
18188
18377
|
heat(cylinderX(parent, barrelRadius * scale, length2, M.dark, x - length2 / 2, y, 0, kind === 2 ? 8 : 16));
|
|
18189
|
-
for (let i = 0; i < 3; i++)
|
|
18378
|
+
for (let i = 0; i < 3; i++) box3(parent, length2 * 0.16, barrelRadius * scale * 1.3, barrelRadius * scale * 2.2, M.hole, x - length2 * 0.25 - i * length2 * 0.25, y, 0);
|
|
18190
18379
|
}
|
|
18191
18380
|
|
|
18192
18381
|
// src/models/capture.ts
|
|
@@ -18201,13 +18390,13 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18201
18390
|
|
|
18202
18391
|
// src/models/attachments/bipod.ts
|
|
18203
18392
|
function buildBipod(kit, parent, x, y) {
|
|
18204
|
-
const { M, box:
|
|
18393
|
+
const { M, box: box3, cylinderX } = kit;
|
|
18205
18394
|
cylinderX(parent, 8e-3, 0.02, M.dark, x, y, 0, 12);
|
|
18206
18395
|
for (const side of [-1, 1]) {
|
|
18207
18396
|
const leg = kit.pivot(parent, x, y, side * 0.012);
|
|
18208
18397
|
leg.rotation.set(side * 0.15, 0, -0.35);
|
|
18209
|
-
|
|
18210
|
-
|
|
18398
|
+
box3(leg, 6e-3, 0.2, 6e-3, M.dark, 0, -0.1, 0);
|
|
18399
|
+
box3(leg, 0.01, 6e-3, 0.01, M.rubber, 0, -0.2, 0);
|
|
18211
18400
|
}
|
|
18212
18401
|
}
|
|
18213
18402
|
var buildBipodModel = ({ kit }) => {
|
|
@@ -18220,13 +18409,13 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18220
18409
|
var SCOPE_IDS = { 1: "red_dot", 2: "acog_4x", 3: "scope_3_9x", 4: "scope_6_24x" };
|
|
18221
18410
|
function buildFittings(context, gripX) {
|
|
18222
18411
|
const { kit, group, parts, options: o, furniture: furn, length: L, receiverStart: x0, receiverEnd: x1, receiverHeight: hR, receiverWidth: wR, barrelRadius: r, barrelY: by } = context;
|
|
18223
|
-
const { M, box:
|
|
18412
|
+
const { M, box: box3, cylinderX, cylinderZ, sphere: sphere2 } = kit;
|
|
18224
18413
|
const middle = (x0 + x1) / 2;
|
|
18225
18414
|
if (o.scope) recordFitting(parts, SCOPE_IDS[o.scope] ?? "scope", group, () => scope(kit, group, o.scope, middle + 0.03, hR / 2 + (o.rail ? 6e-3 : 0), o.scope === 4 ? -0.02 : 0));
|
|
18226
18415
|
if (o.carry) {
|
|
18227
|
-
|
|
18228
|
-
|
|
18229
|
-
|
|
18416
|
+
box3(group, 0.15, 0.026, 0.014, M.metal, middle, hR / 2 + 0.03, 0);
|
|
18417
|
+
box3(group, 0.012, 0.03, 0.014, M.metal, middle + 0.07, hR / 2 + 0.014, 0);
|
|
18418
|
+
box3(group, 0.012, 0.03, 0.014, M.metal, middle - 0.07, hR / 2 + 0.014, 0);
|
|
18230
18419
|
}
|
|
18231
18420
|
if (o.bipod) recordFitting(parts, "bipod", group, () => buildBipod(kit, group, x1 + (L - x1) * 0.45 + 0.04, by - 0.012));
|
|
18232
18421
|
if (o.bolt) {
|
|
@@ -18234,17 +18423,17 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18234
18423
|
parts.boltHandle = handle;
|
|
18235
18424
|
parts.boltHandleRest = handle.position.x;
|
|
18236
18425
|
cylinderZ(handle, 42e-4, 0.05, M.steelL, 0, 0, wR / 2 + 0.022, 12);
|
|
18237
|
-
|
|
18426
|
+
sphere2(handle, 95e-4, M.dark, 0, -4e-3, wR / 2 + 0.048, 1);
|
|
18238
18427
|
cylinderX(group, hR * 0.3, 0.03, M.steel, x0 + 5e-3, by, 0, 16);
|
|
18239
18428
|
}
|
|
18240
18429
|
if (o.lever) {
|
|
18241
18430
|
const lever = kit.pivot(group, gripX - 0.02, -hR / 2 - 0.01, 0);
|
|
18242
18431
|
parts.lever = lever;
|
|
18243
|
-
|
|
18244
|
-
|
|
18245
|
-
|
|
18246
|
-
|
|
18247
|
-
|
|
18432
|
+
box3(lever, 0.11, 6e-3, 0.012, M.metal, 0.055, -0.052, 0);
|
|
18433
|
+
box3(lever, 6e-3, 0.05, 0.012, M.metal, 3e-3, -0.028, 0);
|
|
18434
|
+
box3(lever, 6e-3, 0.05, 0.012, M.metal, 0.108, -0.028, 0);
|
|
18435
|
+
box3(lever, 0.04, 6e-3, 0.012, M.metal, 0.08, -2e-3, 0);
|
|
18436
|
+
box3(group, 0.03, 0.012, 3e-3, M.dark, x1 - 0.04, by, wR / 2 + 1e-3);
|
|
18248
18437
|
}
|
|
18249
18438
|
if (o.tube) {
|
|
18250
18439
|
const tubeLength = (L - x1) * (o.tubeLen || 0.8);
|
|
@@ -18254,14 +18443,14 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18254
18443
|
if (o.pump) {
|
|
18255
18444
|
const pump = kit.pivot(group);
|
|
18256
18445
|
parts.pump = pump;
|
|
18257
|
-
|
|
18258
|
-
for (let i = 0; i < 8; i++)
|
|
18446
|
+
box3(pump, 0.17, 0.042, 0.046, furn, x1 + 0.14, by - 0.022, 0);
|
|
18447
|
+
for (let i = 0; i < 8; i++) box3(pump, 6e-3, 0.044, 0.048, M.dark, x1 + 0.07 + i * 0.02, by - 0.022, 0);
|
|
18259
18448
|
}
|
|
18260
18449
|
if (o.heat) {
|
|
18261
18450
|
cylinderX(group, r * 1.75, (L - x1) * 0.7, M.dark, x1 + (L - x1) * 0.4, by, 0, 12);
|
|
18262
|
-
for (let i = 0; i < 10; i++)
|
|
18451
|
+
for (let i = 0; i < 10; i++) box3(group, 8e-3, r * 1.5, 4e-3, M.hole, x1 + (L - x1) * (0.1 + i * 0.06), by + r * 0.8, r * 1.5);
|
|
18263
18452
|
}
|
|
18264
|
-
if (o.bayo)
|
|
18453
|
+
if (o.bayo) box3(group, 0.025, 8e-3, 0.01, M.metal, L - 0.07, by - 0.016, 0);
|
|
18265
18454
|
if (o.rod) cylinderX(group, 3e-3, (L - x1) * 0.85, M.steel, x1 + (L - x1) * 0.45, by - 0.014, 0, 8);
|
|
18266
18455
|
}
|
|
18267
18456
|
|
|
@@ -18269,14 +18458,14 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18269
18458
|
var PI8 = Math.PI;
|
|
18270
18459
|
function buildForend(context) {
|
|
18271
18460
|
const { kit, group, options: o, furniture: furn, length: L, receiverEnd: x1, receiverHeight: hR, receiverWidth: wR, barrelRadius: r, barrelY: by } = context;
|
|
18272
|
-
const { M, box:
|
|
18461
|
+
const { M, box: box3 } = kit;
|
|
18273
18462
|
const hasLongScope = (o.scope ?? 0) >= 3;
|
|
18274
18463
|
if (!context.isTraditional && o.hg !== "none") {
|
|
18275
18464
|
const handguardLength = (L - x1) * (o.hgFrac || 0.5);
|
|
18276
18465
|
const hx = x1 + handguardLength / 2;
|
|
18277
18466
|
const hh = hR * 0.8;
|
|
18278
18467
|
if (o.hg === "rail") {
|
|
18279
|
-
|
|
18468
|
+
box3(group, handguardLength, hh, wR * 1.04, M.dark, hx, by - 2e-3, 0);
|
|
18280
18469
|
rail(kit, group, x1, handguardLength, by + hh / 2, 0, wR * 0.66);
|
|
18281
18470
|
rail(kit, group, x1 + 0.01, handguardLength - 0.02, by - 2e-3, wR * 0.54, wR * 0.4, PI8 / 2);
|
|
18282
18471
|
rail(kit, group, x1 + 0.01, handguardLength - 0.02, by - 2e-3, -wR * 0.54, wR * 0.4, -PI8 / 2);
|
|
@@ -18284,49 +18473,49 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18284
18473
|
} else {
|
|
18285
18474
|
const material = o.hg === "wood" ? M.wood : furn;
|
|
18286
18475
|
if (o.ak) {
|
|
18287
|
-
|
|
18288
|
-
|
|
18476
|
+
box3(group, handguardLength, hh * 0.55, wR * 1.08, material, hx, by - hh * 0.22, 0);
|
|
18477
|
+
box3(group, handguardLength * 0.75, hh * 0.35, wR * 0.7, material, hx - handguardLength * 0.1, by + r * 2.2, 0);
|
|
18289
18478
|
} else {
|
|
18290
|
-
|
|
18479
|
+
box3(group, handguardLength, hh, wR * 1.08, material, hx, by - 2e-3, 0);
|
|
18291
18480
|
vents(kit, group, x1 + 0.01, handguardLength - 0.02, by + hh * 0.15, wR * 0.54 + 1e-3, Math.round(handguardLength / 0.025), hh * 0.3);
|
|
18292
18481
|
vents(kit, group, x1 + 0.01, handguardLength - 0.02, by + hh * 0.15, -wR * 0.54 - 1e-3, Math.round(handguardLength / 0.025), hh * 0.3);
|
|
18293
18482
|
}
|
|
18294
18483
|
}
|
|
18295
18484
|
if (!hasLongScope && !o.rail && o.ak) {
|
|
18296
|
-
|
|
18297
|
-
|
|
18485
|
+
box3(group, 0.03, 0.016, wR * 0.6, M.metal, x1 + 0.02, by + r * 2.5 + 0.01, 0);
|
|
18486
|
+
box3(group, 0.012, 4e-3, wR * 0.5, M.dark, x1 + 0.03, by + r * 2.5 + 0.019, 0);
|
|
18298
18487
|
}
|
|
18299
18488
|
}
|
|
18300
18489
|
if (hasLongScope) return;
|
|
18301
18490
|
const sightX = L - (o.ak ? 0.06 : 0.08);
|
|
18302
18491
|
if (o.ak) {
|
|
18303
|
-
|
|
18304
|
-
|
|
18305
|
-
|
|
18306
|
-
|
|
18492
|
+
box3(group, 0.022, 0.022, wR * 0.6, M.metal, sightX, by + 8e-3, 0);
|
|
18493
|
+
box3(group, 6e-3, 0.024, 4e-3, M.metal, sightX, by + 0.026, 8e-3);
|
|
18494
|
+
box3(group, 6e-3, 0.024, 4e-3, M.metal, sightX, by + 0.026, -8e-3);
|
|
18495
|
+
box3(group, 3e-3, 0.016, 3e-3, M.dark, sightX, by + 0.022, 0);
|
|
18307
18496
|
} else if (!o.rail || o.carry) {
|
|
18308
|
-
|
|
18309
|
-
|
|
18310
|
-
} else
|
|
18497
|
+
box3(group, 0.018, 0.014, wR * 0.55, M.dark, sightX, by + 8e-3, 0);
|
|
18498
|
+
box3(group, 0.012, 0.034, 8e-3, M.dark, sightX, by + 0.03, 0, -0.25);
|
|
18499
|
+
} else box3(group, 0.012, 0.024, 0.012, M.dark, sightX - 0.04, by + hR * 0.4 + 0.012, 0);
|
|
18311
18500
|
}
|
|
18312
18501
|
|
|
18313
18502
|
// src/models/attachments/belt-box.ts
|
|
18314
18503
|
function buildBeltBox(kit, belt) {
|
|
18315
|
-
const { M, box:
|
|
18316
|
-
|
|
18317
|
-
|
|
18504
|
+
const { M, box: box3, cylinderX } = kit;
|
|
18505
|
+
box3(belt, 0.11, 0.1, 0.08, M.olive, 0, 0, 0);
|
|
18506
|
+
box3(belt, 0.112, 0.012, 0.082, M.dark, 0, 0.046, 0);
|
|
18318
18507
|
for (let i = 0; i < 7; i++) {
|
|
18319
18508
|
cylinderX(belt, 42e-4, 0.034, M.brass, -0.04 + i * 0.012, 0.07, 0.035, 10);
|
|
18320
|
-
|
|
18509
|
+
box3(belt, 6e-3, 6e-3, 0.012, M.metal, -0.04 + i * 0.012, 0.066, 0.035);
|
|
18321
18510
|
}
|
|
18322
18511
|
}
|
|
18323
18512
|
|
|
18324
18513
|
// src/models/attachments/drum.ts
|
|
18325
18514
|
function buildDrum(kit, magazine) {
|
|
18326
|
-
const { M, box:
|
|
18515
|
+
const { M, box: box3, cylinderZ } = kit;
|
|
18327
18516
|
cylinderZ(magazine, 0.075, 0.07, M.dark, 0.02, -0.085, 0, 22);
|
|
18328
18517
|
cylinderZ(magazine, 0.05, 0.074, M.metal, 0.02, -0.085, 0, 18);
|
|
18329
|
-
|
|
18518
|
+
box3(magazine, 0.05, 0.04, 0.03, M.dark, 0, -0.02, 0);
|
|
18330
18519
|
}
|
|
18331
18520
|
|
|
18332
18521
|
// src/models/helical-magazine.ts
|
|
@@ -18336,7 +18525,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18336
18525
|
var TURNS = 11;
|
|
18337
18526
|
function buildHelicalMagazine(context) {
|
|
18338
18527
|
const { kit, group, parts, receiverEnd, barrelY, barrelRadius } = context;
|
|
18339
|
-
const { M, cylinderX, box:
|
|
18528
|
+
const { M, cylinderX, box: box3 } = kit;
|
|
18340
18529
|
const x = receiverEnd + LENGTH / 2 + 0.02;
|
|
18341
18530
|
const y = barrelY - barrelRadius - RADIUS - 0.012;
|
|
18342
18531
|
const magazine = kit.pivot(group, x, y, 0);
|
|
@@ -18344,8 +18533,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18344
18533
|
cylinderX(magazine, RADIUS, LENGTH, M.dark, 0, 0, 0, 20);
|
|
18345
18534
|
cylinderX(magazine, RADIUS * 1.06, 0.01, M.metal, -LENGTH / 2, 0, 0, 20);
|
|
18346
18535
|
cylinderX(magazine, RADIUS * 1.06, 0.01, M.metal, LENGTH / 2, 0, 0, 20);
|
|
18347
|
-
for (let i = 0; i < TURNS; i++)
|
|
18348
|
-
|
|
18536
|
+
for (let i = 0; i < TURNS; i++) box3(magazine, 0.012, RADIUS * 2.15, 0.014, M.metal, -LENGTH / 2 + (i + 0.5) * LENGTH / TURNS, 0, 0, 0, 0, i * PI9 / 4);
|
|
18537
|
+
box3(magazine, 0.05, 0.03, 0.03, M.dark, -LENGTH / 2 - 0.02, RADIUS * 0.4, 0);
|
|
18349
18538
|
parts.magDrop = 0.16;
|
|
18350
18539
|
return x;
|
|
18351
18540
|
}
|
|
@@ -18353,24 +18542,24 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18353
18542
|
// src/models/rifle-controls.ts
|
|
18354
18543
|
function buildGrip(context) {
|
|
18355
18544
|
const { kit, group, parts, options: o, furniture: furn, receiverStart: x0, receiverHeight: hR, receiverWidth: wR } = context;
|
|
18356
|
-
const { M, box:
|
|
18545
|
+
const { M, box: box3 } = kit;
|
|
18357
18546
|
const gx = x0 + (o.gripAt || 0.07);
|
|
18358
18547
|
if (!context.isTraditional && o.grip !== "none") {
|
|
18359
18548
|
const grip = kit.pivot(group, gx - 0.012, -hR / 2 - 0.046, 0);
|
|
18360
18549
|
grip.rotation.z = -0.3;
|
|
18361
|
-
|
|
18362
|
-
for (let i = 0; i < 3; i++)
|
|
18363
|
-
|
|
18364
|
-
}
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
parts.trigger =
|
|
18368
|
-
if (o.sel) parts.safety =
|
|
18550
|
+
box3(grip, 0.032, 0.105, 0.028, furn, 0, 0, 0);
|
|
18551
|
+
for (let i = 0; i < 3; i++) box3(grip, 6e-3, 0.012, 0.026, furn, 0.017, 0.022 - i * 0.02, 0);
|
|
18552
|
+
box3(grip, 0.034, 8e-3, 0.03, furn, 0, -0.052, 0);
|
|
18553
|
+
}
|
|
18554
|
+
box3(group, 0.06, 4e-3, 0.01, M.metal, gx + 0.03, -hR / 2 - 0.024, 0);
|
|
18555
|
+
box3(group, 4e-3, 0.022, 0.01, M.metal, gx + 0.06, -hR / 2 - 0.013, 0);
|
|
18556
|
+
parts.trigger = box3(group, 4e-3, 0.016, 4e-3, M.dark, gx + 0.024, -hR / 2 - 0.012, 0, 0.15);
|
|
18557
|
+
if (o.sel) parts.safety = box3(group, 0.016, 5e-3, 3e-3, M.dark, gx + 5e-3, -hR * 0.15, -wR / 2 - 2e-3, 0.4);
|
|
18369
18558
|
return gx;
|
|
18370
18559
|
}
|
|
18371
18560
|
function buildMagazine(context, gx) {
|
|
18372
18561
|
const { kit, group, parts, options: o, receiverStart: x0, receiverHeight: hR, receiverWidth: wR, receiverLength: RL } = context;
|
|
18373
|
-
const { M, box:
|
|
18562
|
+
const { M, box: box3 } = kit;
|
|
18374
18563
|
if (o.mag === "helical") return buildHelicalMagazine(context);
|
|
18375
18564
|
const mx = o.magAt != null ? x0 + o.magAt : gx + 0.075;
|
|
18376
18565
|
const scale = o.magLen || 1;
|
|
@@ -18385,12 +18574,12 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18385
18574
|
const length2 = 0.07 * scale;
|
|
18386
18575
|
const cx = px + Math.sin(angle) * length2 / 2;
|
|
18387
18576
|
const cy = py - Math.cos(angle) * length2 / 2;
|
|
18388
|
-
|
|
18389
|
-
|
|
18577
|
+
box3(magazine, 0.052, length2 + 4e-3, 0.024, material, cx, cy, 0, angle);
|
|
18578
|
+
box3(magazine, 0.04, length2 * 0.8, 0.026, M.dark, cx, cy, 0, angle);
|
|
18390
18579
|
px += Math.sin(angle) * length2;
|
|
18391
18580
|
py -= Math.cos(angle) * length2;
|
|
18392
18581
|
}
|
|
18393
|
-
|
|
18582
|
+
box3(magazine, 0.058, 8e-3, 0.028, material, px, py, 0, 0.38);
|
|
18394
18583
|
parts.magDrop = 0.07 * scale * 3 + 0.04;
|
|
18395
18584
|
} else if (o.mag === "box") {
|
|
18396
18585
|
const length2 = 0.13 * scale;
|
|
@@ -18404,18 +18593,18 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18404
18593
|
angle = 0.08 + curve * i;
|
|
18405
18594
|
const cx = px + Math.sin(angle) * segment / 2;
|
|
18406
18595
|
const cy = py - Math.cos(angle) * segment / 2;
|
|
18407
|
-
|
|
18408
|
-
|
|
18596
|
+
box3(magazine, 0.05, segment + 4e-3, 0.024, material, cx, cy, 0, angle);
|
|
18597
|
+
box3(magazine, 0.04, 3e-3, 0.026, M.metal, cx, cy, 0, angle);
|
|
18409
18598
|
px += Math.sin(angle) * segment;
|
|
18410
18599
|
py -= Math.cos(angle) * segment;
|
|
18411
18600
|
}
|
|
18412
|
-
|
|
18601
|
+
box3(magazine, 0.056, 7e-3, 0.028, material, px, py - 2e-3, 0, angle);
|
|
18413
18602
|
parts.magDrop = length2 + 0.03;
|
|
18414
18603
|
} else if (o.mag === "drum") {
|
|
18415
18604
|
buildDrum(kit, magazine);
|
|
18416
18605
|
parts.magDrop = 0.2;
|
|
18417
18606
|
} else if (o.mag === "internal") {
|
|
18418
|
-
|
|
18607
|
+
box3(group, 0.08, 0.025, 0.03, context.isTraditional ? context.furniture : M.metal, mx, -hR / 2 - 0.012, 0);
|
|
18419
18608
|
parts.mag = null;
|
|
18420
18609
|
} else parts.mag = null;
|
|
18421
18610
|
if (o.mag === "belt") {
|
|
@@ -18424,8 +18613,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18424
18613
|
buildBeltBox(kit, belt);
|
|
18425
18614
|
const cover = kit.pivot(group, x0 + 0.01, hR / 2, 0);
|
|
18426
18615
|
parts.cover = cover;
|
|
18427
|
-
|
|
18428
|
-
|
|
18616
|
+
box3(cover, RL - 0.03, 0.014, wR * 1.05, M.metal, (RL - 0.03) / 2, 7e-3, 0);
|
|
18617
|
+
box3(cover, 0.02, 0.012, wR * 0.6, M.dark, RL - 0.04, 0.016, 0);
|
|
18429
18618
|
}
|
|
18430
18619
|
return mx;
|
|
18431
18620
|
}
|
|
@@ -18433,40 +18622,40 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18433
18622
|
// src/models/rifle-stock.ts
|
|
18434
18623
|
function buildStock(context, magazineX) {
|
|
18435
18624
|
const { kit, group, options: o, furniture: furn, length: L, stockLength: S, receiverStart: x0, receiverEnd: x1, receiverHeight: hR } = context;
|
|
18436
|
-
const { M, box:
|
|
18625
|
+
const { M, box: box3, cylinderX } = kit;
|
|
18437
18626
|
if (context.isTraditional) {
|
|
18438
18627
|
buttpad(kit, group, 6e-3, -0.04, 0.13, 0.038);
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18628
|
+
box3(group, 0.03, 0.13, 0.038, furn, 0.024, -0.04, 0);
|
|
18629
|
+
box3(group, S, 0.055, 0.034, furn, S / 2, -0.012, 0, 0.06);
|
|
18630
|
+
box3(group, 0.09, 0.05, 0.032, furn, x0 - 0.02, -0.035, 0, 0.25);
|
|
18442
18631
|
const forendLength = x1 - x0 + (L - x1) * (o.fore ?? 0.62);
|
|
18443
|
-
if (forendLength > 0)
|
|
18444
|
-
if (o.stock === "straight")
|
|
18445
|
-
|
|
18632
|
+
if (forendLength > 0) box3(group, forendLength, 0.045, 0.04, furn, x0 + forendLength / 2, -hR / 2 + 4e-3, 0);
|
|
18633
|
+
if (o.stock === "straight") box3(group, 0.15, 0.04, 0.035, furn, x1 + 0.08, -hR / 2, 0);
|
|
18634
|
+
box3(group, 0.04, 4e-3, 0.03, M.metal, magazineX, -hR / 2 - 0.022, 0);
|
|
18446
18635
|
swivel(kit, group, 0.2, -0.08);
|
|
18447
18636
|
swivel(kit, group, x1 + (L - x1) * 0.45, -hR / 2 - 0.03);
|
|
18448
18637
|
if (o.bands) for (const fraction of [0.35, 0.75]) cylinderX(group, 0.024, 8e-3, M.metal, x1 + (L - x1) * fraction * (o.fore || 0.62), -4e-3, 0, 16);
|
|
18449
18638
|
} else if (o.stock === "fixed" || o.stock === "wood") {
|
|
18450
|
-
|
|
18451
|
-
|
|
18639
|
+
box3(group, S, 0.05, 0.03, furn, S / 2, -8e-3, 0, 0.05);
|
|
18640
|
+
box3(group, 0.03, 0.13, 0.036, furn, 0.022, -0.035, 0);
|
|
18452
18641
|
buttpad(kit, group, 4e-3, -0.035, 0.13, 0.036);
|
|
18453
|
-
if (o.stock === "wood")
|
|
18642
|
+
if (o.stock === "wood") box3(group, S * 0.6, 0.03, 0.028, furn, S * 0.55, -0.045, 0, 0.2);
|
|
18454
18643
|
swivel(kit, group, 0.08, -0.09);
|
|
18455
18644
|
} else if (o.stock === "skeleton") {
|
|
18456
|
-
|
|
18457
|
-
|
|
18458
|
-
|
|
18645
|
+
box3(group, S, 0.014, 0.026, furn, S / 2, 0.012, 0, 0.03);
|
|
18646
|
+
box3(group, S, 0.014, 0.026, furn, S / 2, -0.05, 0, -0.08);
|
|
18647
|
+
box3(group, 0.03, 0.12, 0.034, furn, 0.02, -0.025, 0);
|
|
18459
18648
|
buttpad(kit, group, 4e-3, -0.025, 0.12, 0.034);
|
|
18460
18649
|
} else if (o.stock === "retract") {
|
|
18461
18650
|
cylinderX(group, 0.013, S, M.metal, S / 2, 0, 0, 16);
|
|
18462
|
-
for (let i = 0; i < 5; i++)
|
|
18463
|
-
|
|
18464
|
-
|
|
18651
|
+
for (let i = 0; i < 5; i++) box3(group, 3e-3, 3e-3, 8e-3, M.dark, S * 0.2 + i * 0.015, -0.013, 0);
|
|
18652
|
+
box3(group, 0.034, 0.11, 0.036, furn, 0.02, -0.025, 0);
|
|
18653
|
+
box3(group, S * 0.55, 0.032, 0.03, furn, S * 0.35, 0, 0);
|
|
18465
18654
|
buttpad(kit, group, 3e-3, -0.025, 0.11, 0.036);
|
|
18466
18655
|
} else if (o.stock === "fold") {
|
|
18467
|
-
|
|
18468
|
-
|
|
18469
|
-
|
|
18656
|
+
box3(group, S, 6e-3, 6e-3, M.metal, S / 2, 0.01, 0.012);
|
|
18657
|
+
box3(group, S, 6e-3, 6e-3, M.metal, S / 2, -0.04, 0.012, -0.12);
|
|
18658
|
+
box3(group, 0.012, 0.1, 0.03, M.metal, 6e-3, -0.02, 0.012);
|
|
18470
18659
|
}
|
|
18471
18660
|
}
|
|
18472
18661
|
|
|
@@ -18474,49 +18663,49 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18474
18663
|
var PI10 = Math.PI;
|
|
18475
18664
|
function buildReceiver(context) {
|
|
18476
18665
|
const { kit, group, parts, options: o, length: L, receiverStart: x0, receiverEnd: x1, receiverHeight: hR, receiverWidth: wR, receiverLength: RL, barrelY: by } = context;
|
|
18477
|
-
const { M, box:
|
|
18666
|
+
const { M, box: box3, cylinderX, cylinderY, cylinderZ, sphere: sphere2 } = kit;
|
|
18478
18667
|
const receiverMaterial = o.tan ? M.tan : M.metal;
|
|
18479
18668
|
const middle = (x0 + x1) / 2;
|
|
18480
18669
|
if (o.round) {
|
|
18481
18670
|
cylinderX(group, hR * 0.36, RL, M.steel, middle, by, 0, 20);
|
|
18482
18671
|
cylinderX(group, hR * 0.32, 0.05, M.steel, x0 - 0.01, by, 0, 18);
|
|
18483
18672
|
} else if (o.ar) {
|
|
18484
|
-
|
|
18485
|
-
|
|
18486
|
-
|
|
18673
|
+
box3(group, RL, hR * 0.5, wR, receiverMaterial, middle, hR * 0.25, 0);
|
|
18674
|
+
box3(group, RL * 0.92, hR * 0.52, wR * 0.96, receiverMaterial, middle - RL * 0.02, -hR * 0.24, 0);
|
|
18675
|
+
box3(group, 0.05, 0.03, wR * 1.15, receiverMaterial, x0 + RL * 0.62, -hR * 0.5 - 0.01, 0);
|
|
18487
18676
|
cylinderZ(group, 6e-3, 0.012, M.metal, x1 - 0.03, hR * 0.28, wR / 2 + 6e-3, 12);
|
|
18488
|
-
|
|
18489
|
-
|
|
18490
|
-
|
|
18491
|
-
} else
|
|
18677
|
+
box3(group, 0.012, 0.01, 0.012, M.metal, x1 - 0.05, hR * 0.12, wR / 2 + 6e-3);
|
|
18678
|
+
box3(group, 0.03, 8e-3, 0.012, M.dark, x0 + 0.02, hR / 2 + 4e-3, 0);
|
|
18679
|
+
box3(group, 0.012, 6e-3, 4e-3, M.dark, x0 + RL * 0.55, -hR * 0.15, -wR / 2 - 2e-3);
|
|
18680
|
+
} else box3(group, RL, hR, wR, receiverMaterial, middle, 0, 0);
|
|
18492
18681
|
if (o.ak) {
|
|
18493
|
-
|
|
18494
|
-
for (let i = 0; i < 3; i++)
|
|
18495
|
-
|
|
18496
|
-
|
|
18682
|
+
box3(group, RL * 0.86, hR * 0.28, wR * 0.95, M.metal, middle - 8e-3, hR / 2 + 4e-3, 0);
|
|
18683
|
+
for (let i = 0; i < 3; i++) box3(group, 4e-3, hR * 0.3, wR * 0.97, M.dark, x0 + RL * 0.25 + i * 0.02, hR / 2 + 4e-3, 0);
|
|
18684
|
+
box3(group, RL * 0.5, 0.012, 3e-3, M.metal, x0 + RL * 0.55, -hR * 0.02, wR / 2 + 15e-4, -0.05);
|
|
18685
|
+
box3(group, 0.012, 0.014, 3e-3, M.dark, x0 + RL * 0.32, -hR * 0.05, wR / 2 + 2e-3);
|
|
18497
18686
|
}
|
|
18498
18687
|
if (o.g3) {
|
|
18499
18688
|
cylinderX(group, 9e-3, (L - x1) * 0.6, M.metal, x1 + (L - x1) * 0.28, hR * 0.48, 0, 14);
|
|
18500
|
-
|
|
18689
|
+
box3(group, 0.012, 0.024, 8e-3, M.dark, x1 + (L - x1) * 0.5, hR * 0.48, -0.012);
|
|
18501
18690
|
cylinderY(group, 0.012, 0.016, M.dark, x0 + 0.03, hR / 2 + 8e-3, 0, 12);
|
|
18502
18691
|
}
|
|
18503
18692
|
const ejectX = x1 - (o.ejectBack || 0.07);
|
|
18504
18693
|
const ejectY = o.ar ? hR * 0.2 : by;
|
|
18505
|
-
|
|
18694
|
+
box3(group, 0.05, hR * 0.36, 4e-3, M.hole, ejectX, ejectY, wR / 2 - 4e-4);
|
|
18506
18695
|
const bolt = kit.pivot(group);
|
|
18507
18696
|
parts.bolt = bolt;
|
|
18508
18697
|
parts.stroke = Math.min(0.1, RL * 0.32);
|
|
18509
|
-
|
|
18698
|
+
box3(bolt, 0.044, hR * 0.26, 6e-3, M.steelL, ejectX, ejectY, wR / 2 - 12e-4);
|
|
18510
18699
|
if (o.charge) {
|
|
18511
|
-
|
|
18512
|
-
|
|
18700
|
+
box3(bolt, 0.012, 0.01, 0.03, M.metal, ejectX + 0.04, ejectY + 4e-3, wR / 2 + 0.012);
|
|
18701
|
+
sphere2(bolt, 65e-4, M.metal, ejectX + 0.04, ejectY + 4e-3, wR / 2 + 0.028, 1);
|
|
18513
18702
|
}
|
|
18514
|
-
if (o.ar)
|
|
18703
|
+
if (o.ar) box3(group, 0.012, 0.016, 6e-3, receiverMaterial, ejectX - 0.03, ejectY + 4e-3, wR / 2 + 4e-3);
|
|
18515
18704
|
if (o.rail) rail(kit, group, x0 - 5e-3, RL + 0.07, hR / 2 + (o.ar ? 0 : 3e-3), 0, wR * 0.68);
|
|
18516
18705
|
}
|
|
18517
18706
|
function buildBarrel(context) {
|
|
18518
18707
|
const { kit, group, parts, options: o, length: L, barrelLength: Bl, receiverEnd: x1, barrelRadius: r, barrelY: by } = context;
|
|
18519
|
-
const { M, box:
|
|
18708
|
+
const { M, box: box3, cylinderX } = kit;
|
|
18520
18709
|
heatify(parts.glow, cylinderX(group, r, Bl, M.metal, L - Bl / 2, by, 0, 16));
|
|
18521
18710
|
if (o.jacket) {
|
|
18522
18711
|
cylinderX(group, r * 2, (L - x1) * 0.6, M.dark, x1 + (L - x1) * 0.3, by, 0, 16);
|
|
@@ -18531,7 +18720,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18531
18720
|
heatify(parts.glow, cylinderX(group, r * 1.45, 0.042, M.dark, L - 0.021, by, 0, 16));
|
|
18532
18721
|
for (let i = 0; i < 4; i++) {
|
|
18533
18722
|
const angle = i * PI10 / 2 + PI10 / 4;
|
|
18534
|
-
|
|
18723
|
+
box3(group, 0.026, 25e-4, 4e-3, M.hole, L - 0.02, by + Math.cos(angle) * r * 1.42, Math.sin(angle) * r * 1.42, 0, 0, angle);
|
|
18535
18724
|
}
|
|
18536
18725
|
});
|
|
18537
18726
|
}
|
|
@@ -18634,10 +18823,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18634
18823
|
for (const [name, part] of partRegistry(parts)) part.name = name;
|
|
18635
18824
|
};
|
|
18636
18825
|
var fitLength = (kit, inner, lengthMetres) => {
|
|
18637
|
-
const
|
|
18638
|
-
const factor = lengthMetres / (
|
|
18826
|
+
const box3 = new kit.THREE.Box3().setFromObject(inner);
|
|
18827
|
+
const factor = lengthMetres / (box3.max.x - box3.min.x);
|
|
18639
18828
|
inner.scale.x = factor;
|
|
18640
|
-
inner.position.x = -
|
|
18829
|
+
inner.position.x = -box3.min.x * factor;
|
|
18641
18830
|
const root = kit.group();
|
|
18642
18831
|
root.add(inner);
|
|
18643
18832
|
return root;
|
|
@@ -18679,7 +18868,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18679
18868
|
};
|
|
18680
18869
|
|
|
18681
18870
|
// src/props.ts
|
|
18682
|
-
var
|
|
18871
|
+
var box2 = (id, material, size, position, extra = {}) => ({ id, material, shape: { kind: "box", size }, position, ...extra });
|
|
18683
18872
|
var joint = (a, b, kind) => ({ a, b, kind });
|
|
18684
18873
|
var handled = (name, handle, head) => {
|
|
18685
18874
|
const [handleMaterial, rawHandle] = handle;
|
|
@@ -18691,16 +18880,16 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18691
18880
|
return {
|
|
18692
18881
|
spec: {
|
|
18693
18882
|
name,
|
|
18694
|
-
parts: [
|
|
18883
|
+
parts: [box2("handle", handleMaterial, handleSize, [-handleSize[0] / 2 + shift, thickness / 2, 0]), box2("head", headMaterial, headSize, [headSize[0] / 2 + shift, thickness / 2, 0])],
|
|
18695
18884
|
joints: [joint("handle", "head", "screw")],
|
|
18696
18885
|
tags: ["weapon"]
|
|
18697
18886
|
},
|
|
18698
18887
|
colors: { handle: handleMaterial === "steel" ? 3816770 : handleMaterial === "plastic" ? 2829616 : 8017200, head: headMaterial === "steel" ? 9410206 : headMaterial === "copper" ? 12088115 : 7031338 }
|
|
18699
18888
|
};
|
|
18700
18889
|
};
|
|
18701
|
-
var solid = (name, material, size,
|
|
18702
|
-
spec: { name, parts: [
|
|
18703
|
-
colors: { body:
|
|
18890
|
+
var solid = (name, material, size, color2) => ({
|
|
18891
|
+
spec: { name, parts: [box2("body", material, size, [0, size[1] / 2, 0])], joints: [], tags: ["weapon"] },
|
|
18892
|
+
colors: { body: color2 }
|
|
18704
18893
|
});
|
|
18705
18894
|
var SHAPES = {
|
|
18706
18895
|
pistol: (n) => handled(n, ["plastic", [0.06, 0.03, 0.11]], ["steel", [0.2, 0.03, 0.04]]),
|
|
@@ -18756,9 +18945,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18756
18945
|
decorate?.(model.root);
|
|
18757
18946
|
const group = new THREE.Group();
|
|
18758
18947
|
group.name = name;
|
|
18759
|
-
const
|
|
18760
|
-
const center =
|
|
18761
|
-
model.root.position.set(-center.x, -
|
|
18948
|
+
const box3 = new THREE.Box3().setFromObject(model.root);
|
|
18949
|
+
const center = box3.getCenter(new THREE.Vector3());
|
|
18950
|
+
model.root.position.set(-center.x, -box3.min.y, -center.z);
|
|
18762
18951
|
group.add(model.root);
|
|
18763
18952
|
group.updateMatrixWorld(true);
|
|
18764
18953
|
for (const mesh2 of mergeByMaterial(THREE, model.root, group)) {
|
|
@@ -18766,7 +18955,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18766
18955
|
group.add(mesh2);
|
|
18767
18956
|
}
|
|
18768
18957
|
group.remove(model.root);
|
|
18769
|
-
const size =
|
|
18958
|
+
const size = box3.getSize(new THREE.Vector3());
|
|
18770
18959
|
group.userData.footprint = [size.x, size.y, size.z];
|
|
18771
18960
|
return group;
|
|
18772
18961
|
}
|
|
@@ -18996,10 +19185,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18996
19185
|
}
|
|
18997
19186
|
const sampleKey = (t, includeInstants) => {
|
|
18998
19187
|
const poses = /* @__PURE__ */ new Map();
|
|
18999
|
-
for (const [key,
|
|
19188
|
+
for (const [key, list2] of channels) {
|
|
19000
19189
|
const [part, channel, axis2] = key.split("|");
|
|
19001
19190
|
const pose = poses.get(part) ?? { position: [0, 0, 0], rotation: [0, 0, 0] };
|
|
19002
|
-
pose[channel][AXIS_INDEX[axis2]] = round(valueAt(
|
|
19191
|
+
pose[channel][AXIS_INDEX[axis2]] = round(valueAt(list2, t, includeInstants));
|
|
19003
19192
|
poses.set(part, pose);
|
|
19004
19193
|
}
|
|
19005
19194
|
const root = poses.get(ROOT);
|
|
@@ -19137,7 +19326,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19137
19326
|
}
|
|
19138
19327
|
|
|
19139
19328
|
// src/animation/reload-clips.ts
|
|
19140
|
-
var
|
|
19329
|
+
var KINDS2 = ["tactical", "empty", "one_by_one"];
|
|
19141
19330
|
var charge = (context, start) => {
|
|
19142
19331
|
const travel = strokeOf(context.parts);
|
|
19143
19332
|
return [move("bolt", "x", start, 0.12, 0, travel), move("bolt", "x", start + 0.18, 0.06, travel, 0)];
|
|
@@ -19246,7 +19435,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19246
19435
|
function reloadClips(context) {
|
|
19247
19436
|
const clips = [];
|
|
19248
19437
|
let first;
|
|
19249
|
-
for (const kind of
|
|
19438
|
+
for (const kind of KINDS2) {
|
|
19250
19439
|
const draft = draftFor(context, kind);
|
|
19251
19440
|
if (!draft) return [];
|
|
19252
19441
|
const clip = composeClip(kind === "tactical" ? "reload" : `reload_${kind}`, draft.tweens, [...draft.events, ...markers(context, kind, draft.end)], draft.end);
|
|
@@ -19421,12 +19610,12 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19421
19610
|
var BELT_POINTS = 16;
|
|
19422
19611
|
var BELT_ROUND_EVERY = 2;
|
|
19423
19612
|
var buildAmmoBackpack = ({ kit, frame, model }) => {
|
|
19424
|
-
const { THREE, M, box:
|
|
19613
|
+
const { THREE, M, box: box3, cylinderZ } = kit;
|
|
19425
19614
|
const group = kit.group();
|
|
19426
19615
|
const pack = [PACK_AT[0] - frame.position[0], PACK_AT[1] - frame.position[1], PACK_AT[2] - frame.position[2]];
|
|
19427
|
-
|
|
19428
|
-
|
|
19429
|
-
|
|
19616
|
+
box3(group, ...PACK_SIZE, M.olive, ...pack);
|
|
19617
|
+
box3(group, PACK_SIZE[0] * 1.02, 0.03, PACK_SIZE[2] * 1.02, M.dark, pack[0], pack[1] + PACK_SIZE[1] / 2, pack[2]);
|
|
19618
|
+
box3(group, 0.04, PACK_SIZE[1] * 0.9, 0.012, M.tan, pack[0] + PACK_SIZE[0] / 2, pack[1], pack[2] - 0.04);
|
|
19430
19619
|
const feed = kit.pivot(group, 0, 0, 0);
|
|
19431
19620
|
buildBeltBox(kit, feed);
|
|
19432
19621
|
const points = catenary([pack[0] + PACK_SIZE[0] / 2, pack[1] + PACK_SIZE[1] * 0.3, pack[2]], [0, 0, 0], BELT_SAG, BELT_POINTS);
|
|
@@ -19447,10 +19636,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19447
19636
|
// src/models/attachments/foregrip.ts
|
|
19448
19637
|
var RIBS = 4;
|
|
19449
19638
|
var buildForegrip = ({ kit, attachment }) => {
|
|
19450
|
-
const { M, box:
|
|
19639
|
+
const { M, box: box3, cylinderY } = kit;
|
|
19451
19640
|
const length2 = attachment.dims?.length ?? 0.1;
|
|
19452
19641
|
const group = kit.group();
|
|
19453
|
-
|
|
19642
|
+
box3(group, 0.045, 0.014, 0.034, M.dark, 0, -7e-3, 0);
|
|
19454
19643
|
cylinderY(group, 0.0135, length2, M.poly, 0, -0.014 - length2 / 2, 0, 14);
|
|
19455
19644
|
for (let i = 0; i < RIBS; i++) cylinderY(group, 0.0145, 4e-3, M.rubber, 0, -0.03 - i * (length2 / (RIBS + 1)), 0, 14);
|
|
19456
19645
|
cylinderY(group, 0.0155, 0.01, M.dark, 0, -0.014 - length2, 0, 14);
|
|
@@ -19463,20 +19652,20 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19463
19652
|
var BEAM_WIDTH = 25e-4;
|
|
19464
19653
|
var DOT_RADIUS = 0.012;
|
|
19465
19654
|
var buildLaser = ({ kit, attachment, frame, raycast }) => {
|
|
19466
|
-
const { THREE, M, box:
|
|
19655
|
+
const { THREE, M, box: box3, cylinderX } = kit;
|
|
19467
19656
|
const length2 = attachment.dims?.length ?? 0.08;
|
|
19468
19657
|
const half = (attachment.dims?.diameter ?? 0.025) / 2;
|
|
19469
|
-
const
|
|
19470
|
-
const
|
|
19658
|
+
const range2 = attachment.laser?.range ?? DEFAULT_RANGE;
|
|
19659
|
+
const color2 = attachment.laser?.color ?? DEFAULT_COLOR;
|
|
19471
19660
|
const group = kit.group();
|
|
19472
19661
|
const offset = frame.side === 0 ? { y: -(half + 4e-3), z: 0 } : { y: 0, z: frame.side * (half + 4e-3) };
|
|
19473
|
-
|
|
19474
|
-
|
|
19662
|
+
box3(group, 0.03, 0.012, 0.028, M.dark, 0, frame.side === 0 ? -2e-3 : 0, 0);
|
|
19663
|
+
box3(group, length2, half * 2, half * 2, M.dark, 0, offset.y, offset.z);
|
|
19475
19664
|
const emitter = new THREE.MeshBasicMaterial({ color: 5574929 });
|
|
19476
19665
|
cylinderX(group, half * 0.5, 4e-3, emitter, length2 / 2 + 1e-3, offset.y, offset.z, 10);
|
|
19477
|
-
const glow = new THREE.MeshBasicMaterial({ color, transparent: true, opacity: 0.7, blending: THREE.AdditiveBlending, depthWrite: false });
|
|
19666
|
+
const glow = new THREE.MeshBasicMaterial({ color: color2, transparent: true, opacity: 0.7, blending: THREE.AdditiveBlending, depthWrite: false });
|
|
19478
19667
|
const beam = new THREE.Mesh(new THREE.BoxGeometry(1, BEAM_WIDTH, BEAM_WIDTH), glow);
|
|
19479
|
-
const dot2 = new THREE.Mesh(new THREE.SphereGeometry(DOT_RADIUS, 10, 8), new THREE.MeshBasicMaterial({ color }));
|
|
19668
|
+
const dot2 = new THREE.Mesh(new THREE.SphereGeometry(DOT_RADIUS, 10, 8), new THREE.MeshBasicMaterial({ color: color2 }));
|
|
19480
19669
|
const front = length2 / 2 + 4e-3;
|
|
19481
19670
|
beam.position.set(front, offset.y, offset.z);
|
|
19482
19671
|
dot2.position.set(front, offset.y, offset.z);
|
|
@@ -19491,7 +19680,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19491
19680
|
object: group,
|
|
19492
19681
|
setOn(on) {
|
|
19493
19682
|
isOn = on;
|
|
19494
|
-
emitter.color.setHex(on ?
|
|
19683
|
+
emitter.color.setHex(on ? color2 : 5574929);
|
|
19495
19684
|
beam.visible = on;
|
|
19496
19685
|
if (!on) dot2.visible = false;
|
|
19497
19686
|
},
|
|
@@ -19501,8 +19690,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19501
19690
|
group.getWorldPosition(origin);
|
|
19502
19691
|
direction.set(1, 0, 0).transformDirection(group.matrixWorld);
|
|
19503
19692
|
group.getWorldScale(scale);
|
|
19504
|
-
const hit = raycast?.(origin, direction,
|
|
19505
|
-
const reach = (hit ??
|
|
19693
|
+
const hit = raycast?.(origin, direction, range2) ?? null;
|
|
19694
|
+
const reach = (hit ?? range2) / Math.max(scale.x, 1e-6);
|
|
19506
19695
|
beam.scale.x = reach;
|
|
19507
19696
|
beam.position.x = front + reach / 2;
|
|
19508
19697
|
dot2.visible = hit !== null;
|
|
@@ -19524,18 +19713,18 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19524
19713
|
var DEFAULT_CONE_DEG = 30;
|
|
19525
19714
|
var DEFAULT_RANGE2 = 60;
|
|
19526
19715
|
var buildLight = ({ kit, attachment, frame }) => {
|
|
19527
|
-
const { THREE, M, box:
|
|
19716
|
+
const { THREE, M, box: box3, cylinderX } = kit;
|
|
19528
19717
|
const length2 = attachment.dims?.length ?? 0.1;
|
|
19529
19718
|
const radius = (attachment.dims?.diameter ?? 0.03) / 2;
|
|
19530
19719
|
const group = kit.group();
|
|
19531
19720
|
const offset = frame.side === 0 ? { y: -(radius + 4e-3), z: 0 } : { y: 0, z: frame.side * (radius + 4e-3) };
|
|
19532
|
-
|
|
19721
|
+
box3(group, 0.035, 0.012, 0.03, M.dark, 0, frame.side === 0 ? -2e-3 : 0, 0);
|
|
19533
19722
|
cylinderX(group, radius, length2, M.dark, 0, offset.y, offset.z, 14);
|
|
19534
19723
|
cylinderX(group, radius * 1.08, 0.012, M.metal, length2 / 2 - 6e-3, offset.y, offset.z, 14);
|
|
19535
19724
|
const lens2 = new THREE.MeshStandardMaterial({ color: 16773832, roughness: 0.1, metalness: 0.2, emissive: 16773832, emissiveIntensity: 0 });
|
|
19536
19725
|
cylinderX(group, radius * 0.82, 4e-3, lens2, length2 / 2 + 1e-3, offset.y, offset.z, 14);
|
|
19537
|
-
const
|
|
19538
|
-
const spot = new THREE.SpotLight(16773584, LIGHT_INTENSITY, attachment.light?.range ?? DEFAULT_RANGE2,
|
|
19726
|
+
const cone2 = (attachment.light?.coneDeg ?? DEFAULT_CONE_DEG) * (Math.PI / 180);
|
|
19727
|
+
const spot = new THREE.SpotLight(16773584, LIGHT_INTENSITY, attachment.light?.range ?? DEFAULT_RANGE2, cone2 / 2, 0.35, 1.2);
|
|
19539
19728
|
spot.position.set(length2 / 2 + 0.01, offset.y, offset.z);
|
|
19540
19729
|
spot.intensity = 0;
|
|
19541
19730
|
const target = new THREE.Object3D();
|
|
@@ -19564,23 +19753,23 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19564
19753
|
return { object: group, hangsFrom: "magazine", hides: factoryMagazine };
|
|
19565
19754
|
};
|
|
19566
19755
|
var buildExtendedMagazine = ({ kit, model }) => {
|
|
19567
|
-
const { M, box:
|
|
19756
|
+
const { M, box: box3 } = kit;
|
|
19568
19757
|
const length2 = Math.max(0.1, (model.parts.magDrop ?? 0.16) - 0.03);
|
|
19569
19758
|
const extension = length2 * EXTENSION_FRACTION;
|
|
19570
19759
|
const group = kit.group();
|
|
19571
19760
|
const lean = Math.sin(MAGAZINE_LEAN) * (length2 + extension / 2);
|
|
19572
|
-
|
|
19573
|
-
|
|
19761
|
+
box3(group, 0.05, extension + 4e-3, 0.024, M.dark, lean, -(Math.cos(MAGAZINE_LEAN) * (length2 + extension / 2)), 0, MAGAZINE_LEAN);
|
|
19762
|
+
box3(group, 0.056, 7e-3, 0.028, M.dark, lean + Math.sin(MAGAZINE_LEAN) * extension / 2, -(Math.cos(MAGAZINE_LEAN) * (length2 + extension)) - 3e-3, 0);
|
|
19574
19763
|
return { object: group, hangsFrom: "magazine" };
|
|
19575
19764
|
};
|
|
19576
19765
|
var buildDualCoupler = ({ kit, factoryMagazine }) => {
|
|
19577
|
-
const { M, box:
|
|
19766
|
+
const { M, box: box3 } = kit;
|
|
19578
19767
|
const group = kit.group();
|
|
19579
19768
|
const spare = kit.group();
|
|
19580
19769
|
spare.position.set(0, 0, 0.032);
|
|
19581
|
-
for (const
|
|
19770
|
+
for (const piece2 of factoryMagazine) spare.add(piece2.clone(true));
|
|
19582
19771
|
group.add(spare);
|
|
19583
|
-
|
|
19772
|
+
box3(group, 0.05, 0.012, 0.04, M.tape, 0, -0.03, 0.016);
|
|
19584
19773
|
return { object: group, hangsFrom: "magazine" };
|
|
19585
19774
|
};
|
|
19586
19775
|
|
|
@@ -19591,12 +19780,12 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19591
19780
|
return group;
|
|
19592
19781
|
};
|
|
19593
19782
|
var buildCompensator = ({ kit, frame }) => {
|
|
19594
|
-
const { M, box:
|
|
19783
|
+
const { M, box: box3, cylinderX } = kit;
|
|
19595
19784
|
const radius = frame.barrelRadius * 1.9;
|
|
19596
19785
|
const length2 = 0.07;
|
|
19597
19786
|
const group = kit.group();
|
|
19598
19787
|
cylinderX(group, radius, length2, M.dark, -length2 / 2, 0, 0, 16);
|
|
19599
|
-
for (let i = 0; i < 3; i++)
|
|
19788
|
+
for (let i = 0; i < 3; i++) box3(group, length2 * 0.14, radius * 0.9, radius * 0.7, M.hole, -length2 * 0.2 - i * length2 * 0.25, radius * 0.75, 0);
|
|
19600
19789
|
return group;
|
|
19601
19790
|
};
|
|
19602
19791
|
|
|
@@ -19614,9 +19803,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19614
19803
|
};
|
|
19615
19804
|
var ADAPTER_LENGTH = 0.1;
|
|
19616
19805
|
var ADAPTER_BACK = 0.05;
|
|
19617
|
-
var tinted = (context, group,
|
|
19806
|
+
var tinted = (context, group, color2) => {
|
|
19618
19807
|
const { THREE, M } = context.kit;
|
|
19619
|
-
const lens2 = new THREE.MeshStandardMaterial({ color, roughness: 0.05, metalness: 0.3, transparent: true, opacity: 0.9, emissive:
|
|
19808
|
+
const lens2 = new THREE.MeshStandardMaterial({ color: color2, roughness: 0.05, metalness: 0.3, transparent: true, opacity: 0.9, emissive: color2, emissiveIntensity: 0.6 });
|
|
19620
19809
|
group.traverse((node) => {
|
|
19621
19810
|
const mesh2 = node;
|
|
19622
19811
|
if (mesh2.isMesh && mesh2.material === M.lens) mesh2.material = lens2;
|
|
@@ -19690,14 +19879,14 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19690
19879
|
ag36: { tubeRadius: 0.02, tubeFraction: 0.8, housing: [0.13, 0.06, 0.05], hasFrontGrip: true }
|
|
19691
19880
|
};
|
|
19692
19881
|
var drawFixed = (kit, group, look, length2) => {
|
|
19693
|
-
const { M, box:
|
|
19882
|
+
const { M, box: box3, cylinderY } = kit;
|
|
19694
19883
|
const [housingLength, housingHeight, housingWidth] = look.housing;
|
|
19695
|
-
|
|
19696
|
-
|
|
19697
|
-
|
|
19884
|
+
box3(group, housingLength, housingHeight, housingWidth, M.dark, housingLength / 2 - 0.02, -look.tubeRadius, 0);
|
|
19885
|
+
box3(group, 0.05, 4e-3, 0.012, M.metal, housingLength * 0.45, -look.tubeRadius - housingHeight / 2 - 4e-3, 0);
|
|
19886
|
+
box3(group, 4e-3, 0.02, 8e-3, M.dark, housingLength * 0.6, -look.tubeRadius - housingHeight / 2 - 0.016, 0);
|
|
19698
19887
|
if (look.hasFrontGrip) {
|
|
19699
19888
|
cylinderY(group, 0.012, 0.07, M.poly, length2 * 0.55, -look.tubeRadius - 0.04, 0, 12);
|
|
19700
|
-
|
|
19889
|
+
box3(group, 0.04, 0.01, 0.03, M.dark, length2 * 0.55, -look.tubeRadius - 4e-3, 0);
|
|
19701
19890
|
}
|
|
19702
19891
|
};
|
|
19703
19892
|
var buildUnderbarrelLauncher = ({ kit, attachment, slide: slide2 }) => {
|
|
@@ -19759,20 +19948,20 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19759
19948
|
const hiddenBy = /* @__PURE__ */ new Map();
|
|
19760
19949
|
const switchedOn = /* @__PURE__ */ new Map();
|
|
19761
19950
|
const hide = (id, objects) => {
|
|
19762
|
-
for (const
|
|
19763
|
-
const owners = hiddenBy.get(
|
|
19951
|
+
for (const object2 of objects) {
|
|
19952
|
+
const owners = hiddenBy.get(object2) ?? /* @__PURE__ */ new Set();
|
|
19764
19953
|
owners.add(id);
|
|
19765
|
-
hiddenBy.set(
|
|
19766
|
-
|
|
19954
|
+
hiddenBy.set(object2, owners);
|
|
19955
|
+
object2.visible = false;
|
|
19767
19956
|
}
|
|
19768
19957
|
};
|
|
19769
19958
|
const unhide = (id, objects) => {
|
|
19770
|
-
for (const
|
|
19771
|
-
const owners = hiddenBy.get(
|
|
19959
|
+
for (const object2 of objects) {
|
|
19960
|
+
const owners = hiddenBy.get(object2);
|
|
19772
19961
|
owners?.delete(id);
|
|
19773
19962
|
if (!owners || owners.size === 0) {
|
|
19774
|
-
hiddenBy.delete(
|
|
19775
|
-
|
|
19963
|
+
hiddenBy.delete(object2);
|
|
19964
|
+
object2.visible = true;
|
|
19776
19965
|
}
|
|
19777
19966
|
}
|
|
19778
19967
|
};
|
|
@@ -19808,15 +19997,15 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19808
19997
|
entry.model.setOn?.(beams && switchedOn.get(id) === true);
|
|
19809
19998
|
}
|
|
19810
19999
|
};
|
|
19811
|
-
const sync = (
|
|
19812
|
-
const wanted = new Map(
|
|
20000
|
+
const sync = (list2) => {
|
|
20001
|
+
const wanted = new Map(list2.map((part) => [part.id, part]));
|
|
19813
20002
|
for (const id of [...drawn.keys()]) if (!wanted.has(id) || drawn.get(id)?.mount !== wanted.get(id)?.mount) take(id);
|
|
19814
20003
|
for (const [id, objects] of Object.entries(parts.fittings ?? {})) {
|
|
19815
20004
|
if (id === MUZZLE_DEFAULT) continue;
|
|
19816
|
-
for (const
|
|
20005
|
+
for (const object2 of objects) object2.visible = wanted.has(id);
|
|
19817
20006
|
}
|
|
19818
|
-
for (const
|
|
19819
|
-
for (const part of
|
|
20007
|
+
for (const object2 of parts.fittings?.[MUZZLE_DEFAULT] ?? []) object2.visible = !list2.some((part) => part.mount === "muzzle");
|
|
20008
|
+
for (const part of list2) {
|
|
19820
20009
|
const attachment = options.catalogue.get(part.id);
|
|
19821
20010
|
if (!attachment || drawn.has(part.id) || parts.fittings?.[part.id]) continue;
|
|
19822
20011
|
if (part.integral === true && attachment.kind === "optic") continue;
|
|
@@ -19908,9 +20097,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19908
20097
|
const replacement = substitutions(kit, condition);
|
|
19909
20098
|
const glowing = new Set(model.parts.glow);
|
|
19910
20099
|
const paint2 = condition === "rusty" ? kit.M.rust.color : condition === "worn" ? kit.M.worn.color : void 0;
|
|
19911
|
-
model.root.traverse((
|
|
20100
|
+
model.root.traverse((object2) => {
|
|
19912
20101
|
var _a, _b;
|
|
19913
|
-
const mesh2 =
|
|
20102
|
+
const mesh2 = object2;
|
|
19914
20103
|
if (!mesh2.isMesh) return;
|
|
19915
20104
|
(_a = mesh2.userData).baseMaterial ?? (_a.baseMaterial = mesh2.material);
|
|
19916
20105
|
const base = mesh2.userData.baseMaterial;
|
|
@@ -21353,15 +21542,15 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
21353
21542
|
puff3.t += dt;
|
|
21354
21543
|
return puff3.t < puff3.life;
|
|
21355
21544
|
}
|
|
21356
|
-
function moveOnRing(puff3,
|
|
21357
|
-
const ringTime =
|
|
21358
|
-
const centerY =
|
|
21359
|
-
const majorRadius =
|
|
21360
|
-
const theta = puff3.th + ringTime *
|
|
21361
|
-
const minorRadius =
|
|
21545
|
+
function moveOnRing(puff3, ring22, wind) {
|
|
21546
|
+
const ringTime = ring22.t;
|
|
21547
|
+
const centerY = ring22.y0 + ring22.rise * (1 - Math.exp(-ringTime * ring22.rk));
|
|
21548
|
+
const majorRadius = ring22.R0 + (ring22.R1 - ring22.R0) * (1 - Math.exp(-ringTime * 1.6));
|
|
21549
|
+
const theta = puff3.th + ringTime * ring22.roll;
|
|
21550
|
+
const minorRadius = ring22.r * (0.8 + 0.4 * Math.min(1, ringTime));
|
|
21362
21551
|
const radius = majorRadius + minorRadius * Math.cos(theta);
|
|
21363
|
-
puff3.x =
|
|
21364
|
-
puff3.z =
|
|
21552
|
+
puff3.x = ring22.x + Math.cos(puff3.ph) * radius + wind.x * ringTime * 0.6;
|
|
21553
|
+
puff3.z = ring22.z + Math.sin(puff3.ph) * radius + wind.z * ringTime * 0.6;
|
|
21365
21554
|
puff3.y = centerY + minorRadius * Math.sin(theta);
|
|
21366
21555
|
}
|
|
21367
21556
|
function moveFree(puff3, dt, age, heat, wind) {
|
|
@@ -21683,7 +21872,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
21683
21872
|
var mesh = (options) => ({ op: "mesh", spawn: options });
|
|
21684
21873
|
var debris = (options) => ({ op: "debris", spawn: options });
|
|
21685
21874
|
var decal = (...args) => ({ op: "decal", args });
|
|
21686
|
-
var
|
|
21875
|
+
var ring2 = (...args) => ({ op: "ring", args });
|
|
21687
21876
|
var flash = (...args) => ({ op: "flash", args });
|
|
21688
21877
|
var lens = (...args) => ({ op: "lens", args });
|
|
21689
21878
|
var screen = (change) => ({ op: "screen", ...change });
|
|
@@ -21715,7 +21904,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
21715
21904
|
burst("normal", 30, { p: CENTRE, dir: UP, cone: 1.3, sp: [2, 4], life: 1.4, size: [0.04, 0.08], c0: 4872732, g: 9.8, fi: 0, gnd: 3, ds: [0.1, 0.2] }),
|
|
21716
21905
|
repeat(scaled(10), debris({ p: CENTRE, dir: UP, cone: 1.2, sp: [2, 5], size: [0.07, 0.05, 0.07], k: [0.6, 1.4], c: ite(mod(INDEX, 2), 7043666, 4856338), life: 9 })),
|
|
21717
21906
|
decal(0, 0, 0, 1.6, 6978084, { grow: 0.6, life: 60, fluid: "bile" }),
|
|
21718
|
-
|
|
21907
|
+
ring2([0, 0.02, 0], 4, 4, 8, 3824160, UP, 0.35),
|
|
21719
21908
|
screen({ add: { shake: 0.15 } })
|
|
21720
21909
|
)
|
|
21721
21910
|
],
|
|
@@ -21879,7 +22068,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
21879
22068
|
timeline: [
|
|
21880
22069
|
after(
|
|
21881
22070
|
PREPARATION_END,
|
|
21882
|
-
repeat(3, after(add(PREPARATION_END, mul(INDEX, 0.18)),
|
|
22071
|
+
repeat(3, after(add(PREPARATION_END, mul(INDEX, 0.18)), ring2([0, 0.03, 0], 0.3, 9, 0.9, WHITE_RING))),
|
|
21883
22072
|
screen({ add: { chroma: 7, shake: 0.25 } })
|
|
21884
22073
|
)
|
|
21885
22074
|
],
|
|
@@ -23446,7 +23635,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
23446
23635
|
grow: 2.2
|
|
23447
23636
|
})
|
|
23448
23637
|
];
|
|
23449
|
-
var flashPiece = (shape, radius, height, width, at3, rot,
|
|
23638
|
+
var flashPiece = (shape, radius, height, width, at3, rot, color2) => mesh({ shape, r: radius, ...height === void 0 ? {} : { h: height }, seg: width, seg2: shape === "sphere" ? 8 : 1, p: ORIGIN2, at: at3, rot, roll: variable("roll"), ramp: FLASH_RAMP, life: FLASH_SECONDS, c0: color2, a: FLASH_OPACITY, add: true });
|
|
23450
23639
|
var MUZZLE_FLASH2 = {
|
|
23451
23640
|
id: "viewmodel_muzzle_flash",
|
|
23452
23641
|
pageId: "event:viewmodel_muzzle_flash",
|
|
@@ -23560,10 +23749,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
23560
23749
|
direction(out) {
|
|
23561
23750
|
const up = next() * 2 - 1;
|
|
23562
23751
|
const angle = next() * Math.PI * 2;
|
|
23563
|
-
const
|
|
23564
|
-
out.x =
|
|
23752
|
+
const ring22 = Math.sqrt(1 - up * up);
|
|
23753
|
+
out.x = ring22 * Math.cos(angle);
|
|
23565
23754
|
out.y = up;
|
|
23566
|
-
out.z =
|
|
23755
|
+
out.z = ring22 * Math.sin(angle);
|
|
23567
23756
|
return out;
|
|
23568
23757
|
},
|
|
23569
23758
|
get state() {
|
|
@@ -23578,7 +23767,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
23578
23767
|
mixed ^= mixed >>> 16;
|
|
23579
23768
|
return (mixed >>> 0) % (LEHMER_MODULUS - 1) + 1;
|
|
23580
23769
|
}
|
|
23581
|
-
function
|
|
23770
|
+
function streamFor3(eventSeed) {
|
|
23582
23771
|
return lehmer(mixEventSeed(eventSeed));
|
|
23583
23772
|
}
|
|
23584
23773
|
var TABLE = {
|
|
@@ -23602,10 +23791,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
23602
23791
|
function bloodHit(engine, point, exitDirection, age, scale = 1) {
|
|
23603
23792
|
if (age === 3) return drySplash(engine, point, exitDirection, scale);
|
|
23604
23793
|
const amount = BLEED_BY_AGE[age];
|
|
23605
|
-
const
|
|
23606
|
-
engine.burst("normal", 10 * amount * scale, { p: point, dir: negated(exitDirection), cone: 0.9, sp: [0.2, 0.9], drag: 3, life: [0.25, 0.5], size: [0.08, 0.14], grow: 3, c0:
|
|
23607
|
-
engine.burst("normal", 45 * amount * scale, { p: point, dir: exitDirection, cone: 0.45, sp: [2.5, 6], life: [1, 1.6], size: [0.035, 0.07], c0:
|
|
23608
|
-
engine.burst("normal", 14 * amount * scale, { p: point, dir: exitDirection, cone: 0.5, sp: [1, 2.5], drag: 2.5, life: [0.4, 0.8], size: [0.1, 0.18], grow: 3, c0:
|
|
23794
|
+
const color2 = BLOOD_COLORS[age];
|
|
23795
|
+
engine.burst("normal", 10 * amount * scale, { p: point, dir: negated(exitDirection), cone: 0.9, sp: [0.2, 0.9], drag: 3, life: [0.25, 0.5], size: [0.08, 0.14], grow: 3, c0: color2, a: 0.65 });
|
|
23796
|
+
engine.burst("normal", 45 * amount * scale, { p: point, dir: exitDirection, cone: 0.45, sp: [2.5, 6], life: [1, 1.6], size: [0.035, 0.07], c0: color2, a: 0.95, g: 9.8, fi: 0, gnd: 3, ds: [0.06, 0.16] });
|
|
23797
|
+
engine.burst("normal", 14 * amount * scale, { p: point, dir: exitDirection, cone: 0.5, sp: [1, 2.5], drag: 2.5, life: [0.4, 0.8], size: [0.1, 0.18], grow: 3, c0: color2, a: 0.45 });
|
|
23609
23798
|
}
|
|
23610
23799
|
function waterImpact(engine, point, scale) {
|
|
23611
23800
|
engine.burst("normal", 22 * scale, { p: point, dir: [0, 1, 0], cone: 0.5, sp: [1.5, 3.5], life: [0.4, 0.7], size: [0.03, 0.06], c0: 13162214, a: 0.7, g: 9.8, fi: 0, gnd: 1 });
|
|
@@ -24250,8 +24439,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
24250
24439
|
var UP12 = [0, 1, 0];
|
|
24251
24440
|
var ZERO2 = [0, 0, 0];
|
|
24252
24441
|
var FULL_TURN_DRAWN = 6.283;
|
|
24253
|
-
function scaledSizes(
|
|
24254
|
-
return [
|
|
24442
|
+
function scaledSizes(range2, factor) {
|
|
24443
|
+
return [range2[0] * Math.sqrt(factor), range2[1] * Math.sqrt(factor)];
|
|
24255
24444
|
}
|
|
24256
24445
|
function fireEmit(engine, key, dt, centre, radius, factor, options = {}) {
|
|
24257
24446
|
const wind = options.wind ?? ZERO2;
|
|
@@ -24896,7 +25085,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
24896
25085
|
const px = x + Math.cos(angle) * distance2;
|
|
24897
25086
|
const pz = z + Math.sin(angle) * distance2;
|
|
24898
25087
|
const plate = random.next() < 0.6;
|
|
24899
|
-
const
|
|
25088
|
+
const color2 = RIM_COLORS[random.next() < 0.5 ? 0 : 1];
|
|
24900
25089
|
const tiltX = random.between(-0.5, 0.5);
|
|
24901
25090
|
const tiltZ = random.between(-0.6, 0.2);
|
|
24902
25091
|
store.add({
|
|
@@ -24907,7 +25096,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
24907
25096
|
scale: [size * 2, size * 0.35, size * 1.4],
|
|
24908
25097
|
rotation: [tiltX, angle, tiltZ],
|
|
24909
25098
|
plate,
|
|
24910
|
-
color
|
|
25099
|
+
color: color2
|
|
24911
25100
|
});
|
|
24912
25101
|
}
|
|
24913
25102
|
}
|
|
@@ -24928,27 +25117,27 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
24928
25117
|
function createRingPool(capacity) {
|
|
24929
25118
|
return new OrderedPool(capacity, () => ({ x: 0, z: 0, y0: 0, rise: 0, rk: 0, R0: 0, R1: 0, r: 0, roll: 0, t: 0, life: 0 }));
|
|
24930
25119
|
}
|
|
24931
|
-
function ageOrKeep4(
|
|
24932
|
-
|
|
24933
|
-
return
|
|
25120
|
+
function ageOrKeep4(ring22, dt) {
|
|
25121
|
+
ring22.t += dt;
|
|
25122
|
+
return ring22.t <= ring22.life + 1;
|
|
24934
25123
|
}
|
|
24935
25124
|
function updateRings(pool, dt) {
|
|
24936
25125
|
pool.compact(ageOrKeep4, dt);
|
|
24937
25126
|
}
|
|
24938
25127
|
function spawnRing(pool, spec) {
|
|
24939
|
-
const
|
|
24940
|
-
|
|
24941
|
-
|
|
24942
|
-
|
|
24943
|
-
|
|
24944
|
-
|
|
24945
|
-
|
|
24946
|
-
|
|
24947
|
-
|
|
24948
|
-
|
|
24949
|
-
|
|
24950
|
-
|
|
24951
|
-
return
|
|
25128
|
+
const ring22 = pool.acquire();
|
|
25129
|
+
ring22.x = spec.x;
|
|
25130
|
+
ring22.z = spec.z;
|
|
25131
|
+
ring22.y0 = spec.y0;
|
|
25132
|
+
ring22.rise = spec.rise;
|
|
25133
|
+
ring22.rk = spec.rk;
|
|
25134
|
+
ring22.R0 = spec.R0;
|
|
25135
|
+
ring22.R1 = spec.R1;
|
|
25136
|
+
ring22.r = spec.r;
|
|
25137
|
+
ring22.roll = spec.roll;
|
|
25138
|
+
ring22.t = 0;
|
|
25139
|
+
ring22.life = spec.life;
|
|
25140
|
+
return ring22;
|
|
24952
25141
|
}
|
|
24953
25142
|
var DEFAULT_DURATION = 0.3;
|
|
24954
25143
|
var SHELL_GROWTH_SECONDS = 0.12;
|
|
@@ -25117,12 +25306,12 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
25117
25306
|
const { core, def, random, x, z, size, scale } = context;
|
|
25118
25307
|
if (!core.layers.smoke || !def.dust.count || !(scale > 0.15)) return;
|
|
25119
25308
|
const count = Math.round(def.dust.count * scale);
|
|
25120
|
-
const
|
|
25121
|
-
const
|
|
25309
|
+
const color2 = hexToLinearRgb(def.dust.color);
|
|
25310
|
+
const cone2 = def.cone;
|
|
25122
25311
|
for (let index = 0; index < count; index++) {
|
|
25123
25312
|
let angle = random.next() * Math.PI * 2;
|
|
25124
|
-
if (
|
|
25125
|
-
const speed = random.between(0.6, 1) * def.injury * (
|
|
25313
|
+
if (cone2) angle = coneAngle(context) + random.between(-cone2.half, cone2.half);
|
|
25314
|
+
const speed = random.between(0.6, 1) * def.injury * (cone2 ? 1.6 : 0.9);
|
|
25126
25315
|
const vy2 = random.between(0.2, 1.2);
|
|
25127
25316
|
const s1 = size * random.between(0.5, 0.8);
|
|
25128
25317
|
const sg = size * random.between(0.2, 0.35);
|
|
@@ -25141,21 +25330,21 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
25141
25330
|
life,
|
|
25142
25331
|
drag: 3.6,
|
|
25143
25332
|
buoy: 0.2,
|
|
25144
|
-
color,
|
|
25333
|
+
color: color2,
|
|
25145
25334
|
kind: 1
|
|
25146
25335
|
});
|
|
25147
25336
|
}
|
|
25148
25337
|
}
|
|
25149
25338
|
function coneAngle(context) {
|
|
25150
|
-
const
|
|
25151
|
-
if (!
|
|
25152
|
-
return context.direction ? Math.atan2(context.direction.z, context.direction.x) :
|
|
25339
|
+
const cone2 = context.def.cone;
|
|
25340
|
+
if (!cone2) return 0;
|
|
25341
|
+
return context.direction ? Math.atan2(context.direction.z, context.direction.x) : cone2.angle;
|
|
25153
25342
|
}
|
|
25154
25343
|
function sparkDirection(context) {
|
|
25155
25344
|
const { def, random, direction } = context;
|
|
25156
|
-
const
|
|
25157
|
-
if (
|
|
25158
|
-
const angle = coneAngle(context) + random.between(-
|
|
25345
|
+
const cone2 = def.cone;
|
|
25346
|
+
if (cone2) {
|
|
25347
|
+
const angle = coneAngle(context) + random.between(-cone2.half, cone2.half);
|
|
25159
25348
|
SCRATCH.x = Math.cos(angle);
|
|
25160
25349
|
SCRATCH.y = random.between(-0.05, 0.25);
|
|
25161
25350
|
SCRATCH.z = Math.sin(angle);
|
|
@@ -25215,7 +25404,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
25215
25404
|
const s = random.between(0.07, 0.2) * (chunks.size ?? 1);
|
|
25216
25405
|
const plate = chunks.plate ? random.next() < 0.6 : random.next() < 0.15;
|
|
25217
25406
|
const sy = plate ? s * 0.3 : s * random.between(0.6, 1);
|
|
25218
|
-
const
|
|
25407
|
+
const color2 = hexToRgb(chunks.colors.length > 0 ? pick2(random, chunks.colors) : DEFAULT_CHUNK_COLOR);
|
|
25219
25408
|
const hot = random.next() < chunks.hot;
|
|
25220
25409
|
addChunk(core, random, {
|
|
25221
25410
|
x: x + d.x * 0.2,
|
|
@@ -25227,7 +25416,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
25227
25416
|
sx: plate ? s * 1.6 : s,
|
|
25228
25417
|
sy,
|
|
25229
25418
|
sz: plate ? s * 1.1 : s,
|
|
25230
|
-
color,
|
|
25419
|
+
color: color2,
|
|
25231
25420
|
plate,
|
|
25232
25421
|
hot
|
|
25233
25422
|
});
|
|
@@ -25244,7 +25433,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
25244
25433
|
const speed = random.between(3, 8) * speedScale;
|
|
25245
25434
|
const s = random.between(0.12, 0.28);
|
|
25246
25435
|
const vy2 = random.between(4, 10);
|
|
25247
|
-
const
|
|
25436
|
+
const color2 = hexToRgb(random.next() < 0.6 ? ROCK_COLORS[0] : ROCK_COLORS[1]);
|
|
25248
25437
|
addChunk(core, random, {
|
|
25249
25438
|
x: x + Math.cos(angle) * 0.3,
|
|
25250
25439
|
y: 0.1,
|
|
@@ -25255,7 +25444,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
25255
25444
|
sx: s * 1.6,
|
|
25256
25445
|
sy: s * 0.35,
|
|
25257
25446
|
sz: s * 1.2,
|
|
25258
|
-
color,
|
|
25447
|
+
color: color2,
|
|
25259
25448
|
plate: true
|
|
25260
25449
|
});
|
|
25261
25450
|
}
|
|
@@ -25263,8 +25452,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
25263
25452
|
function composeMushroom(context, spec) {
|
|
25264
25453
|
const { core, random, x, y, z } = context;
|
|
25265
25454
|
core.trace?.mushroom?.(x, y, z, spec);
|
|
25266
|
-
const
|
|
25267
|
-
const
|
|
25455
|
+
const color2 = spec.color !== void 0 ? hexToLinearRgb(spec.color) : SMOKE_COLORS.black;
|
|
25456
|
+
const ring22 = spawnRing(core.rings, {
|
|
25268
25457
|
x,
|
|
25269
25458
|
z,
|
|
25270
25459
|
y0: y + spec.height * 0.15,
|
|
@@ -25280,11 +25469,11 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
25280
25469
|
const count = Math.round((spec.count || 40) * Math.max(lod, 0.4));
|
|
25281
25470
|
for (let index = 0; index < count; index++) {
|
|
25282
25471
|
const s1 = spec.radius * random.between(0.35, 0.5);
|
|
25283
|
-
const life = random.between(
|
|
25472
|
+
const life = random.between(ring22.life * 0.75, ring22.life);
|
|
25284
25473
|
const h0 = random.between(1, 1.25);
|
|
25285
25474
|
const hl = random.between(0.9, 1.6);
|
|
25286
|
-
const puff3 = addPuff(core, random, { x, y, z, s0: spec.radius * 0.2, s1, sg: spec.radius * 0.06, gk: 3, life, h0, hl, color, kind: 0 });
|
|
25287
|
-
puff3.ring =
|
|
25475
|
+
const puff3 = addPuff(core, random, { x, y, z, s0: spec.radius * 0.2, s1, sg: spec.radius * 0.06, gk: 3, life, h0, hl, color: color2, kind: 0 });
|
|
25476
|
+
puff3.ring = ring22;
|
|
25288
25477
|
puff3.ph = random.next() * Math.PI * 2;
|
|
25289
25478
|
puff3.th = random.next() * Math.PI * 2;
|
|
25290
25479
|
}
|
|
@@ -25300,7 +25489,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
25300
25489
|
const life = random.between(3, 5);
|
|
25301
25490
|
const h0 = random.between(0.9, 1.2);
|
|
25302
25491
|
const hl = random.between(0.6, 1.1);
|
|
25303
|
-
addPuff(core, random, { x: px, y: y + 0.3, z: pz, vx: vx2, vy: vy2, vz: vz2, s0: spec.radius * 0.12, s1, sg: spec.radius * 0.05, gk: 4, life, h0, hl, drag: 1.2, buoy: 0.5, color });
|
|
25492
|
+
addPuff(core, random, { x: px, y: y + 0.3, z: pz, vx: vx2, vy: vy2, vz: vz2, s0: spec.radius * 0.12, s1, sg: spec.radius * 0.05, gk: 4, life, h0, hl, drag: 1.2, buoy: 0.5, color: color2 });
|
|
25304
25493
|
}
|
|
25305
25494
|
}
|
|
25306
25495
|
function composeAfterEffects(context) {
|
|
@@ -26075,7 +26264,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
26075
26264
|
const host = {
|
|
26076
26265
|
groundAt: this.options.groundAt,
|
|
26077
26266
|
gravity: this.options.gravity,
|
|
26078
|
-
land: (owner, x, y, z,
|
|
26267
|
+
land: (owner, x, y, z, color2, tag) => this.listeners.get(owner)?.(x, y, z, color2, tag)
|
|
26079
26268
|
};
|
|
26080
26269
|
if (this.additive.live > 0 || this.additive.drawCount > 0) this.additive.update(dt, host);
|
|
26081
26270
|
if (this.normal.live > 0 || this.normal.drawCount > 0) this.normal.update(dt, host);
|
|
@@ -26088,17 +26277,17 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
26088
26277
|
var TWO_PI_ROUNDED = 6.2832;
|
|
26089
26278
|
var WIDE_CONE = 3.1;
|
|
26090
26279
|
var UP13 = [0, 1, 0];
|
|
26091
|
-
function drawRange(random,
|
|
26092
|
-
if (Array.isArray(
|
|
26093
|
-
return
|
|
26280
|
+
function drawRange(random, range2) {
|
|
26281
|
+
if (Array.isArray(range2)) return random.between(range2[0], range2[1]);
|
|
26282
|
+
return range2 || 0;
|
|
26094
26283
|
}
|
|
26095
26284
|
function randomUnit(random, out) {
|
|
26096
26285
|
const up = random.next() * 2 - 1;
|
|
26097
26286
|
const angle = random.next() * TWO_PI_ROUNDED;
|
|
26098
|
-
const
|
|
26099
|
-
out.x =
|
|
26287
|
+
const ring22 = Math.sqrt(1 - up * up);
|
|
26288
|
+
out.x = ring22 * Math.cos(angle);
|
|
26100
26289
|
out.y = up;
|
|
26101
|
-
out.z =
|
|
26290
|
+
out.z = ring22 * Math.sin(angle);
|
|
26102
26291
|
return out;
|
|
26103
26292
|
}
|
|
26104
26293
|
var tangentA = { x: 0, y: 0, z: 0 };
|
|
@@ -26113,10 +26302,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
26113
26302
|
out.z = z;
|
|
26114
26303
|
return out;
|
|
26115
26304
|
}
|
|
26116
|
-
function coneDirection(random, direction,
|
|
26117
|
-
if (
|
|
26305
|
+
function coneDirection(random, direction, cone2, out) {
|
|
26306
|
+
if (cone2 >= WIDE_CONE) return randomUnit(random, out);
|
|
26118
26307
|
const [dx, dy, dz] = direction ?? UP13;
|
|
26119
|
-
const cosTilt = 1 - random.next() * (1 - Math.cos(
|
|
26308
|
+
const cosTilt = 1 - random.next() * (1 - Math.cos(cone2));
|
|
26120
26309
|
const sinTilt = Math.sqrt(1 - cosTilt * cosTilt);
|
|
26121
26310
|
const phase = random.next() * TWO_PI_ROUNDED;
|
|
26122
26311
|
axis.x = dx;
|
|
@@ -26161,76 +26350,76 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
26161
26350
|
}
|
|
26162
26351
|
spawn(options) {
|
|
26163
26352
|
const random = this.context.random;
|
|
26164
|
-
const
|
|
26353
|
+
const piece2 = this.pieces[this.next++ % CAPACITY];
|
|
26165
26354
|
coneDirection(random, options.dir, options.cone ?? 3.2, this.direction);
|
|
26166
26355
|
const speed = drawRange(random, options.sp);
|
|
26167
26356
|
const size = options.size ?? DEFAULT_SIZE;
|
|
26168
26357
|
const scale = options.k ? drawRange(random, options.k) : 1;
|
|
26169
|
-
const
|
|
26358
|
+
const box3 = options.box;
|
|
26170
26359
|
const spin = options.spin || DEFAULT_SPIN;
|
|
26171
|
-
|
|
26172
|
-
|
|
26173
|
-
|
|
26174
|
-
|
|
26175
|
-
|
|
26176
|
-
|
|
26177
|
-
|
|
26178
|
-
|
|
26179
|
-
|
|
26180
|
-
|
|
26181
|
-
|
|
26182
|
-
|
|
26183
|
-
|
|
26184
|
-
|
|
26185
|
-
|
|
26186
|
-
|
|
26187
|
-
|
|
26188
|
-
|
|
26189
|
-
|
|
26190
|
-
|
|
26360
|
+
piece2.on = true;
|
|
26361
|
+
piece2.x = options.p[0] + (box3 ? random.between(-box3[0], box3[0]) : 0);
|
|
26362
|
+
piece2.y = options.p[1] + (box3 ? random.between(-box3[1], box3[1]) : 0);
|
|
26363
|
+
piece2.z = options.p[2] + (box3 ? random.between(-box3[2], box3[2]) : 0);
|
|
26364
|
+
piece2.vx = this.direction.x * speed + (options.v ? options.v[0] : 0);
|
|
26365
|
+
piece2.vy = this.direction.y * speed + (options.v ? options.v[1] : 0);
|
|
26366
|
+
piece2.vz = this.direction.z * speed + (options.v ? options.v[2] : 0);
|
|
26367
|
+
piece2.sx = size[0] * scale;
|
|
26368
|
+
piece2.sy = size[1] * scale;
|
|
26369
|
+
piece2.sz = size[2] * scale;
|
|
26370
|
+
piece2.rx = random.between(0, FULL_TURN_DRAWN3);
|
|
26371
|
+
piece2.ry = random.between(0, FULL_TURN_DRAWN3);
|
|
26372
|
+
piece2.rz = random.between(0, FULL_TURN_DRAWN3);
|
|
26373
|
+
piece2.ax = random.between(-1, 1) * spin;
|
|
26374
|
+
piece2.ay = random.between(-1, 1) * spin;
|
|
26375
|
+
piece2.az = random.between(-1, 1) * spin;
|
|
26376
|
+
piece2.life = options.life || DEFAULT_LIFE;
|
|
26377
|
+
piece2.bounce = options.bounce ?? DEFAULT_BOUNCE;
|
|
26378
|
+
piece2.rest = false;
|
|
26379
|
+
piece2.color = options.c ?? DEFAULT_COLOR3;
|
|
26191
26380
|
}
|
|
26192
26381
|
clear() {
|
|
26193
|
-
for (const
|
|
26382
|
+
for (const piece2 of this.pieces) piece2.on = false;
|
|
26194
26383
|
this.count = 0;
|
|
26195
26384
|
}
|
|
26196
26385
|
update(dt) {
|
|
26197
26386
|
this.count = 0;
|
|
26198
|
-
for (const
|
|
26199
|
-
if (!
|
|
26387
|
+
for (const piece2 of this.pieces) {
|
|
26388
|
+
if (!piece2.on) continue;
|
|
26200
26389
|
this.count++;
|
|
26201
|
-
|
|
26202
|
-
if (
|
|
26203
|
-
|
|
26390
|
+
piece2.life -= dt;
|
|
26391
|
+
if (piece2.life <= 0) {
|
|
26392
|
+
piece2.on = false;
|
|
26204
26393
|
continue;
|
|
26205
26394
|
}
|
|
26206
|
-
if (!
|
|
26395
|
+
if (!piece2.rest) this.move(piece2, dt);
|
|
26207
26396
|
}
|
|
26208
26397
|
}
|
|
26209
26398
|
/** Scale at the end of its life, 1 until the last half second (the renderer's `sh`). */
|
|
26210
|
-
static fade(
|
|
26211
|
-
return Math.min(1,
|
|
26212
|
-
}
|
|
26213
|
-
move(
|
|
26214
|
-
|
|
26215
|
-
|
|
26216
|
-
|
|
26217
|
-
|
|
26218
|
-
|
|
26219
|
-
|
|
26220
|
-
|
|
26221
|
-
const groundHeight = this.context.groundAt(
|
|
26222
|
-
if (
|
|
26223
|
-
|
|
26224
|
-
|
|
26225
|
-
|
|
26226
|
-
|
|
26227
|
-
|
|
26228
|
-
|
|
26229
|
-
|
|
26230
|
-
if (Math.abs(
|
|
26231
|
-
|
|
26232
|
-
|
|
26233
|
-
|
|
26399
|
+
static fade(piece2) {
|
|
26400
|
+
return Math.min(1, piece2.life / FADE_SECONDS);
|
|
26401
|
+
}
|
|
26402
|
+
move(piece2, dt) {
|
|
26403
|
+
piece2.vy -= GRAVITY22 * dt;
|
|
26404
|
+
piece2.x += piece2.vx * dt;
|
|
26405
|
+
piece2.y += piece2.vy * dt;
|
|
26406
|
+
piece2.z += piece2.vz * dt;
|
|
26407
|
+
piece2.rx += piece2.ax * dt;
|
|
26408
|
+
piece2.ry += piece2.ay * dt;
|
|
26409
|
+
piece2.rz += piece2.az * dt;
|
|
26410
|
+
const groundHeight = this.context.groundAt(piece2.x, piece2.z) + Math.min(piece2.sx, piece2.sy, piece2.sz) * 0.5;
|
|
26411
|
+
if (piece2.y >= groundHeight) return;
|
|
26412
|
+
piece2.y = groundHeight;
|
|
26413
|
+
piece2.vy *= -piece2.bounce;
|
|
26414
|
+
piece2.vx *= 0.55;
|
|
26415
|
+
piece2.vz *= 0.55;
|
|
26416
|
+
piece2.ax *= 0.5;
|
|
26417
|
+
piece2.ay *= 0.5;
|
|
26418
|
+
piece2.az *= 0.5;
|
|
26419
|
+
if (Math.abs(piece2.vy) < 0.5 && Math.hypot(piece2.vx, piece2.vz) < 0.3) {
|
|
26420
|
+
piece2.rest = true;
|
|
26421
|
+
piece2.rx = Math.round(piece2.rx / QUARTER_TURN4) * QUARTER_TURN4;
|
|
26422
|
+
piece2.rz = Math.round(piece2.rz / QUARTER_TURN4) * QUARTER_TURN4;
|
|
26234
26423
|
}
|
|
26235
26424
|
}
|
|
26236
26425
|
};
|
|
@@ -26249,7 +26438,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
26249
26438
|
__publicField2(this, "count", 0);
|
|
26250
26439
|
__publicField2(this, "next", 0);
|
|
26251
26440
|
}
|
|
26252
|
-
add(x, y, z, size,
|
|
26441
|
+
add(x, y, z, size, color2, options = {}) {
|
|
26253
26442
|
const random = this.context.random;
|
|
26254
26443
|
const index = this.next++ % CAPACITY2;
|
|
26255
26444
|
const decal2 = this.decals[index];
|
|
@@ -26265,7 +26454,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
26265
26454
|
decal2.t = -(options.delay || 0);
|
|
26266
26455
|
decal2.grow = options.grow ?? DEFAULT_GROW;
|
|
26267
26456
|
decal2.life = options.life || DEFAULT_LIFE2;
|
|
26268
|
-
decal2.color =
|
|
26457
|
+
decal2.color = color2;
|
|
26269
26458
|
decal2.normal = normal;
|
|
26270
26459
|
const fluid = options.fluid ?? (options.dark ? "blood" : void 0);
|
|
26271
26460
|
decal2.fluid = fluid;
|
|
@@ -26296,7 +26485,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
26296
26485
|
};
|
|
26297
26486
|
var CAPACITY3 = 400;
|
|
26298
26487
|
var IDENTITY = [0, 0, 0, 1];
|
|
26299
|
-
function
|
|
26488
|
+
function multiply2(a, b) {
|
|
26300
26489
|
const [ax, ay, az, aw] = a;
|
|
26301
26490
|
const [bx, by, bz, bw] = b;
|
|
26302
26491
|
return [aw * bx + ax * bw + ay * bz - az * by, aw * by - ax * bz + ay * bw + az * bx, aw * bz + ax * by - ay * bx + az * bw, aw * bw - ax * bx - ay * by - az * bz];
|
|
@@ -26327,7 +26516,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
26327
26516
|
x: options.p[0],
|
|
26328
26517
|
y: options.p[1],
|
|
26329
26518
|
z: options.p[2],
|
|
26330
|
-
frame: options.roll ?
|
|
26519
|
+
frame: options.roll ? multiply2(frame, aboutX(options.roll)) : frame,
|
|
26331
26520
|
at: options.at ?? [0, 0, 0],
|
|
26332
26521
|
rx: options.rot?.[0] ?? 0,
|
|
26333
26522
|
ry: options.rot?.[1] ?? 0,
|
|
@@ -26679,29 +26868,29 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
26679
26868
|
__publicField2(this, "count", 0);
|
|
26680
26869
|
__publicField2(this, "next", 0);
|
|
26681
26870
|
}
|
|
26682
|
-
add(point, from, to, duration,
|
|
26683
|
-
const
|
|
26684
|
-
|
|
26685
|
-
|
|
26686
|
-
|
|
26687
|
-
|
|
26688
|
-
|
|
26689
|
-
|
|
26690
|
-
|
|
26691
|
-
|
|
26692
|
-
|
|
26871
|
+
add(point, from, to, duration, color2, normal, hold) {
|
|
26872
|
+
const ring22 = this.rings[this.next++ % RING_CAPACITY];
|
|
26873
|
+
ring22.on = true;
|
|
26874
|
+
ring22.point = [point[0], point[1], point[2]];
|
|
26875
|
+
ring22.from = from;
|
|
26876
|
+
ring22.to = to;
|
|
26877
|
+
ring22.t = 0;
|
|
26878
|
+
ring22.duration = duration;
|
|
26879
|
+
ring22.color = color2;
|
|
26880
|
+
ring22.normal = normal ?? UP15;
|
|
26881
|
+
ring22.hold = hold || 0;
|
|
26693
26882
|
}
|
|
26694
26883
|
clear() {
|
|
26695
|
-
for (const
|
|
26884
|
+
for (const ring22 of this.rings) ring22.on = false;
|
|
26696
26885
|
this.count = 0;
|
|
26697
26886
|
}
|
|
26698
26887
|
update(dt) {
|
|
26699
26888
|
this.count = 0;
|
|
26700
|
-
for (const
|
|
26701
|
-
if (!
|
|
26889
|
+
for (const ring22 of this.rings) {
|
|
26890
|
+
if (!ring22.on) continue;
|
|
26702
26891
|
this.count++;
|
|
26703
|
-
|
|
26704
|
-
if (
|
|
26892
|
+
ring22.t += dt;
|
|
26893
|
+
if (ring22.t / ring22.duration >= 1 && !ring22.hold) ring22.on = false;
|
|
26705
26894
|
}
|
|
26706
26895
|
}
|
|
26707
26896
|
};
|
|
@@ -26718,7 +26907,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
26718
26907
|
get lit() {
|
|
26719
26908
|
return this.lights.filter((light) => light.intensity > 0).length;
|
|
26720
26909
|
}
|
|
26721
|
-
flash(point,
|
|
26910
|
+
flash(point, color2, intensity, duration, distance2, force, steady) {
|
|
26722
26911
|
const { level } = this.context.quality;
|
|
26723
26912
|
if (level >= 1 && !force) return;
|
|
26724
26913
|
if (level >= 2 && force !== "boom") return;
|
|
@@ -26726,7 +26915,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
26726
26915
|
light.x = point[0];
|
|
26727
26916
|
light.y = point[1];
|
|
26728
26917
|
light.z = point[2];
|
|
26729
|
-
light.color =
|
|
26918
|
+
light.color = color2;
|
|
26730
26919
|
light.distance = distance2 || DEFAULT_LIGHT_DISTANCE;
|
|
26731
26920
|
light.peak = intensity;
|
|
26732
26921
|
light.duration = duration;
|
|
@@ -26893,13 +27082,13 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
26893
27082
|
light.z = point[2];
|
|
26894
27083
|
light.intensity = intensity * (0.75 + FIRE_FLICKER_SWAY * Math.sin(time * 23) * Math.sin(time * 7.3) + this.random.between(-FIRE_FLICKER_JITTER, FIRE_FLICKER_JITTER));
|
|
26895
27084
|
}
|
|
26896
|
-
lensBlob(x, y, radius,
|
|
26897
|
-
this.lens.push({ x, y, radius, color, alpha, fall: this.random.between(2, 8) });
|
|
27085
|
+
lensBlob(x, y, radius, color2, alpha) {
|
|
27086
|
+
this.lens.push({ x, y, radius, color: color2, alpha, fall: this.random.between(2, 8) });
|
|
26898
27087
|
}
|
|
26899
27088
|
/** The order of the page's loop (W1285-1287): the sprites, streaks, debris, decals, rings and lights, then the screen and its lens. */
|
|
26900
27089
|
update(dt) {
|
|
26901
|
-
const leaveDecal = (x, y, z, size,
|
|
26902
|
-
this.decal([x, y, z, size,
|
|
27090
|
+
const leaveDecal = (x, y, z, size, color2, options) => {
|
|
27091
|
+
this.decal([x, y, z, size, color2, options]);
|
|
26903
27092
|
};
|
|
26904
27093
|
this.add.update(dt, leaveDecal);
|
|
26905
27094
|
this.normal.update(dt, leaveDecal);
|
|
@@ -27013,7 +27202,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
27013
27202
|
function streamOf(seed) {
|
|
27014
27203
|
if (randomMode === "shared") return sharedRandom;
|
|
27015
27204
|
handles.events++;
|
|
27016
|
-
return
|
|
27205
|
+
return streamFor3(seed ?? Math.imul(handles.events, AUTO_SEED) + (options.seed ?? 0));
|
|
27017
27206
|
}
|
|
27018
27207
|
function detonate(def, point, call3) {
|
|
27019
27208
|
composeExplosion(core, def, { x: point[0], y: point[1], z: point[2], direction: call3.direction, random: call3.random, handle: call3.handle });
|
|
@@ -27367,8 +27556,8 @@ void main(){
|
|
|
27367
27556
|
geometry.setAttribute("position", new THREE.Float32BufferAttribute([-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0], 3));
|
|
27368
27557
|
geometry.setIndex([0, 1, 2, 0, 2, 3]);
|
|
27369
27558
|
const where = new Float32Array(capacity * 4);
|
|
27370
|
-
const
|
|
27371
|
-
const attributes = [dynamic(THREE, where, 4), dynamic(THREE,
|
|
27559
|
+
const color2 = new Float32Array(capacity * 4);
|
|
27560
|
+
const attributes = [dynamic(THREE, where, 4), dynamic(THREE, color2, 4)];
|
|
27372
27561
|
geometry.setAttribute("aP", attributes[0]);
|
|
27373
27562
|
geometry.setAttribute("aC", attributes[1]);
|
|
27374
27563
|
geometry.instanceCount = 0;
|
|
@@ -27386,10 +27575,10 @@ void main(){
|
|
|
27386
27575
|
where[n * 4 + 1] = g.outY;
|
|
27387
27576
|
where[n * 4 + 2] = g.outZ;
|
|
27388
27577
|
where[n * 4 + 3] = g.outSize;
|
|
27389
|
-
|
|
27390
|
-
|
|
27391
|
-
|
|
27392
|
-
|
|
27578
|
+
color2[n * 4] = g.color[0];
|
|
27579
|
+
color2[n * 4 + 1] = g.color[1];
|
|
27580
|
+
color2[n * 4 + 2] = g.color[2];
|
|
27581
|
+
color2[n * 4 + 3] = g.outIntensity;
|
|
27393
27582
|
n++;
|
|
27394
27583
|
}
|
|
27395
27584
|
geometry.instanceCount = n;
|
|
@@ -27436,11 +27625,11 @@ void main(){
|
|
|
27436
27625
|
const mesh2 = chunk.plate ? plates : rocks;
|
|
27437
27626
|
const index = chunk.plate ? plateCount++ : rockCount++;
|
|
27438
27627
|
mesh2.setMatrixAt(index, matrix);
|
|
27439
|
-
const
|
|
27628
|
+
const color2 = colorOf(chunk);
|
|
27440
27629
|
const colors = mesh2.instanceColor.array;
|
|
27441
|
-
colors[index * 3] =
|
|
27442
|
-
colors[index * 3 + 1] =
|
|
27443
|
-
colors[index * 3 + 2] =
|
|
27630
|
+
colors[index * 3] = color2[0];
|
|
27631
|
+
colors[index * 3 + 1] = color2[1];
|
|
27632
|
+
colors[index * 3 + 2] = color2[2];
|
|
27444
27633
|
}
|
|
27445
27634
|
rocks.count = rockCount;
|
|
27446
27635
|
plates.count = plateCount;
|
|
@@ -27606,11 +27795,11 @@ void main(){
|
|
|
27606
27795
|
const rockMaterials = /* @__PURE__ */ new Map();
|
|
27607
27796
|
const blood = [];
|
|
27608
27797
|
let meshCount = 0;
|
|
27609
|
-
function rockMaterial(
|
|
27610
|
-
let material = rockMaterials.get(
|
|
27798
|
+
function rockMaterial(color2) {
|
|
27799
|
+
let material = rockMaterials.get(color2);
|
|
27611
27800
|
if (!material) {
|
|
27612
|
-
material = new THREE.MeshStandardMaterial({ color, roughness: 0.9, metalness: 0, flatShading: true });
|
|
27613
|
-
rockMaterials.set(
|
|
27801
|
+
material = new THREE.MeshStandardMaterial({ color: color2, roughness: 0.9, metalness: 0, flatShading: true });
|
|
27802
|
+
rockMaterials.set(color2, material);
|
|
27614
27803
|
owned.push(material);
|
|
27615
27804
|
}
|
|
27616
27805
|
return material;
|
|
@@ -27758,10 +27947,10 @@ void main(){
|
|
|
27758
27947
|
});
|
|
27759
27948
|
const shell = new THREE.Mesh(shellGeometry, shellMaterial);
|
|
27760
27949
|
shell.renderOrder = 4;
|
|
27761
|
-
const
|
|
27762
|
-
|
|
27763
|
-
group.add(shell,
|
|
27764
|
-
return { shell, ring:
|
|
27950
|
+
const ring3 = new THREE.Mesh(ringGeometry, ringMaterial);
|
|
27951
|
+
ring3.renderOrder = 3;
|
|
27952
|
+
group.add(shell, ring3);
|
|
27953
|
+
return { shell, ring: ring3, shellAlpha, ringAlpha };
|
|
27765
27954
|
}
|
|
27766
27955
|
return {
|
|
27767
27956
|
group,
|
|
@@ -27982,9 +28171,9 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
27982
28171
|
function streakLayer(THREE, pool) {
|
|
27983
28172
|
const geometry = new THREE.BufferGeometry();
|
|
27984
28173
|
const position = new THREE.BufferAttribute(pool.segment, 3).setUsage(THREE.DynamicDrawUsage);
|
|
27985
|
-
const
|
|
28174
|
+
const color2 = new THREE.BufferAttribute(pool.segmentColor, 3).setUsage(THREE.DynamicDrawUsage);
|
|
27986
28175
|
geometry.setAttribute("position", position);
|
|
27987
|
-
geometry.setAttribute("color",
|
|
28176
|
+
geometry.setAttribute("color", color2);
|
|
27988
28177
|
geometry.setDrawRange(0, 0);
|
|
27989
28178
|
const material = new THREE.LineBasicMaterial({ vertexColors: true, transparent: true, blending: THREE.AdditiveBlending, depthWrite: false });
|
|
27990
28179
|
const lines = new THREE.LineSegments(geometry, material);
|
|
@@ -27995,7 +28184,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
27995
28184
|
object: lines,
|
|
27996
28185
|
sync() {
|
|
27997
28186
|
geometry.setDrawRange(0, pool.count * 2);
|
|
27998
|
-
position.needsUpdate =
|
|
28187
|
+
position.needsUpdate = color2.needsUpdate = true;
|
|
27999
28188
|
return pool.count > 0;
|
|
28000
28189
|
},
|
|
28001
28190
|
dispose() {
|
|
@@ -28049,18 +28238,18 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
28049
28238
|
sync() {
|
|
28050
28239
|
let drawn = false;
|
|
28051
28240
|
for (let index = 0; index < DEBRIS_CAPACITY; index++) {
|
|
28052
|
-
const
|
|
28053
|
-
if (!
|
|
28241
|
+
const piece2 = pool.pieces[index];
|
|
28242
|
+
if (!piece2.on) {
|
|
28054
28243
|
mesh2.setMatrixAt(index, hidden);
|
|
28055
28244
|
continue;
|
|
28056
28245
|
}
|
|
28057
28246
|
drawn = true;
|
|
28058
|
-
const shrink = Math.min(1,
|
|
28059
|
-
euler.set(
|
|
28247
|
+
const shrink = Math.min(1, piece2.life / FADE_SECONDS2);
|
|
28248
|
+
euler.set(piece2.rx, piece2.ry, piece2.rz);
|
|
28060
28249
|
quaternion2.setFromEuler(euler);
|
|
28061
|
-
matrix.compose(position.set(
|
|
28250
|
+
matrix.compose(position.set(piece2.x, piece2.y, piece2.z), quaternion2, scale.set(piece2.sx * shrink, piece2.sy * shrink, piece2.sz * shrink));
|
|
28062
28251
|
mesh2.setMatrixAt(index, matrix);
|
|
28063
|
-
mesh2.setColorAt(index, colour.setHex(
|
|
28252
|
+
mesh2.setColorAt(index, colour.setHex(piece2.color));
|
|
28064
28253
|
}
|
|
28065
28254
|
mesh2.instanceMatrix.needsUpdate = true;
|
|
28066
28255
|
if (mesh2.instanceColor) mesh2.instanceColor.needsUpdate = true;
|
|
@@ -28200,18 +28389,18 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
28200
28389
|
sync() {
|
|
28201
28390
|
let drawn = false;
|
|
28202
28391
|
for (let index = 0; index < RING_CAPACITY3; index++) {
|
|
28203
|
-
const
|
|
28204
|
-
if (!
|
|
28392
|
+
const ring3 = pool.rings[index];
|
|
28393
|
+
if (!ring3.on) {
|
|
28205
28394
|
mesh2.setMatrixAt(index, hidden);
|
|
28206
28395
|
continue;
|
|
28207
28396
|
}
|
|
28208
28397
|
drawn = true;
|
|
28209
|
-
const k = Math.min(1,
|
|
28210
|
-
const radius =
|
|
28211
|
-
quaternion2.setFromUnitVectors(forward, normal.set(
|
|
28212
|
-
matrix.compose(position.set(
|
|
28398
|
+
const k = Math.min(1, ring3.t / ring3.duration);
|
|
28399
|
+
const radius = ring3.from + (ring3.to - ring3.from) * (1 - Math.pow(1 - k, 2));
|
|
28400
|
+
quaternion2.setFromUnitVectors(forward, normal.set(ring3.normal[0], ring3.normal[1], ring3.normal[2]));
|
|
28401
|
+
matrix.compose(position.set(ring3.point[0], ring3.point[1], ring3.point[2]), quaternion2, scale.set(radius, radius, 1));
|
|
28213
28402
|
mesh2.setMatrixAt(index, matrix);
|
|
28214
|
-
mesh2.setColorAt(index, colour.setHex(
|
|
28403
|
+
mesh2.setColorAt(index, colour.setHex(ring3.color).multiplyScalar(ring3.hold ? ring3.hold : 1 - k));
|
|
28215
28404
|
}
|
|
28216
28405
|
mesh2.instanceMatrix.needsUpdate = true;
|
|
28217
28406
|
if (mesh2.instanceColor) mesh2.instanceColor.needsUpdate = true;
|
|
@@ -28333,7 +28522,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
28333
28522
|
sprites: [sprites.additive, sprites.normal, ...workshopLayers ? [workshopLayers.group] : []]
|
|
28334
28523
|
});
|
|
28335
28524
|
const applyLayers = () => {
|
|
28336
|
-
for (const [id, objects] of Object.entries(layerObjects())) for (const
|
|
28525
|
+
for (const [id, objects] of Object.entries(layerObjects())) for (const object2 of objects) object2.visible = layerOn.get(id) !== false;
|
|
28337
28526
|
};
|
|
28338
28527
|
const screenNow = () => mergeScreens(world.screen(), world.peekWorkshop()?.screen);
|
|
28339
28528
|
let clock = 0;
|
|
@@ -28557,25 +28746,25 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
28557
28746
|
// src/fx/particles.ts
|
|
28558
28747
|
var MAX_PARTICLES = 900;
|
|
28559
28748
|
var FLOOR_FRICTION = 0.45;
|
|
28560
|
-
var disposeOwned = (
|
|
28561
|
-
|
|
28749
|
+
var disposeOwned = (object2) => {
|
|
28750
|
+
object2.traverse((child) => {
|
|
28562
28751
|
const mesh2 = child;
|
|
28563
28752
|
if (mesh2.isMesh) mesh2.geometry.dispose();
|
|
28564
28753
|
});
|
|
28565
28754
|
};
|
|
28566
28755
|
function createParticles(THREE, scene, groundAt) {
|
|
28567
|
-
let
|
|
28756
|
+
let list2 = [];
|
|
28568
28757
|
const remove = (particle) => {
|
|
28569
28758
|
particle.object.removeFromParent();
|
|
28570
28759
|
if (particle.ownsGeometry) disposeOwned(particle.object);
|
|
28571
28760
|
if (particle.fadeFrom !== void 0) particle.object.material.dispose();
|
|
28572
|
-
|
|
28761
|
+
list2 = list2.filter((other) => other !== particle);
|
|
28573
28762
|
};
|
|
28574
28763
|
const api = {
|
|
28575
|
-
spawn(
|
|
28576
|
-
scene.add(
|
|
28577
|
-
|
|
28578
|
-
object,
|
|
28764
|
+
spawn(object2, velocity, options = {}) {
|
|
28765
|
+
scene.add(object2);
|
|
28766
|
+
list2.push({
|
|
28767
|
+
object: object2,
|
|
28579
28768
|
velocity,
|
|
28580
28769
|
spin: options.spin ?? new THREE.Vector3(),
|
|
28581
28770
|
age: 0,
|
|
@@ -28593,35 +28782,35 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
28593
28782
|
ownsGeometry: options.ownsGeometry ?? false,
|
|
28594
28783
|
bounces: 0
|
|
28595
28784
|
});
|
|
28596
|
-
const oldest =
|
|
28597
|
-
if (
|
|
28785
|
+
const oldest = list2[0];
|
|
28786
|
+
if (list2.length > MAX_PARTICLES && oldest) remove(oldest);
|
|
28598
28787
|
},
|
|
28599
28788
|
update(dt) {
|
|
28600
|
-
for (const particle of [...
|
|
28789
|
+
for (const particle of [...list2]) {
|
|
28601
28790
|
particle.age += dt;
|
|
28602
28791
|
if (particle.age > particle.life) {
|
|
28603
28792
|
remove(particle);
|
|
28604
28793
|
continue;
|
|
28605
28794
|
}
|
|
28606
|
-
const { object } = particle;
|
|
28607
|
-
if (particle.fadeFrom !== void 0)
|
|
28795
|
+
const { object: object2 } = particle;
|
|
28796
|
+
if (particle.fadeFrom !== void 0) object2.material.opacity = Math.max(0, particle.fadeFrom * (1 - particle.age / particle.life));
|
|
28608
28797
|
if (particle.resting) continue;
|
|
28609
28798
|
particle.velocity.y -= particle.gravity * dt;
|
|
28610
28799
|
if (particle.drag) particle.velocity.multiplyScalar(Math.max(0, 1 - particle.drag * dt));
|
|
28611
|
-
|
|
28612
|
-
|
|
28613
|
-
|
|
28614
|
-
|
|
28615
|
-
if (particle.grow)
|
|
28800
|
+
object2.position.addScaledVector(particle.velocity, dt);
|
|
28801
|
+
object2.rotation.x += particle.spin.x * dt;
|
|
28802
|
+
object2.rotation.y += particle.spin.y * dt;
|
|
28803
|
+
object2.rotation.z += particle.spin.z * dt;
|
|
28804
|
+
if (particle.grow) object2.scale.multiplyScalar(1 + particle.grow * dt);
|
|
28616
28805
|
if (particle.radius < 0) continue;
|
|
28617
|
-
const floor2 = groundAt(
|
|
28618
|
-
if (
|
|
28806
|
+
const floor2 = groundAt(object2.position.x, object2.position.z) + particle.radius;
|
|
28807
|
+
if (object2.position.y >= floor2 || particle.velocity.y >= 0) continue;
|
|
28619
28808
|
if (particle.onGround) {
|
|
28620
|
-
particle.onGround(
|
|
28809
|
+
particle.onGround(object2.position.clone());
|
|
28621
28810
|
remove(particle);
|
|
28622
28811
|
continue;
|
|
28623
28812
|
}
|
|
28624
|
-
|
|
28813
|
+
object2.position.y = floor2;
|
|
28625
28814
|
particle.velocity.y *= -particle.bounce;
|
|
28626
28815
|
particle.velocity.x *= FLOOR_FRICTION;
|
|
28627
28816
|
particle.velocity.z *= FLOOR_FRICTION;
|
|
@@ -28629,13 +28818,13 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
28629
28818
|
if (particle.bounces++ < 4 && Math.abs(particle.velocity.y) >= 0.18) api.onBounce?.(particle.kind);
|
|
28630
28819
|
if (Math.abs(particle.velocity.y) < 0.18) {
|
|
28631
28820
|
particle.resting = true;
|
|
28632
|
-
particle.onRest?.(
|
|
28821
|
+
particle.onRest?.(object2);
|
|
28633
28822
|
}
|
|
28634
28823
|
}
|
|
28635
28824
|
},
|
|
28636
|
-
count: (kind) =>
|
|
28825
|
+
count: (kind) => list2.filter((particle) => particle.kind === kind).length,
|
|
28637
28826
|
dispose() {
|
|
28638
|
-
for (const particle of [...
|
|
28827
|
+
for (const particle of [...list2]) remove(particle);
|
|
28639
28828
|
}
|
|
28640
28829
|
};
|
|
28641
28830
|
return api;
|
|
@@ -28646,13 +28835,13 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
28646
28835
|
const registry = partRegistry(model.parts);
|
|
28647
28836
|
const rest = /* @__PURE__ */ new Map();
|
|
28648
28837
|
for (const part of [...registry.values(), model.root]) rest.set(part, { position: part.position.clone(), rotation: part.rotation.clone() });
|
|
28649
|
-
const apply = (
|
|
28650
|
-
const base = rest.get(
|
|
28838
|
+
const apply = (object2, pose) => {
|
|
28839
|
+
const base = rest.get(object2);
|
|
28651
28840
|
if (!base) return;
|
|
28652
28841
|
const [dx, dy, dz] = pose.position ?? [0, 0, 0];
|
|
28653
28842
|
const [rx, ry, rz] = pose.rotation ?? [0, 0, 0];
|
|
28654
|
-
|
|
28655
|
-
|
|
28843
|
+
object2.position.set(base.position.x + dx, base.position.y + dy, base.position.z + dz);
|
|
28844
|
+
object2.rotation.set(base.rotation.x + rx, base.rotation.y + ry, base.rotation.z + rz);
|
|
28656
28845
|
};
|
|
28657
28846
|
return {
|
|
28658
28847
|
setPartPose(partId, pose) {
|
|
@@ -28677,9 +28866,9 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
28677
28866
|
// src/fx/viewmodel-events.ts
|
|
28678
28867
|
var PI14 = Math.PI;
|
|
28679
28868
|
var UGL_FLASH = 1.6;
|
|
28680
|
-
var restFlat = (
|
|
28681
|
-
|
|
28682
|
-
|
|
28869
|
+
var restFlat = (object2) => {
|
|
28870
|
+
object2.rotation.x = 0;
|
|
28871
|
+
object2.rotation.z = 0;
|
|
28683
28872
|
};
|
|
28684
28873
|
function createClipEventHandler(world, session) {
|
|
28685
28874
|
const { kit, particles, effects, random } = world;
|
|
@@ -28749,7 +28938,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
28749
28938
|
root.updateWorldMatrix(true, true);
|
|
28750
28939
|
const copy = parts.mag.clone(true);
|
|
28751
28940
|
parts.mag.matrixWorld.decompose(copy.position, copy.quaternion, copy.scale);
|
|
28752
|
-
particles.spawn(copy, toWorld(session, vector(up ? -0.25 : 0.05, up ? 0.9 : -0.3, 0.18)), { kind: "magazine", life: 25, radius: 0.014, bounce: 0.15, spin: vector(1.5, 0.5, 2.5), onRest: (
|
|
28941
|
+
particles.spawn(copy, toWorld(session, vector(up ? -0.25 : 0.05, up ? 0.9 : -0.3, 0.18)), { kind: "magazine", life: 25, radius: 0.014, bounce: 0.15, spin: vector(1.5, 0.5, 2.5), onRest: (object2) => object2.rotation.set(0, object2.rotation.y, PI14 / 2) });
|
|
28753
28942
|
};
|
|
28754
28943
|
const stuckCase = () => {
|
|
28755
28944
|
if (!session.cartridge || !parts.eject) return;
|
|
@@ -29064,7 +29253,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
29064
29253
|
// src/fx.ts
|
|
29065
29254
|
function createWeaponFx(options) {
|
|
29066
29255
|
const layers = options.layers ?? createLayers();
|
|
29067
|
-
const
|
|
29256
|
+
const box3 = createBoxFx({ ...options, layers });
|
|
29068
29257
|
const model = createViewmodel({
|
|
29069
29258
|
layers,
|
|
29070
29259
|
...options.soundDistance ? { soundDistance: options.soundDistance } : {},
|
|
@@ -29085,29 +29274,29 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
29085
29274
|
handle(event, tool) {
|
|
29086
29275
|
if (event.type === "explosion") return;
|
|
29087
29276
|
if (event.type === "tool") {
|
|
29088
|
-
if (hasWeaponModel(event.weapon))
|
|
29277
|
+
if (hasWeaponModel(event.weapon)) box3.unequip();
|
|
29089
29278
|
else model.unequip();
|
|
29090
29279
|
}
|
|
29091
29280
|
if (model.inHand !== null || event.type === "tool" && hasWeaponModel(event.weapon)) model.handle(event, tool);
|
|
29092
|
-
else
|
|
29281
|
+
else box3.handle(event, tool);
|
|
29093
29282
|
},
|
|
29094
29283
|
update(dt) {
|
|
29095
|
-
|
|
29284
|
+
box3.update(dt);
|
|
29096
29285
|
model.update(dt);
|
|
29097
29286
|
},
|
|
29098
29287
|
setCondition: (condition) => model.setCondition(condition),
|
|
29099
29288
|
layers,
|
|
29100
29289
|
get inHand() {
|
|
29101
|
-
return model.inHand ??
|
|
29290
|
+
return model.inHand ?? box3.inHand;
|
|
29102
29291
|
},
|
|
29103
29292
|
get casings() {
|
|
29104
|
-
return
|
|
29293
|
+
return box3.casings + model.casings;
|
|
29105
29294
|
},
|
|
29106
29295
|
get magazines() {
|
|
29107
|
-
return
|
|
29296
|
+
return box3.magazines + model.magazines;
|
|
29108
29297
|
},
|
|
29109
29298
|
dispose() {
|
|
29110
|
-
|
|
29299
|
+
box3.dispose();
|
|
29111
29300
|
model.dispose();
|
|
29112
29301
|
}
|
|
29113
29302
|
};
|
|
@@ -30033,7 +30222,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
30033
30222
|
target_plywood: ["plywood", [0.6, 0.8, 0.018], 13214315],
|
|
30034
30223
|
target_concrete: ["concrete", [0.4, 0.2, 0.2], 10132116]
|
|
30035
30224
|
};
|
|
30036
|
-
const [material, size,
|
|
30225
|
+
const [material, size, color2] = face[id];
|
|
30037
30226
|
const spec = {
|
|
30038
30227
|
name,
|
|
30039
30228
|
parts: [
|
|
@@ -30043,7 +30232,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
30043
30232
|
joints: [{ a: "post", b: "face", kind: "bolt" }],
|
|
30044
30233
|
tags: ["target"]
|
|
30045
30234
|
};
|
|
30046
|
-
return { spec, colors: { post: 3816770, face:
|
|
30235
|
+
return { spec, colors: { post: 3816770, face: color2 } };
|
|
30047
30236
|
};
|
|
30048
30237
|
var weaponItem = (def, name) => {
|
|
30049
30238
|
const id = `${WEAPON_ITEM_PREFIX}${def.id}`;
|