@adatechnology/game-weapons 0.13.2 → 0.13.4
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 +1 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.global.js +44 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +44 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -14669,10 +14669,10 @@ var DEFAULT_RULES = {
|
|
|
14669
14669
|
// tucking a pistol in the belt and drawing it back is a short motion of one hand
|
|
14670
14670
|
stowSeconds: 0.45
|
|
14671
14671
|
},
|
|
14672
|
-
// as mãos de cada arma e onde ela vai quando as mãos são pedidas (decisão do dono, 2026-11-24): arma longa pede as duas mãos; a de cinto vai no coldre, a longa na bandoleira ou nas costas
|
|
14672
|
+
// as mãos de cada arma e onde ela vai quando as mãos são pedidas (decisão do dono, 2026-11-24): arma longa pede as duas mãos; a de cinto vai no coldre, a longa na bandoleira ou nas costas; o fuzil e a espingarda pendem da bandoleira (dono, 2026-11-25): sem bandoleira vão para as costas (SLOT_FALLBACKS do game-player)
|
|
14673
14673
|
hands: {
|
|
14674
14674
|
twoHanded: { categories: ["smg", "rifle", "carbine", "sniper", "dmr", "hunting", "machine_gun", "launcher", "shotgun", "bow", "crossbow", "extinguisher"], weapons: ["flamethrower"] },
|
|
14675
|
-
slots: { pistol: "hip", revolver: "hip", melee_blade: "hip", melee_blunt: "hip", tool: "hip", throwable: "hip", heat: "hip", smg: "
|
|
14675
|
+
slots: { pistol: "hip", revolver: "hip", melee_blade: "hip", melee_blunt: "hip", tool: "hip", throwable: "hip", heat: "hip", smg: "sling", rifle: "sling", carbine: "sling", sniper: "sling", dmr: "sling", hunting: "sling", shotgun: "sling", bow: "back", crossbow: "back", machine_gun: "back", launcher: "back" },
|
|
14676
14676
|
// the long-handled tools and the long blade hang across the back; a chainsaw has no place on the body
|
|
14677
14677
|
weaponSlots: { lighter: "hip", flamethrower: "back", axe: "back", sledgehammer: "back", pickaxe: "back", shovel: "back", katana: "back", chainsaw: null },
|
|
14678
14678
|
bare: ["kick", "shove", "fists"]
|
|
@@ -16531,6 +16531,46 @@ function weaponHandsOf(arsenal, weaponId) {
|
|
|
16531
16531
|
return { hands: isTwoHanded ? 2 : 1, slot: slot ?? null };
|
|
16532
16532
|
}
|
|
16533
16533
|
|
|
16534
|
+
// src/sling-swing.ts
|
|
16535
|
+
var SLING_SWING_DEFAULTS = { length: 0.34, damping: 2.6, limits: { forward: 0.9, side: 0.75 }, restitution: 0.25, maxStep: 1 / 240, gravity: 9.81 };
|
|
16536
|
+
function createSlingSwing(rules = SLING_SWING_DEFAULTS) {
|
|
16537
|
+
let forward = 0;
|
|
16538
|
+
let side = 0;
|
|
16539
|
+
let forwardSpeed = 0;
|
|
16540
|
+
let sideSpeed = 0;
|
|
16541
|
+
const bounce2 = (angle, speed, min, max) => {
|
|
16542
|
+
if (angle < min) return [min, speed < 0 ? -speed * rules.restitution : speed];
|
|
16543
|
+
if (angle > max) return [max, speed > 0 ? -speed * rules.restitution : speed];
|
|
16544
|
+
return [angle, speed];
|
|
16545
|
+
};
|
|
16546
|
+
const substep = (h, acceleration) => {
|
|
16547
|
+
const gravity = Math.max(0.5, rules.gravity + acceleration[1]);
|
|
16548
|
+
const forwardAccel = (-gravity * Math.sin(forward) - acceleration[2] * Math.cos(forward)) / rules.length - rules.damping * forwardSpeed;
|
|
16549
|
+
const sideAccel = (-gravity * Math.sin(side) - acceleration[0] * Math.cos(side)) / rules.length - rules.damping * sideSpeed;
|
|
16550
|
+
forwardSpeed += forwardAccel * h;
|
|
16551
|
+
sideSpeed += sideAccel * h;
|
|
16552
|
+
[forward, forwardSpeed] = bounce2(forward + forwardSpeed * h, forwardSpeed, 0, rules.limits.forward);
|
|
16553
|
+
[side, sideSpeed] = bounce2(side + sideSpeed * h, sideSpeed, -rules.limits.side, rules.limits.side);
|
|
16554
|
+
};
|
|
16555
|
+
return {
|
|
16556
|
+
step(dt, acceleration) {
|
|
16557
|
+
let left = Math.max(0, Math.min(dt, 0.25));
|
|
16558
|
+
while (left > 1e-9) {
|
|
16559
|
+
const h = Math.min(rules.maxStep, left);
|
|
16560
|
+
substep(h, acceleration);
|
|
16561
|
+
left -= h;
|
|
16562
|
+
}
|
|
16563
|
+
return { forward, side };
|
|
16564
|
+
},
|
|
16565
|
+
get state() {
|
|
16566
|
+
return { forward, side };
|
|
16567
|
+
},
|
|
16568
|
+
reset() {
|
|
16569
|
+
forward = side = forwardSpeed = sideSpeed = 0;
|
|
16570
|
+
}
|
|
16571
|
+
};
|
|
16572
|
+
}
|
|
16573
|
+
|
|
16534
16574
|
// src/generics.ts
|
|
16535
16575
|
var isGenericKind = (kind, category) => kind === "firearm" && category !== "bow" && category !== "crossbow" || kind === "flame";
|
|
16536
16576
|
function genericWeapons(arsenal) {
|
|
@@ -16606,6 +16646,7 @@ export {
|
|
|
16606
16646
|
GALLERY_HEAT,
|
|
16607
16647
|
MUZZLE_SMOKE,
|
|
16608
16648
|
RELOAD_STAGES,
|
|
16649
|
+
SLING_SWING_DEFAULTS,
|
|
16609
16650
|
WEAPONS,
|
|
16610
16651
|
WEAPON_MENU_GROUPS,
|
|
16611
16652
|
aimZoomOf,
|
|
@@ -16622,6 +16663,7 @@ export {
|
|
|
16622
16663
|
createArsenal,
|
|
16623
16664
|
createExplosiveBody,
|
|
16624
16665
|
createRng,
|
|
16666
|
+
createSlingSwing,
|
|
16625
16667
|
decayHeat,
|
|
16626
16668
|
genericWeapons,
|
|
16627
16669
|
locales,
|