@adatechnology/game-weapons 0.13.5 → 0.14.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,95 @@ 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: "two_hand_swing",
16686
+ note: "a long weapon in both hands (bat, pipe, crowbar, axe, sledgehammer, katana): swung flat from the right shoulder across the body, the hips leading, as the shovel's swing",
16687
+ weapons: [
16688
+ "baseball_bat",
16689
+ "nail_bat",
16690
+ "iron_pipe",
16691
+ "crowbar",
16692
+ "axe",
16693
+ "sledgehammer",
16694
+ "pickaxe",
16695
+ "katana"
16696
+ ],
16697
+ blows: [
16698
+ {
16699
+ clip: "shovel_swing",
16700
+ motion: "swing",
16701
+ seconds: 0.6
16702
+ }
16703
+ ],
16704
+ reset: 1.2
16705
+ }
16706
+ ]
16707
+ };
16708
+
16709
+ // src/melee-families.ts
16710
+ var MELEE_FAMILIES = melee_families_default.families;
16711
+ var meleeFamilyOf = (weaponId, families = MELEE_FAMILIES) => families.find((family) => family.weapons.includes(weaponId));
16712
+ var meleeStrikeClips = (families = MELEE_FAMILIES) => Object.fromEntries(families.flatMap((family) => family.blows[0] ? family.weapons.map((weapon) => [weapon, family.blows[0].clip]) : []));
16713
+ var createMeleeBlowCycle = (families = MELEE_FAMILIES) => {
16714
+ const last = /* @__PURE__ */ new Map();
16715
+ return {
16716
+ next(weaponId, now) {
16717
+ const family = meleeFamilyOf(weaponId, families);
16718
+ if (!family || family.blows.length === 0) return void 0;
16719
+ const previous = last.get(family.id);
16720
+ const index = previous && now - previous.at <= family.reset ? (previous.index + 1) % family.blows.length : 0;
16721
+ last.set(family.id, { index, at: now });
16722
+ return family.blows[index];
16723
+ }
16724
+ };
16725
+ };
16637
16726
  export {
16638
16727
  AMMO,
16639
16728
  ARCHETYPE_IDS,
@@ -16644,6 +16733,7 @@ export {
16644
16733
  EXPLOSIVES,
16645
16734
  ExplosiveBody,
16646
16735
  GALLERY_HEAT,
16736
+ MELEE_FAMILIES,
16647
16737
  MUZZLE_SMOKE,
16648
16738
  RELOAD_STAGES,
16649
16739
  SLING_SWING_DEFAULTS,
@@ -16662,11 +16752,14 @@ export {
16662
16752
  coolingTimeConstant,
16663
16753
  createArsenal,
16664
16754
  createExplosiveBody,
16755
+ createMeleeBlowCycle,
16665
16756
  createRng,
16666
16757
  createSlingSwing,
16667
16758
  decayHeat,
16668
16759
  genericWeapons,
16669
16760
  locales,
16761
+ meleeFamilyOf,
16762
+ meleeStrikeClips,
16670
16763
  muzzleEnergy,
16671
16764
  muzzleSmokeOf,
16672
16765
  nominalFuse,