@adatechnology/game-weapons-three 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/index.d.ts +21 -2
- package/dist/index.global.js +43033 -24055
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +299 -30
- package/dist/index.js.map +1 -1
- package/package.json +12 -11
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// src/area.ts
|
|
2
|
+
import { markKitOrigin as markKitOrigin4 } from "@adatechnology/game-contracts";
|
|
2
3
|
import { createArsenal } from "@adatechnology/game-weapons";
|
|
4
|
+
import { furnitureSpec } from "@adatechnology/game-floorplan-three";
|
|
3
5
|
|
|
4
6
|
// src/attachments-key.ts
|
|
5
7
|
var attachmentsKey = (parts) => {
|
|
@@ -1534,6 +1536,8 @@ var HAND_HOLD = {
|
|
|
1534
1536
|
/** Closure of the fingers on a grip and on a forend (0 open, 1 closed). */
|
|
1535
1537
|
closed: 0.9,
|
|
1536
1538
|
forend: 0.6,
|
|
1539
|
+
/** How far the shooting hand slides on its grip so the thumb reaches the safety lever. */
|
|
1540
|
+
thumbReach: 0.02,
|
|
1537
1541
|
/** How fast the supporting hand goes to the magazine and back, per second. */
|
|
1538
1542
|
magRate: 7,
|
|
1539
1543
|
/** The hands shrink with the tool: a tool drawn at scale `s` takes hands at `s ** handScaleExponent`. */
|
|
@@ -1646,9 +1650,12 @@ function holdOfProp(THREE, group, category, scale) {
|
|
|
1646
1650
|
}
|
|
1647
1651
|
|
|
1648
1652
|
// src/props.ts
|
|
1653
|
+
import { markKitOrigin as markKitOrigin2 } from "@adatechnology/game-contracts";
|
|
1654
|
+
import { buildItem, hasItemModel } from "@adatechnology/game-items-three";
|
|
1649
1655
|
import { mergeByMaterial, shapeGeometries as shapeGeometries2 } from "@adatechnology/game-shapes-three";
|
|
1650
1656
|
|
|
1651
1657
|
// src/models/index.ts
|
|
1658
|
+
import { markKitOrigin } from "@adatechnology/game-contracts";
|
|
1652
1659
|
import { WEAPONS } from "@adatechnology/game-weapons";
|
|
1653
1660
|
|
|
1654
1661
|
// src/data/models.json
|
|
@@ -4727,6 +4734,7 @@ function buildWeaponModelById(THREE, id) {
|
|
|
4727
4734
|
built.group.position.x = -new THREE.Box3().setFromObject(built.group).min.x;
|
|
4728
4735
|
} else root = fitLength(kit, built.group, entry.length / 1e3);
|
|
4729
4736
|
root.name = id;
|
|
4737
|
+
markKitOrigin(root, { owner: "game-weapons-three", kind: "weapon", id });
|
|
4730
4738
|
const model = { id, root, inner: built.group, parts: built.parts };
|
|
4731
4739
|
if (!built.parts.frames) built.parts.frames = deriveFrames(THREE, model);
|
|
4732
4740
|
return model;
|
|
@@ -4815,15 +4823,90 @@ function buildProp(THREE, prop) {
|
|
|
4815
4823
|
}
|
|
4816
4824
|
return group;
|
|
4817
4825
|
}
|
|
4826
|
+
var WEAPON_ITEM_MODELS = /* @__PURE__ */ new Map([
|
|
4827
|
+
["wrench", { item: "adjustable_wrench" }],
|
|
4828
|
+
["extinguisher", { item: "fire_extinguisher", flip: true }],
|
|
4829
|
+
["blowtorch", { item: "gas_torch", flip: true }],
|
|
4830
|
+
["crossbow", { turn: 1 }],
|
|
4831
|
+
["knife", { flip: true }],
|
|
4832
|
+
["meat_cleaver", { flip: true }],
|
|
4833
|
+
["screwdriver", { flip: true }]
|
|
4834
|
+
]);
|
|
4835
|
+
function registerWeaponItemModel(weaponId, model) {
|
|
4836
|
+
WEAPON_ITEM_MODELS.set(weaponId, model ?? { item: "" });
|
|
4837
|
+
}
|
|
4838
|
+
function itemModelOfWeapon(weaponId) {
|
|
4839
|
+
const id = WEAPON_ITEM_MODELS.get(weaponId)?.item ?? weaponId;
|
|
4840
|
+
return id && hasItemModel(id) ? id : void 0;
|
|
4841
|
+
}
|
|
4842
|
+
function buildItemWeaponModel(THREE, def) {
|
|
4843
|
+
const itemId = itemModelOfWeapon(def.id);
|
|
4844
|
+
if (!itemId) return void 0;
|
|
4845
|
+
const { root } = buildItem(THREE, { id: itemId, category: "weapon", size: [0, 0, 0], model: itemId });
|
|
4846
|
+
const group = markKitOrigin2(new THREE.Group(), { owner: "game-weapons-three", kind: "weapon", id: def.id });
|
|
4847
|
+
group.name = def.id;
|
|
4848
|
+
group.add(root);
|
|
4849
|
+
const sizeOf = () => {
|
|
4850
|
+
group.updateMatrixWorld(true);
|
|
4851
|
+
return new THREE.Box3().setFromObject(root).getSize(new THREE.Vector3());
|
|
4852
|
+
};
|
|
4853
|
+
let size = sizeOf();
|
|
4854
|
+
if (size.y > size.x && size.y >= size.z) root.rotateOnWorldAxis(new THREE.Vector3(0, 0, 1), -Math.PI / 2);
|
|
4855
|
+
else if (size.z > size.x && size.z > size.y) root.rotateOnWorldAxis(new THREE.Vector3(0, 1, 0), Math.PI / 2);
|
|
4856
|
+
size = sizeOf();
|
|
4857
|
+
if (size.z < size.y) root.rotateOnWorldAxis(new THREE.Vector3(1, 0, 0), Math.PI / 2);
|
|
4858
|
+
const turn2 = WEAPON_ITEM_MODELS.get(def.id)?.turn ?? 0;
|
|
4859
|
+
if (turn2) root.rotateOnWorldAxis(new THREE.Vector3(0, 1, 0), turn2 * Math.PI / 2);
|
|
4860
|
+
const box2 = new THREE.Box3().setFromObject(root);
|
|
4861
|
+
const middle = (box2.min.x + box2.max.x) / 2;
|
|
4862
|
+
const span = [
|
|
4863
|
+
[Infinity, -Infinity],
|
|
4864
|
+
[Infinity, -Infinity]
|
|
4865
|
+
];
|
|
4866
|
+
const point = new THREE.Vector3();
|
|
4867
|
+
root.traverse((node) => {
|
|
4868
|
+
const mesh = node;
|
|
4869
|
+
const position = mesh.isMesh ? mesh.geometry.getAttribute("position") : void 0;
|
|
4870
|
+
if (!position) return;
|
|
4871
|
+
for (let i = 0; i < position.count; i++) {
|
|
4872
|
+
point.fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
|
|
4873
|
+
const half = span[point.x > middle ? 1 : 0];
|
|
4874
|
+
half[0] = Math.min(half[0], point.z);
|
|
4875
|
+
half[1] = Math.max(half[1], point.z);
|
|
4876
|
+
}
|
|
4877
|
+
});
|
|
4878
|
+
const reach = span.map(([low, high]) => high - low);
|
|
4879
|
+
const flip = WEAPON_ITEM_MODELS.get(def.id)?.flip === true;
|
|
4880
|
+
if (reach[0] > reach[1] !== flip) root.rotateOnWorldAxis(new THREE.Vector3(0, 1, 0), Math.PI);
|
|
4881
|
+
group.updateMatrixWorld(true);
|
|
4882
|
+
const laid = new THREE.Box3().setFromObject(root);
|
|
4883
|
+
const centre = laid.getCenter(new THREE.Vector3());
|
|
4884
|
+
root.position.sub(new THREE.Vector3(centre.x, laid.min.y, centre.z));
|
|
4885
|
+
const length = laid.max.x - laid.min.x;
|
|
4886
|
+
const handle = new THREE.Object3D();
|
|
4887
|
+
handle.name = "handle";
|
|
4888
|
+
handle.position.set(-length * 0.35, 0, 0);
|
|
4889
|
+
group.add(handle);
|
|
4890
|
+
root.traverse((node) => {
|
|
4891
|
+
const mesh = node;
|
|
4892
|
+
if (!mesh.isMesh) return;
|
|
4893
|
+
mesh.castShadow = true;
|
|
4894
|
+
mesh.receiveShadow = true;
|
|
4895
|
+
});
|
|
4896
|
+
return group;
|
|
4897
|
+
}
|
|
4818
4898
|
function buildWeaponModel(THREE, def) {
|
|
4819
|
-
return buildProp(THREE, weaponProp(def));
|
|
4899
|
+
return buildItemWeaponModel(THREE, def) ?? buildProp(THREE, weaponProp(def));
|
|
4820
4900
|
}
|
|
4821
4901
|
var MODEL_BODY = "body";
|
|
4822
4902
|
function buildModeledProp(THREE, def, name, decorate) {
|
|
4823
|
-
const model = buildWeaponModelById(THREE, def.id)
|
|
4903
|
+
const model = buildWeaponModelById(THREE, def.id) ?? (() => {
|
|
4904
|
+
const root = buildItemWeaponModel(THREE, def);
|
|
4905
|
+
return root ? { root } : void 0;
|
|
4906
|
+
})();
|
|
4824
4907
|
if (!model) return void 0;
|
|
4825
4908
|
decorate?.(model.root);
|
|
4826
|
-
const group = new THREE.Group();
|
|
4909
|
+
const group = markKitOrigin2(new THREE.Group(), { owner: "game-weapons-three", kind: "weapon", id: def.id });
|
|
4827
4910
|
group.name = name;
|
|
4828
4911
|
const box2 = new THREE.Box3().setFromObject(model.root);
|
|
4829
4912
|
const center = box2.getCenter(new THREE.Vector3());
|
|
@@ -5420,9 +5503,14 @@ function faultClips(context) {
|
|
|
5420
5503
|
);
|
|
5421
5504
|
return [misfire, ...stopped];
|
|
5422
5505
|
}
|
|
5506
|
+
var SAFETY_MOTION = { cant: 0.22, lift: 0.012, in: 0.14, flickAt: 0.16, flick: 0.1, outAt: 0.32, out: 0.16, lever: 0.6 };
|
|
5423
5507
|
function safetyClips(context) {
|
|
5424
|
-
|
|
5425
|
-
|
|
5508
|
+
const { cant, lift, in: rise, flickAt, flick, outAt, out, lever } = SAFETY_MOTION;
|
|
5509
|
+
const carry = () => [turn(ROOT, "x", 0, rise, 0, cant), move(ROOT, "y", 0, rise, 0, lift), turn(ROOT, "x", outAt, out, cant, 0), move(ROOT, "y", outAt, out, lift, 0)];
|
|
5510
|
+
const flickTo = (from, to) => context.parts.safety ? [turn("safety", "z", flickAt, flick, from, to)] : [];
|
|
5511
|
+
const clips = [composeClip("safety_on", [...carry(), ...flickTo(0, -lever)]), composeClip("safety_off", [...carry(), ...flickTo(-lever, 0)])];
|
|
5512
|
+
if (context.parts.safety) clips.push(composeClip("mode", [turn("safety", "z", 0, 0.07, 0, 0.4), turn("safety", "z", 0.07, 0.07, 0.4, 0)]));
|
|
5513
|
+
return clips;
|
|
5426
5514
|
}
|
|
5427
5515
|
var drawClip = () => composeClip("draw", [move(ROOT, "y", 0, 0.35, -0.1, 0), turn(ROOT, "z", 0, 0.35, -0.6, 0)]);
|
|
5428
5516
|
|
|
@@ -5994,6 +6082,7 @@ function applyCondition(kit, model, condition) {
|
|
|
5994
6082
|
}
|
|
5995
6083
|
|
|
5996
6084
|
// src/models/cartridge.ts
|
|
6085
|
+
import { markKitOrigin as markKitOrigin3 } from "@adatechnology/game-contracts";
|
|
5997
6086
|
var BOTTLENECK_RATIO = 0.8;
|
|
5998
6087
|
function cartridgeShape(caliber, dims) {
|
|
5999
6088
|
if (caliber.caseType === "shell" || caliber.rim === "shell") return "shell";
|
|
@@ -6005,7 +6094,7 @@ function cartridgeShape(caliber, dims) {
|
|
|
6005
6094
|
}
|
|
6006
6095
|
function buildCartridge(kit, dims, shape) {
|
|
6007
6096
|
const { M, cylinderY } = kit;
|
|
6008
|
-
const group = kit.group();
|
|
6097
|
+
const group = markKitOrigin3(kit.group(), { owner: "game-weapons-three", kind: "ammunition", id: shape });
|
|
6009
6098
|
const radius = dims.caseDiameter / 2;
|
|
6010
6099
|
const bulletRadius = dims.projectileDiameter / 2;
|
|
6011
6100
|
const caseLength = dims.caseLength;
|
|
@@ -6037,7 +6126,7 @@ function buildCartridge(kit, dims, shape) {
|
|
|
6037
6126
|
}
|
|
6038
6127
|
function buildCasing(kit, dims, shape) {
|
|
6039
6128
|
const { M, cylinderX } = kit;
|
|
6040
|
-
const group = kit.group();
|
|
6129
|
+
const group = markKitOrigin3(kit.group(), { owner: "game-weapons-three", kind: "ammunition", id: shape });
|
|
6041
6130
|
const radius = dims.caseDiameter / 2e3;
|
|
6042
6131
|
const length = dims.caseLength / 1e3;
|
|
6043
6132
|
if (shape === "shell") {
|
|
@@ -6053,7 +6142,7 @@ function buildCasing(kit, dims, shape) {
|
|
|
6053
6142
|
return { group, radius, length };
|
|
6054
6143
|
}
|
|
6055
6144
|
function buildRound(kit, dims, shape) {
|
|
6056
|
-
const group = kit.group();
|
|
6145
|
+
const group = markKitOrigin3(kit.group(), { owner: "game-weapons-three", kind: "ammunition", id: shape });
|
|
6057
6146
|
const cartridge = buildCartridge(kit, dims, shape);
|
|
6058
6147
|
cartridge.scale.setScalar(1e-3);
|
|
6059
6148
|
cartridge.rotation.z = -Math.PI / 2;
|
|
@@ -6662,8 +6751,169 @@ var hand_work_default = {
|
|
|
6662
6751
|
hand: "L",
|
|
6663
6752
|
anchor: "cylinder_side",
|
|
6664
6753
|
merge: 1
|
|
6754
|
+
},
|
|
6755
|
+
{
|
|
6756
|
+
family: "pistol",
|
|
6757
|
+
clips: [
|
|
6758
|
+
"safety_on",
|
|
6759
|
+
"safety_off"
|
|
6760
|
+
],
|
|
6761
|
+
hand: "R",
|
|
6762
|
+
anchor: "thumb_safety",
|
|
6763
|
+
whole: true,
|
|
6764
|
+
lead: 0.3,
|
|
6765
|
+
tail: 0.3
|
|
6766
|
+
},
|
|
6767
|
+
{
|
|
6768
|
+
family: "revolver",
|
|
6769
|
+
clips: [
|
|
6770
|
+
"safety_on",
|
|
6771
|
+
"safety_off"
|
|
6772
|
+
],
|
|
6773
|
+
hand: "R",
|
|
6774
|
+
anchor: "thumb_safety",
|
|
6775
|
+
whole: true,
|
|
6776
|
+
lead: 0.3,
|
|
6777
|
+
tail: 0.3
|
|
6778
|
+
},
|
|
6779
|
+
{
|
|
6780
|
+
family: "rifle",
|
|
6781
|
+
clips: [
|
|
6782
|
+
"safety_on",
|
|
6783
|
+
"safety_off"
|
|
6784
|
+
],
|
|
6785
|
+
hand: "R",
|
|
6786
|
+
anchor: "thumb_safety",
|
|
6787
|
+
whole: true,
|
|
6788
|
+
lead: 0.3,
|
|
6789
|
+
tail: 0.3,
|
|
6790
|
+
style: "ar"
|
|
6791
|
+
},
|
|
6792
|
+
{
|
|
6793
|
+
family: "p90",
|
|
6794
|
+
clips: [
|
|
6795
|
+
"safety_on",
|
|
6796
|
+
"safety_off"
|
|
6797
|
+
],
|
|
6798
|
+
hand: "R",
|
|
6799
|
+
anchor: "thumb_safety",
|
|
6800
|
+
whole: true,
|
|
6801
|
+
lead: 0.3,
|
|
6802
|
+
tail: 0.3
|
|
6803
|
+
},
|
|
6804
|
+
{
|
|
6805
|
+
family: "pump",
|
|
6806
|
+
clips: [
|
|
6807
|
+
"safety_on",
|
|
6808
|
+
"safety_off"
|
|
6809
|
+
],
|
|
6810
|
+
hand: "R",
|
|
6811
|
+
anchor: "thumb_safety",
|
|
6812
|
+
whole: true,
|
|
6813
|
+
lead: 0.3,
|
|
6814
|
+
tail: 0.3
|
|
6815
|
+
},
|
|
6816
|
+
{
|
|
6817
|
+
family: "semi12",
|
|
6818
|
+
clips: [
|
|
6819
|
+
"safety_on",
|
|
6820
|
+
"safety_off"
|
|
6821
|
+
],
|
|
6822
|
+
hand: "R",
|
|
6823
|
+
anchor: "thumb_safety",
|
|
6824
|
+
whole: true,
|
|
6825
|
+
lead: 0.3,
|
|
6826
|
+
tail: 0.3
|
|
6827
|
+
},
|
|
6828
|
+
{
|
|
6829
|
+
family: "semiint",
|
|
6830
|
+
clips: [
|
|
6831
|
+
"safety_on",
|
|
6832
|
+
"safety_off"
|
|
6833
|
+
],
|
|
6834
|
+
hand: "R",
|
|
6835
|
+
anchor: "thumb_safety",
|
|
6836
|
+
whole: true,
|
|
6837
|
+
lead: 0.3,
|
|
6838
|
+
tail: 0.3
|
|
6839
|
+
},
|
|
6840
|
+
{
|
|
6841
|
+
family: "break",
|
|
6842
|
+
clips: [
|
|
6843
|
+
"safety_on",
|
|
6844
|
+
"safety_off"
|
|
6845
|
+
],
|
|
6846
|
+
hand: "R",
|
|
6847
|
+
anchor: "thumb_safety",
|
|
6848
|
+
whole: true,
|
|
6849
|
+
lead: 0.3,
|
|
6850
|
+
tail: 0.3
|
|
6851
|
+
},
|
|
6852
|
+
{
|
|
6853
|
+
family: "bolt",
|
|
6854
|
+
clips: [
|
|
6855
|
+
"safety_on",
|
|
6856
|
+
"safety_off"
|
|
6857
|
+
],
|
|
6858
|
+
hand: "R",
|
|
6859
|
+
anchor: "thumb_safety",
|
|
6860
|
+
whole: true,
|
|
6861
|
+
lead: 0.3,
|
|
6862
|
+
tail: 0.3
|
|
6863
|
+
},
|
|
6864
|
+
{
|
|
6865
|
+
family: "boltmag",
|
|
6866
|
+
clips: [
|
|
6867
|
+
"safety_on",
|
|
6868
|
+
"safety_off"
|
|
6869
|
+
],
|
|
6870
|
+
hand: "R",
|
|
6871
|
+
anchor: "thumb_safety",
|
|
6872
|
+
whole: true,
|
|
6873
|
+
lead: 0.3,
|
|
6874
|
+
tail: 0.3
|
|
6875
|
+
},
|
|
6876
|
+
{
|
|
6877
|
+
family: "lever",
|
|
6878
|
+
clips: [
|
|
6879
|
+
"safety_on",
|
|
6880
|
+
"safety_off"
|
|
6881
|
+
],
|
|
6882
|
+
hand: "R",
|
|
6883
|
+
anchor: "thumb_safety",
|
|
6884
|
+
whole: true,
|
|
6885
|
+
lead: 0.3,
|
|
6886
|
+
tail: 0.3
|
|
6887
|
+
},
|
|
6888
|
+
{
|
|
6889
|
+
family: "belt",
|
|
6890
|
+
clips: [
|
|
6891
|
+
"safety_on",
|
|
6892
|
+
"safety_off"
|
|
6893
|
+
],
|
|
6894
|
+
hand: "R",
|
|
6895
|
+
anchor: "thumb_safety",
|
|
6896
|
+
whole: true,
|
|
6897
|
+
lead: 0.3,
|
|
6898
|
+
tail: 0.3
|
|
6899
|
+
},
|
|
6900
|
+
{
|
|
6901
|
+
family: "rifle",
|
|
6902
|
+
clips: [
|
|
6903
|
+
"safety_on",
|
|
6904
|
+
"safety_off"
|
|
6905
|
+
],
|
|
6906
|
+
hand: "L",
|
|
6907
|
+
anchor: "lever_right",
|
|
6908
|
+
style: "ak",
|
|
6909
|
+
whole: true,
|
|
6910
|
+
lead: 0.3,
|
|
6911
|
+
tail: 0.3
|
|
6665
6912
|
}
|
|
6666
|
-
]
|
|
6913
|
+
],
|
|
6914
|
+
safety: {
|
|
6915
|
+
comment: "Safety on and off (B): the shooting hand slides up its grip so the thumb flicks the lever while the clip cants the weapon; an AK-style rifle (akCharge) has its big lever on the right, pushed by the support hand over the top."
|
|
6916
|
+
}
|
|
6667
6917
|
};
|
|
6668
6918
|
|
|
6669
6919
|
// src/fx/hand-work.ts
|
|
@@ -6691,6 +6941,18 @@ var anchorsOf = (THREE, model, right) => {
|
|
|
6691
6941
|
if (!right || !parts.slide) return null;
|
|
6692
6942
|
return { part: right.part, offset: right.offset.clone().add(V2(THREE, 0, 0.012, 0)), quaternion: right.quaternion };
|
|
6693
6943
|
}
|
|
6944
|
+
if (kind === "thumb_safety") {
|
|
6945
|
+
if (!right) return null;
|
|
6946
|
+
const toward = parts.safety ? right.part.worldToLocal(parts.safety.getWorldPosition(V2(THREE, 0, 0, 0))).sub(right.offset) : V2(THREE, 0, HAND_HOLD.thumbReach, 0);
|
|
6947
|
+
return { part: right.part, offset: right.offset.clone().add(toward.clampLength(0, HAND_HOLD.thumbReach)), quaternion: right.quaternion };
|
|
6948
|
+
}
|
|
6949
|
+
if (kind === "lever_right") {
|
|
6950
|
+
const receiver = parts.bolt ?? parts.boltHandle;
|
|
6951
|
+
if (!receiver) return null;
|
|
6952
|
+
const b2 = boxIn(THREE, root, receiver);
|
|
6953
|
+
const x = parts.trigger ? root.worldToLocal(parts.trigger.getWorldPosition(V2(THREE, 0, 0, 0))).x : b2.min.x;
|
|
6954
|
+
return anchorAt(receiver, V2(THREE, x, b2.getCenter(V2(THREE, 0, 0, 0)).y, b2.max.z + palm), handFrame(THREE, V2(THREE, 1, 0, 0), V2(THREE, 0, 0, 1)));
|
|
6955
|
+
}
|
|
6694
6956
|
if (!part) return null;
|
|
6695
6957
|
const b = boxIn(THREE, root, part);
|
|
6696
6958
|
const c = b.getCenter(V2(THREE, 0, 0, 0));
|
|
@@ -7914,7 +8176,7 @@ function weaponThumbnailUrl(id, base = DEFAULT_THUMBNAIL_BASE) {
|
|
|
7914
8176
|
}
|
|
7915
8177
|
|
|
7916
8178
|
// src/world-explosives.ts
|
|
7917
|
-
import { buildItem } from "@adatechnology/game-items-three";
|
|
8179
|
+
import { buildItem as buildItem2 } from "@adatechnology/game-items-three";
|
|
7918
8180
|
var WORLD_EXPLOSIVE_PREFIX = "world_";
|
|
7919
8181
|
var P13_VALVE_MESH = "valve";
|
|
7920
8182
|
var P13_VALVE_COLOR = 12095802;
|
|
@@ -7955,7 +8217,7 @@ var meshOf = (THREE, shape) => {
|
|
|
7955
8217
|
};
|
|
7956
8218
|
var modelOf = (THREE, shape, wear = 0) => {
|
|
7957
8219
|
if (!shape.model) return void 0;
|
|
7958
|
-
const { root, kind } =
|
|
8220
|
+
const { root, kind } = buildItem2(THREE, shape.model, { wear });
|
|
7959
8221
|
if (kind !== "model") return void 0;
|
|
7960
8222
|
root.traverse((node) => {
|
|
7961
8223
|
const mesh = node;
|
|
@@ -8231,23 +8493,20 @@ var TEXT = {
|
|
|
8231
8493
|
};
|
|
8232
8494
|
var textOf = (locale) => TEXT[locale] ?? TEXT.en;
|
|
8233
8495
|
var fill = (template, vars) => template.replace(/\{(\w+)\}/g, (_, key) => String(vars[key] ?? ""));
|
|
8234
|
-
var
|
|
8235
|
-
|
|
8496
|
+
var COUNTER_FURNITURE = "buffet";
|
|
8497
|
+
var counterItem = (name) => {
|
|
8498
|
+
const counter = (THREE) => furnitureSpec(THREE, COUNTER_FURNITURE, { w: COUNTER.depth, d: COUNTER.length, h: COUNTER.height });
|
|
8236
8499
|
return {
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
joints: [
|
|
8245
|
-
{ a: "top", b: "side_a", kind: "screw" },
|
|
8246
|
-
{ a: "top", b: "side_b", kind: "screw" }
|
|
8247
|
-
],
|
|
8248
|
-
tags: ["furniture"]
|
|
8500
|
+
id: COUNTER_ITEM_ID,
|
|
8501
|
+
name,
|
|
8502
|
+
build: (THREE) => {
|
|
8503
|
+
const piece = counter(THREE);
|
|
8504
|
+
const root = piece.build(THREE);
|
|
8505
|
+
root.userData.counterSpec = { ...piece.spec, name, tags: [...piece.spec.tags ?? [], "furniture"] };
|
|
8506
|
+
return root;
|
|
8249
8507
|
},
|
|
8250
|
-
|
|
8508
|
+
spec: (root) => root.userData.counterSpec,
|
|
8509
|
+
movable: false
|
|
8251
8510
|
};
|
|
8252
8511
|
};
|
|
8253
8512
|
var targetProp = (id, name) => {
|
|
@@ -8270,7 +8529,7 @@ var targetProp = (id, name) => {
|
|
|
8270
8529
|
};
|
|
8271
8530
|
var weaponItem = (def, name) => {
|
|
8272
8531
|
const id = `${WEAPON_ITEM_PREFIX}${def.id}`;
|
|
8273
|
-
if (!hasWeaponModel(def.id)) return asItem(id, name, weaponProp(def, name), { weapon: def.id, movable: true });
|
|
8532
|
+
if (!hasWeaponModel(def.id) && !itemModelOfWeapon(def.id)) return asItem(id, name, weaponProp(def, name), { weapon: def.id, movable: true });
|
|
8274
8533
|
return {
|
|
8275
8534
|
id,
|
|
8276
8535
|
name,
|
|
@@ -8288,6 +8547,10 @@ var mountedM134Item = (def, name) => ({
|
|
|
8288
8547
|
weapon: def.id,
|
|
8289
8548
|
movable: false
|
|
8290
8549
|
});
|
|
8550
|
+
var targetItem = (id, name) => {
|
|
8551
|
+
const prop = targetProp(id, name);
|
|
8552
|
+
return { id, name, build: (THREE) => markKitOrigin4(buildProp(THREE, prop), { owner: "game-weapons-three", kind: "target", id }), spec: prop.spec, movable: false };
|
|
8553
|
+
};
|
|
8291
8554
|
var asItem = (id, name, prop, extra = {}) => ({
|
|
8292
8555
|
id,
|
|
8293
8556
|
name,
|
|
@@ -8359,8 +8622,8 @@ function createWeaponsTestModule(options = {}) {
|
|
|
8359
8622
|
},
|
|
8360
8623
|
items: () => [
|
|
8361
8624
|
...weaponDefs.map((def) => withThumbnail(weaponItem(def, arsenal.name(def.id)), def.id)),
|
|
8362
|
-
|
|
8363
|
-
...TARGETS.map((target) =>
|
|
8625
|
+
counterItem(text.counter),
|
|
8626
|
+
...TARGETS.map((target) => targetItem(target.id, text.targets[target.id] ?? target.id)),
|
|
8364
8627
|
...worldExplosives.map((item) => withThumbnail(item, item.id.slice(WORLD_EXPLOSIVE_PREFIX.length))),
|
|
8365
8628
|
...mountedM134.map((item) => withThumbnail(item, MOUNTED_M134.weaponId))
|
|
8366
8629
|
],
|
|
@@ -8489,6 +8752,9 @@ function createWeaponsTestModule(options = {}) {
|
|
|
8489
8752
|
import { EXPLOSIONS } from "@adatechnology/game-vfx";
|
|
8490
8753
|
import { createArsenal as createArsenal2 } from "@adatechnology/game-weapons";
|
|
8491
8754
|
|
|
8755
|
+
// src/explosives-bench.ts
|
|
8756
|
+
import { markKitOrigin as markKitOrigin5 } from "@adatechnology/game-contracts";
|
|
8757
|
+
|
|
8492
8758
|
// src/explosives-text.ts
|
|
8493
8759
|
var EXPLOSIVES_TEXT = {
|
|
8494
8760
|
en: {
|
|
@@ -8748,7 +9014,7 @@ function createExplosivesBench(options) {
|
|
|
8748
9014
|
return new (T()).LineLoop(geometry, new (T()).LineBasicMaterial({ color: colour }));
|
|
8749
9015
|
};
|
|
8750
9016
|
const drawRings = (vessel) => {
|
|
8751
|
-
const group = new (T()).Group();
|
|
9017
|
+
const group = markKitOrigin5(new (T()).Group(), { owner: "game-weapons-three", kind: "aid" });
|
|
8752
9018
|
group.name = "blast_rings";
|
|
8753
9019
|
const lethal = lethalOf(vessel);
|
|
8754
9020
|
const injury = injuryOf(vessel);
|
|
@@ -9476,6 +9742,7 @@ export {
|
|
|
9476
9742
|
applyCondition,
|
|
9477
9743
|
buildCartridge,
|
|
9478
9744
|
buildCasing,
|
|
9745
|
+
buildItemWeaponModel,
|
|
9479
9746
|
buildProp,
|
|
9480
9747
|
buildRound,
|
|
9481
9748
|
buildToolClips,
|
|
@@ -9492,11 +9759,13 @@ export {
|
|
|
9492
9759
|
explosivesTextOf,
|
|
9493
9760
|
fitAttachmentModels,
|
|
9494
9761
|
hasWeaponModel,
|
|
9762
|
+
itemModelOfWeapon,
|
|
9495
9763
|
mechanicalSoundOf,
|
|
9496
9764
|
modelKit,
|
|
9497
9765
|
mountFrame,
|
|
9498
9766
|
partRegistry,
|
|
9499
9767
|
projectileModel,
|
|
9768
|
+
registerWeaponItemModel,
|
|
9500
9769
|
rigStock,
|
|
9501
9770
|
rigUnderbarrel,
|
|
9502
9771
|
weaponProp,
|