@adatechnology/game-weapons 0.5.9 → 0.7.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
@@ -3682,6 +3682,7 @@ var explosives_default = [
3682
3682
  lethalRadius: 5,
3683
3683
  injuryRadius: 15,
3684
3684
  energy: 2e5,
3685
+ tnt: 0.24,
3685
3686
  destructionLevel: 2,
3686
3687
  noise: 500,
3687
3688
  fuse: 4,
@@ -3727,6 +3728,7 @@ var explosives_default = [
3727
3728
  lethalRadius: 3,
3728
3729
  injuryRadius: 10,
3729
3730
  energy: 43200,
3731
+ tnt: 0.15,
3730
3732
  destructionLevel: 2,
3731
3733
  noise: 450,
3732
3734
  fuse: 3,
@@ -3746,6 +3748,7 @@ var explosives_default = [
3746
3748
  lethalRadius: 5,
3747
3749
  injuryRadius: 14,
3748
3750
  energy: 2e5,
3751
+ tnt: 1.5,
3749
3752
  destructionLevel: 2,
3750
3753
  noise: 550,
3751
3754
  fire: {
@@ -3792,6 +3795,7 @@ var explosives_default = [
3792
3795
  lethalRadius: 4,
3793
3796
  injuryRadius: 12,
3794
3797
  energy: 102400,
3798
+ tnt: 0.25,
3795
3799
  destructionLevel: 3,
3796
3800
  noise: 600,
3797
3801
  fuseLength: 0.03,
@@ -3814,6 +3818,7 @@ var explosives_default = [
3814
3818
  lethalRadius: 6,
3815
3819
  injuryRadius: 18,
3816
3820
  energy: 345600,
3821
+ tnt: 0.76,
3817
3822
  destructionLevel: 3,
3818
3823
  noise: 700,
3819
3824
  triggers: [
@@ -3837,6 +3842,7 @@ var explosives_default = [
3837
3842
  length: 50
3838
3843
  },
3839
3844
  energy: 102400,
3845
+ tnt: 0.9,
3840
3846
  destructionLevel: 1,
3841
3847
  noise: 500,
3842
3848
  triggers: [
@@ -3860,6 +3866,7 @@ var explosives_default = [
3860
3866
  lethalRadius: 0,
3861
3867
  injuryRadius: 10,
3862
3868
  energy: 0,
3869
+ tnt: 0.01,
3863
3870
  destructionLevel: 0,
3864
3871
  noise: 400,
3865
3872
  fuseRange: [
@@ -3884,6 +3891,7 @@ var explosives_default = [
3884
3891
  lethalRadius: 4,
3885
3892
  injuryRadius: 12,
3886
3893
  energy: 102400,
3894
+ tnt: 0.045,
3887
3895
  destructionLevel: 2,
3888
3896
  noise: 450,
3889
3897
  triggers: [
@@ -3902,6 +3910,7 @@ var explosives_default = [
3902
3910
  lethalRadius: 5,
3903
3911
  injuryRadius: 15,
3904
3912
  energy: 2e5,
3913
+ tnt: 0.45,
3905
3914
  destructionLevel: 3,
3906
3915
  noise: 700,
3907
3916
  triggers: [
@@ -3920,6 +3929,7 @@ var explosives_default = [
3920
3929
  lethalRadius: 5,
3921
3930
  injuryRadius: 16,
3922
3931
  energy: 2e5,
3932
+ tnt: 0.7,
3923
3933
  destructionLevel: 3,
3924
3934
  noise: 750,
3925
3935
  triggers: [
@@ -3938,6 +3948,7 @@ var explosives_default = [
3938
3948
  lethalRadius: 5,
3939
3949
  injuryRadius: 16,
3940
3950
  energy: 2e5,
3951
+ tnt: 0.45,
3941
3952
  destructionLevel: 3,
3942
3953
  noise: 750,
3943
3954
  triggers: [
@@ -3956,6 +3967,7 @@ var explosives_default = [
3956
3967
  lethalRadius: 5,
3957
3968
  injuryRadius: 16,
3958
3969
  energy: 2e5,
3970
+ tnt: 0.7,
3959
3971
  destructionLevel: 3,
3960
3972
  noise: 750,
3961
3973
  triggers: [
@@ -3974,6 +3986,7 @@ var explosives_default = [
3974
3986
  lethalRadius: 4,
3975
3987
  injuryRadius: 12,
3976
3988
  energy: 102400,
3989
+ tnt: 1,
3977
3990
  destructionLevel: 2,
3978
3991
  noise: 550,
3979
3992
  fire: {
@@ -4007,6 +4020,7 @@ var explosives_default = [
4007
4020
  lethalRadius: 5,
4008
4021
  injuryRadius: 14,
4009
4022
  energy: 2e5,
4023
+ tnt: 0.5,
4010
4024
  destructionLevel: 2,
4011
4025
  noise: 550,
4012
4026
  fire: {
@@ -4044,6 +4058,7 @@ var explosives_default = [
4044
4058
  lethalRadius: 4,
4045
4059
  injuryRadius: 12,
4046
4060
  energy: 102400,
4061
+ tnt: 0.5,
4047
4062
  destructionLevel: 3,
4048
4063
  noise: 700,
4049
4064
  fire: {
@@ -4073,6 +4088,7 @@ var explosives_default = [
4073
4088
  lethalRadius: 12,
4074
4089
  injuryRadius: 30,
4075
4090
  energy: 2764800,
4091
+ tnt: 20,
4076
4092
  destructionLevel: 3,
4077
4093
  noise: 700,
4078
4094
  fire: {
@@ -4100,6 +4116,7 @@ var explosives_default = [
4100
4116
  lethalRadius: 4,
4101
4117
  injuryRadius: 12,
4102
4118
  energy: 102400,
4119
+ tnt: 0.045,
4103
4120
  destructionLevel: 2,
4104
4121
  noise: 450,
4105
4122
  triggers: [
@@ -5503,7 +5520,10 @@ var firearms_default = [
5503
5520
  ]
5504
5521
  }
5505
5522
  ],
5506
- fitted: []
5523
+ fitted: [],
5524
+ tags: [
5525
+ "pdw"
5526
+ ]
5507
5527
  },
5508
5528
  {
5509
5529
  id: "kriss_vector",
@@ -9962,7 +9982,9 @@ var firearms_default = [
9962
9982
  "arsenal",
9963
9983
  "reference",
9964
9984
  "derived"
9965
- ]
9985
+ ],
9986
+ mounts: [],
9987
+ fitted: []
9966
9988
  },
9967
9989
  {
9968
9990
  id: "hk_mp5sd3",
@@ -10721,7 +10743,10 @@ var firearms_default = [
10721
10743
  fitted: [],
10722
10744
  stock: {
10723
10745
  kind: "retract"
10724
- }
10746
+ },
10747
+ tags: [
10748
+ "pdw"
10749
+ ]
10725
10750
  },
10726
10751
  {
10727
10752
  id: "hk_g36",
@@ -12433,7 +12458,8 @@ var categoriesEn = {
12433
12458
  dmr: "marksman rifle",
12434
12459
  hunting: "hunting rifle",
12435
12460
  machine_gun: "machine gun",
12436
- launcher: "launcher"
12461
+ launcher: "launcher",
12462
+ pdw: "PDW (personal defence weapon)"
12437
12463
  };
12438
12464
  var faultsEn = { misfire: "misfire", stovepipe: "stovepipe", double_feed: "double feed", failure_to_extract: "failure to extract" };
12439
12465
  var conditionsEn = { new: "new", used: "used", worn: "worn", rusty: "rusty" };
@@ -12486,7 +12512,27 @@ var locales = {
12486
12512
  hunting_rifle_30_06: ".30-06 hunting rifle",
12487
12513
  m2_flamethrower: "M2 flamethrower",
12488
12514
  improvised_flamethrower: "Improvised flamethrower",
12489
- m79: "M79 grenade launcher"
12515
+ m79: "M79 grenade launcher",
12516
+ m203: "M203 grenade launcher",
12517
+ gp_25: "GP-25 grenade launcher",
12518
+ ag36: "AG36 grenade launcher",
12519
+ flashbang: "Flashbang",
12520
+ dynamite: "Dynamite",
12521
+ c4: "C4 charge",
12522
+ claymore: "Claymore mine",
12523
+ tactical_knife: "Tactical knife",
12524
+ meat_cleaver: "Meat cleaver",
12525
+ hatchet: "Hatchet",
12526
+ nail_bat: "Nail bat",
12527
+ iron_pipe: "Iron pipe",
12528
+ pickaxe: "Pickaxe",
12529
+ sickle: "Sickle",
12530
+ police_baton: "Police baton",
12531
+ cast_iron_skillet: "Cast iron skillet",
12532
+ improvised_spear: "Improvised spear",
12533
+ chainsaw: "Chainsaw",
12534
+ recurve_bow: "Recurve bow",
12535
+ m134: "M134 Minigun"
12490
12536
  },
12491
12537
  modes: modesEn,
12492
12538
  categories: categoriesEn,
@@ -12560,7 +12606,27 @@ var locales = {
12560
12606
  hunting_rifle_30_06: "Rifle de ca\xE7a .30-06",
12561
12607
  m2_flamethrower: "Lan\xE7a-chamas M2",
12562
12608
  improvised_flamethrower: "Lan\xE7a-chamas caseiro",
12563
- m79: "Lan\xE7a-granadas M79"
12609
+ m79: "Lan\xE7a-granadas M79",
12610
+ m203: "Lan\xE7a-granadas M203",
12611
+ gp_25: "Lan\xE7a-granadas GP-25",
12612
+ ag36: "Lan\xE7a-granadas AG36",
12613
+ flashbang: "granada de luz",
12614
+ dynamite: "dinamite",
12615
+ c4: "C4 com detonador",
12616
+ claymore: "mina Claymore",
12617
+ tactical_knife: "faca t\xE1tica",
12618
+ meat_cleaver: "cutelo",
12619
+ hatchet: "machadinha",
12620
+ nail_bat: "taco com pregos",
12621
+ iron_pipe: "cano de ferro",
12622
+ pickaxe: "picareta",
12623
+ sickle: "foice",
12624
+ police_baton: "cassetete",
12625
+ cast_iron_skillet: "frigideira de ferro",
12626
+ improvised_spear: "lan\xE7a improvisada",
12627
+ chainsaw: "motosserra",
12628
+ recurve_bow: "arco recurvo",
12629
+ m134: "Minigun M134"
12564
12630
  },
12565
12631
  modes: { single: "tiro \xFAnico", semi: "semiautom\xE1tico", burst: "rajada", auto: "autom\xE1tico", pump: "repeti\xE7\xE3o", bolt: "ferrolho", lever: "alavanca", break: "basculante", volley: "salva" },
12566
12632
  categories: {
@@ -12584,7 +12650,8 @@ var locales = {
12584
12650
  dmr: "fuzil de precis\xE3o semiautom\xE1tico",
12585
12651
  hunting: "arma de ca\xE7a",
12586
12652
  machine_gun: "metralhadora",
12587
- launcher: "lan\xE7ador"
12653
+ launcher: "lan\xE7ador",
12654
+ pdw: "PDW (arma de defesa pessoal)"
12588
12655
  },
12589
12656
  explosives: {
12590
12657
  m67: "Granada M67",
@@ -12684,7 +12751,13 @@ var DEFAULT_RULES = {
12684
12751
  // Arsenal §11: montar e desmontar exige chave de fenda ou bancada; 2/15/30 s e a troca do lança-granadas (0,8 s) são padrões aprovados pelo dono (2026-10-24)
12685
12752
  attachments: { fitSeconds: { field: 2, tool: 15, bench: 30 }, switchSeconds: 0.8, speedOfSound: 343 },
12686
12753
  // Arsenal §08: tempo de mira = 0,15 s + 0,05 s por kg. O quadril do Arsenal é ×6 (o ZombiAdA liga isso por configuração); o SDK é neutro (1)
12687
- aim: { base: 0.15, perKg: 0.05, hipSpread: 1 },
12754
+ aim: {
12755
+ base: 0.15,
12756
+ perKg: 0.05,
12757
+ hipSpread: 1,
12758
+ // the iron sights close the view in a little: more for a long gun, whose sights sit farther from the eye, than for a handgun
12759
+ ironSightZoom: { pistol: 1.1, revolver: 1.1, smg: 1.2, carbine: 1.25, shotgun: 1.15, rifle: 1.3, hunting: 1.35, dmr: 1.4, sniper: 1.4, machine_gun: 1.2, launcher: 1.15, bow: 1.15, crossbow: 1.25 }
12760
+ },
12688
12761
  // Arsenal §08/§11: coronha retrátil saca mais rápido, mais recuo; os números são padrões aprovados pelo dono (2026-10-24)
12689
12762
  stock: {
12690
12763
  seconds: 0.6,
@@ -12844,6 +12917,7 @@ var ExplosiveBody = class {
12844
12917
  direction: this.facing,
12845
12918
  at,
12846
12919
  energy: def.energy,
12920
+ ...def.tnt !== void 0 ? { tnt: def.tnt } : {},
12847
12921
  lethalRadius: def.lethalRadius,
12848
12922
  injuryRadius: def.injuryRadius,
12849
12923
  noise: def.noise,
@@ -14393,6 +14467,79 @@ function muzzleSmokeOf({ caliber, weapon, suppressed }) {
14393
14467
  const id = caliber?.propellant === "black_powder" ? "black_powder" : caliber?.propellant === "none" ? "none" : "smokeless";
14394
14468
  return MUZZLE_SMOKE[id];
14395
14469
  }
14470
+
14471
+ // src/aim-zoom.ts
14472
+ function aimZoomOf(arsenal, weaponId, attachments = arsenal.weapons.get(weaponId)?.fitted?.map((part) => part.id) ?? []) {
14473
+ const def = arsenal.weapons.get(weaponId);
14474
+ if (!def) return 1;
14475
+ const optic = attachments.map((id) => arsenal.attachments.get(id)?.optic).find((entry) => entry !== void 0);
14476
+ if (optic) return optic.zoom[0];
14477
+ return arsenal.rules.aim.ironSightZoom[def.category] ?? 1;
14478
+ }
14479
+
14480
+ // src/generics.ts
14481
+ var isGenericKind = (kind, category) => kind === "firearm" && category !== "bow" && category !== "crossbow" || kind === "flame";
14482
+ function genericWeapons(arsenal) {
14483
+ const archetypes = new Set(ARCHETYPE_IDS);
14484
+ const generics = /* @__PURE__ */ new Map();
14485
+ for (const def of arsenal.weapons.values()) if (archetypes.has(def.id) && isGenericKind(def.action.kind, def.category) && !def.maker) generics.set(def.id, void 0);
14486
+ for (const def of [...arsenal.weapons.values()].sort((a, b) => a.id < b.id ? -1 : 1)) {
14487
+ const { archetype } = def;
14488
+ if (!archetype || archetypes.has(def.id) || !generics.has(archetype) || generics.get(archetype)) continue;
14489
+ if (arsenal.weapons.get(archetype)?.action.kind === def.action.kind) generics.set(archetype, def.id);
14490
+ }
14491
+ for (const [id, brand] of generics) if (!brand && arsenal.weapons.get(id)?.action.kind === "flame") generics.delete(id);
14492
+ return generics;
14493
+ }
14494
+ function realLoadout(arsenal, loadout) {
14495
+ const generics = genericWeapons(arsenal);
14496
+ const real = loadout.flatMap((id) => generics.has(id) ? [generics.get(id)].filter((brand) => brand !== void 0) : [id]);
14497
+ return [...new Set(real)];
14498
+ }
14499
+
14500
+ // src/menu.ts
14501
+ var WEAPON_MENU_GROUPS = [
14502
+ {
14503
+ id: "firearms",
14504
+ name: { en: "Firearms", "pt-BR": "Armas de fogo" },
14505
+ categories: ["pistol", "revolver", "smg", "pdw", "carbine", "rifle", "dmr", "hunting", "sniper", "shotgun", "machine_gun", "bow", "crossbow"]
14506
+ },
14507
+ { id: "melee", name: { en: "Melee weapons", "pt-BR": "Armas brancas" }, categories: ["melee_blade", "melee_blunt", "hand"] },
14508
+ { id: "explosives", name: { en: "Explosives", "pt-BR": "Explosivos" }, categories: ["throwable", "launcher"] },
14509
+ { id: "tools", name: { en: "Tools", "pt-BR": "Ferramentas" }, categories: ["tool", "heat", "flame", "extinguisher"] }
14510
+ ];
14511
+ var OTHER_GROUP = { id: "other", name: { en: "Other", "pt-BR": "Outros" }, categories: [] };
14512
+ var sectionOf = (def) => {
14513
+ if (def.category === "launcher" && def.action.kind === "flame") return "flame";
14514
+ return def.tags?.includes("pdw") ? "pdw" : def.category;
14515
+ };
14516
+ var nameIn = (def, locale) => def.name[locale] ?? def.name.en ?? def.id;
14517
+ var capitalize = (text) => text.charAt(0).toLocaleUpperCase() + text.slice(1);
14518
+ function weaponMenu(arsenal, options = {}) {
14519
+ const locale = options.locale ?? "en";
14520
+ const groups = options.groups ?? WEAPON_MENU_GROUPS;
14521
+ const bySection = /* @__PURE__ */ new Map();
14522
+ const generics = options.generics ? /* @__PURE__ */ new Map() : genericWeapons(arsenal);
14523
+ for (const def of arsenal.weapons.values()) {
14524
+ if (options.exclude?.(def) || generics.has(def.id)) continue;
14525
+ const category = sectionOf(def);
14526
+ const list = bySection.get(category) ?? [];
14527
+ list.push({ id: def.id, name: capitalize(arsenal.name(def.id)), category, ...def.maker ? { maker: def.maker } : {}, ...def.tags?.length ? { tags: def.tags } : {} });
14528
+ bySection.set(category, list);
14529
+ }
14530
+ const listed = new Set(groups.flatMap((group) => group.categories));
14531
+ const other = { ...OTHER_GROUP, categories: [...bySection.keys()].filter((category) => !listed.has(category)) };
14532
+ const sectionsOf = (group) => group.categories.flatMap((category) => {
14533
+ const weapons = bySection.get(category);
14534
+ if (!weapons?.length) return [];
14535
+ const sorted = [...weapons].sort((a, b) => a.name.localeCompare(b.name, locale));
14536
+ return [{ id: category, name: capitalize(arsenal.name(category)), weapons: sorted }];
14537
+ });
14538
+ return [...groups, other].flatMap((group) => {
14539
+ const sections = sectionsOf(group);
14540
+ return sections.length ? [{ id: group.id, name: nameIn(group, locale), sections }] : [];
14541
+ });
14542
+ }
14396
14543
  export {
14397
14544
  AMMO,
14398
14545
  ARCHETYPE_IDS,
@@ -14406,6 +14553,8 @@ export {
14406
14553
  MUZZLE_SMOKE,
14407
14554
  RELOAD_STAGES,
14408
14555
  WEAPONS,
14556
+ WEAPON_MENU_GROUPS,
14557
+ aimZoomOf,
14409
14558
  ammoId,
14410
14559
  ammoIgnition,
14411
14560
  backblastEffect,
@@ -14416,14 +14565,17 @@ export {
14416
14565
  createArsenal,
14417
14566
  createExplosiveBody,
14418
14567
  createRng,
14568
+ genericWeapons,
14419
14569
  locales,
14420
14570
  muzzleEnergy,
14421
14571
  muzzleSmokeOf,
14422
14572
  nominalFuse,
14573
+ realLoadout,
14423
14574
  resolveLoad,
14424
14575
  resolveLoadout,
14425
14576
  resolveStrings,
14426
14577
  sampleFuse,
14427
- tripwireSegment
14578
+ tripwireSegment,
14579
+ weaponMenu
14428
14580
  };
14429
14581
  //# sourceMappingURL=index.js.map