@adatechnology/game-weapons 0.13.6 → 0.15.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.js CHANGED
@@ -16634,6 +16634,109 @@ function weaponMenu(arsenal, options = {}) {
16634
16634
  return sections.length ? [{ id: group.id, name: nameIn(group, locale), sections }] : [];
16635
16635
  });
16636
16636
  }
16637
+
16638
+ // src/data/melee-families.json
16639
+ var melee_families_default = {
16640
+ families: [
16641
+ {
16642
+ id: "short_blade",
16643
+ note: "a knife held in one hand, edge forward: a diagonal cut from the right shoulder and a straight thrust, one after the other (spec 015 R3, 'golpe curto (faca)')",
16644
+ weapons: [
16645
+ "knife",
16646
+ "tactical_knife",
16647
+ "kabar",
16648
+ "meat_cleaver"
16649
+ ],
16650
+ blows: [
16651
+ {
16652
+ clip: "knife_slash",
16653
+ motion: "slash",
16654
+ seconds: 0.46
16655
+ },
16656
+ {
16657
+ clip: "knife_stab",
16658
+ motion: "stab",
16659
+ seconds: 0.42
16660
+ }
16661
+ ],
16662
+ reset: 1.2
16663
+ },
16664
+ {
16665
+ id: "one_hand_swing",
16666
+ note: "a short heavy tool or blade in one hand (machete, hatchet, hammer, baton, skillet): chopped down from over the right shoulder, the body turning into it as in the knife's cut",
16667
+ weapons: [
16668
+ "machete",
16669
+ "hatchet",
16670
+ "sickle",
16671
+ "hammer",
16672
+ "police_baton",
16673
+ "cast_iron_skillet"
16674
+ ],
16675
+ blows: [
16676
+ {
16677
+ clip: "knife_slash",
16678
+ motion: "chop",
16679
+ seconds: 0.46
16680
+ }
16681
+ ],
16682
+ reset: 1.2
16683
+ },
16684
+ {
16685
+ id: "bat_swing",
16686
+ note: "a club in both hands (bat, pipe, crowbar, sledgehammer): drawn back behind the right shoulder, swung level through the chest with the hips and shoulders turning, and carried round over the left shoulder (follow-through)",
16687
+ weapons: [
16688
+ "baseball_bat",
16689
+ "nail_bat",
16690
+ "iron_pipe",
16691
+ "crowbar",
16692
+ "sledgehammer"
16693
+ ],
16694
+ blows: [
16695
+ {
16696
+ clip: "bat_swing",
16697
+ motion: "bat_swing",
16698
+ seconds: 0.7
16699
+ }
16700
+ ],
16701
+ reset: 1.2
16702
+ },
16703
+ {
16704
+ id: "two_hand_swing",
16705
+ note: "a long weapon in both hands with its weight at the head or an edge (axe, pickaxe, katana): swung flat and low from the right shoulder across the body, the hips leading, as the shovel's swing",
16706
+ weapons: [
16707
+ "axe",
16708
+ "pickaxe",
16709
+ "katana"
16710
+ ],
16711
+ blows: [
16712
+ {
16713
+ clip: "shovel_swing",
16714
+ motion: "swing",
16715
+ seconds: 0.6
16716
+ }
16717
+ ],
16718
+ reset: 1.2
16719
+ }
16720
+ ]
16721
+ };
16722
+
16723
+ // src/melee-families.ts
16724
+ var MELEE_FAMILIES = melee_families_default.families;
16725
+ var meleeFamilyOf = (weaponId, families = MELEE_FAMILIES) => families.find((family) => family.weapons.includes(weaponId));
16726
+ var meleeStrikeClips = (families = MELEE_FAMILIES) => Object.fromEntries(families.flatMap((family) => family.blows[0] ? family.weapons.map((weapon) => [weapon, family.blows[0].clip]) : []));
16727
+ var createMeleeBlowCycle = (families = MELEE_FAMILIES) => {
16728
+ const last = /* @__PURE__ */ new Map();
16729
+ return {
16730
+ next(weaponId, now) {
16731
+ const family = meleeFamilyOf(weaponId, families);
16732
+ if (!family || family.blows.length === 0) return void 0;
16733
+ const previous = last.get(family.id);
16734
+ const index = previous && now - previous.at <= family.reset ? (previous.index + 1) % family.blows.length : 0;
16735
+ last.set(family.id, { index, at: now });
16736
+ return family.blows[index];
16737
+ }
16738
+ };
16739
+ };
16637
16740
  export {
16638
16741
  AMMO,
16639
16742
  ARCHETYPE_IDS,
@@ -16644,6 +16747,7 @@ export {
16644
16747
  EXPLOSIVES,
16645
16748
  ExplosiveBody,
16646
16749
  GALLERY_HEAT,
16750
+ MELEE_FAMILIES,
16647
16751
  MUZZLE_SMOKE,
16648
16752
  RELOAD_STAGES,
16649
16753
  SLING_SWING_DEFAULTS,
@@ -16662,11 +16766,14 @@ export {
16662
16766
  coolingTimeConstant,
16663
16767
  createArsenal,
16664
16768
  createExplosiveBody,
16769
+ createMeleeBlowCycle,
16665
16770
  createRng,
16666
16771
  createSlingSwing,
16667
16772
  decayHeat,
16668
16773
  genericWeapons,
16669
16774
  locales,
16775
+ meleeFamilyOf,
16776
+ meleeStrikeClips,
16670
16777
  muzzleEnergy,
16671
16778
  muzzleSmokeOf,
16672
16779
  nominalFuse,