@adatechnology/game-weapons 0.9.1 → 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/dist/index.d.ts +5 -0
- package/dist/index.global.js +20 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4014,13 +4014,18 @@ var explosives_default = [
|
|
|
4014
4014
|
tnt: 0.045,
|
|
4015
4015
|
destructionLevel: 2,
|
|
4016
4016
|
noise: 450,
|
|
4017
|
+
armRange: [
|
|
4018
|
+
14,
|
|
4019
|
+
27
|
|
4020
|
+
],
|
|
4017
4021
|
triggers: [
|
|
4018
4022
|
"impact"
|
|
4019
4023
|
],
|
|
4020
4024
|
sources: [
|
|
4021
4025
|
"arsenal",
|
|
4022
4026
|
"lab",
|
|
4023
|
-
"gallery"
|
|
4027
|
+
"gallery",
|
|
4028
|
+
"reference"
|
|
4024
4029
|
]
|
|
4025
4030
|
},
|
|
4026
4031
|
{
|
|
@@ -4239,11 +4244,16 @@ var explosives_default = [
|
|
|
4239
4244
|
tnt: 0.045,
|
|
4240
4245
|
destructionLevel: 2,
|
|
4241
4246
|
noise: 450,
|
|
4247
|
+
armRange: [
|
|
4248
|
+
10,
|
|
4249
|
+
40
|
|
4250
|
+
],
|
|
4242
4251
|
triggers: [
|
|
4243
4252
|
"impact"
|
|
4244
4253
|
],
|
|
4245
4254
|
sources: [
|
|
4246
4255
|
"lab",
|
|
4256
|
+
"reference",
|
|
4247
4257
|
"derived"
|
|
4248
4258
|
]
|
|
4249
4259
|
},
|
|
@@ -14169,6 +14179,7 @@ var checkExplosiveNumbers = (explosive) => {
|
|
|
14169
14179
|
const problems = [];
|
|
14170
14180
|
const [low, high] = explosive.fuseRange ?? [1, 1];
|
|
14171
14181
|
if (!(low > 0 && high >= low)) problems.push(`explosive "${explosive.id}" has a fuse range of ${low} to ${high} s`);
|
|
14182
|
+
if (explosive.armRange && !(explosive.armRange[0] > 0 && explosive.armRange[1] >= explosive.armRange[0])) problems.push(`explosive "${explosive.id}" arms between ${explosive.armRange[0]} and ${explosive.armRange[1]} m`);
|
|
14172
14183
|
if (explosive.fuseLength !== void 0 && !(explosive.fuseLength > 0)) problems.push(`explosive "${explosive.id}" has a fuse length of ${explosive.fuseLength} m`);
|
|
14173
14184
|
if (explosive.burnRate !== void 0 && !(explosive.burnRate > 0)) problems.push(`explosive "${explosive.id}" has a burn rate of ${explosive.burnRate} s/m`);
|
|
14174
14185
|
if (explosive.burnTolerance !== void 0 && !(explosive.burnTolerance >= 0 && explosive.burnTolerance < 1)) problems.push(`explosive "${explosive.id}" has a burn tolerance of ${explosive.burnTolerance}`);
|
|
@@ -14800,7 +14811,12 @@ var blastNumbers = (explosive) => ({
|
|
|
14800
14811
|
energy: explosive.energy,
|
|
14801
14812
|
injuryRadius: explosive.injuryRadius
|
|
14802
14813
|
});
|
|
14803
|
-
var
|
|
14814
|
+
var sampleArmDistance = (action, explosive, random) => {
|
|
14815
|
+
const range = explosive?.armRange;
|
|
14816
|
+
if (!range) return action.minArmDistance;
|
|
14817
|
+
return range[0] + (range[1] - range[0]) * random();
|
|
14818
|
+
};
|
|
14819
|
+
var launcherUses = ({ action, explosive, origin, direction, armDistance }) => {
|
|
14804
14820
|
const velocity = [direction[0] * action.speed, direction[1] * action.speed, direction[2] * action.speed];
|
|
14805
14821
|
const projectile = {
|
|
14806
14822
|
kind: "throw",
|
|
@@ -14811,7 +14827,7 @@ var launcherUses = (action, explosive, origin, direction) => {
|
|
|
14811
14827
|
origin,
|
|
14812
14828
|
explosive: action.projectile,
|
|
14813
14829
|
trigger: "impact",
|
|
14814
|
-
armDistance: action.minArmDistance,
|
|
14830
|
+
armDistance: armDistance ?? action.minArmDistance,
|
|
14815
14831
|
...explosive ? { injuryRadius: explosive.injuryRadius } : {}
|
|
14816
14832
|
};
|
|
14817
14833
|
if (action.backblast <= 0) return [projectile];
|
|
@@ -16027,7 +16043,7 @@ var WeaponRuntime = class extends WeaponFirearm {
|
|
|
16027
16043
|
this._ammo -= 1;
|
|
16028
16044
|
this._heat = Math.min(this.rules.heat.cap, this._heat + heatPerRound({ action: a, caliber: null, energy: 0, barrelMass: this.barrelMass, rules: this.rules.heat }));
|
|
16029
16045
|
this.emit({ type: "shot", shots: 0, rounds: 1, mode: this.mode, at: t });
|
|
16030
|
-
return result("ok", { uses: launcherUses(a, this.explosive, origin, dir), recoil: [a.recoil[0], a.recoil[1]], noise: a.noise ?? 0, rounds: 1, roundTimes: [t - start] });
|
|
16046
|
+
return result("ok", { uses: launcherUses({ action: a, explosive: this.explosive, origin, direction: dir, armDistance: sampleArmDistance(a, this.explosive, this.fuseRng) }), recoil: [a.recoil[0], a.recoil[1]], noise: a.noise ?? 0, rounds: 1, roundTimes: [t - start] });
|
|
16031
16047
|
}
|
|
16032
16048
|
fireMelee(a, origin, dir, start, end) {
|
|
16033
16049
|
const t0 = Math.max(start, this.readyAt);
|