@adatechnology/game-weapons 0.6.0 → 0.7.1

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
@@ -5520,7 +5520,10 @@ var firearms_default = [
5520
5520
  ]
5521
5521
  }
5522
5522
  ],
5523
- fitted: []
5523
+ fitted: [],
5524
+ tags: [
5525
+ "pdw"
5526
+ ]
5524
5527
  },
5525
5528
  {
5526
5529
  id: "kriss_vector",
@@ -9979,7 +9982,9 @@ var firearms_default = [
9979
9982
  "arsenal",
9980
9983
  "reference",
9981
9984
  "derived"
9982
- ]
9985
+ ],
9986
+ mounts: [],
9987
+ fitted: []
9983
9988
  },
9984
9989
  {
9985
9990
  id: "hk_mp5sd3",
@@ -10738,7 +10743,10 @@ var firearms_default = [
10738
10743
  fitted: [],
10739
10744
  stock: {
10740
10745
  kind: "retract"
10741
- }
10746
+ },
10747
+ tags: [
10748
+ "pdw"
10749
+ ]
10742
10750
  },
10743
10751
  {
10744
10752
  id: "hk_g36",
@@ -12450,7 +12458,8 @@ var categoriesEn = {
12450
12458
  dmr: "marksman rifle",
12451
12459
  hunting: "hunting rifle",
12452
12460
  machine_gun: "machine gun",
12453
- launcher: "launcher"
12461
+ launcher: "launcher",
12462
+ pdw: "PDW (personal defence weapon)"
12454
12463
  };
12455
12464
  var faultsEn = { misfire: "misfire", stovepipe: "stovepipe", double_feed: "double feed", failure_to_extract: "failure to extract" };
12456
12465
  var conditionsEn = { new: "new", used: "used", worn: "worn", rusty: "rusty" };
@@ -12503,7 +12512,27 @@ var locales = {
12503
12512
  hunting_rifle_30_06: ".30-06 hunting rifle",
12504
12513
  m2_flamethrower: "M2 flamethrower",
12505
12514
  improvised_flamethrower: "Improvised flamethrower",
12506
- 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"
12507
12536
  },
12508
12537
  modes: modesEn,
12509
12538
  categories: categoriesEn,
@@ -12577,7 +12606,27 @@ var locales = {
12577
12606
  hunting_rifle_30_06: "Rifle de ca\xE7a .30-06",
12578
12607
  m2_flamethrower: "Lan\xE7a-chamas M2",
12579
12608
  improvised_flamethrower: "Lan\xE7a-chamas caseiro",
12580
- 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"
12581
12630
  },
12582
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" },
12583
12632
  categories: {
@@ -12601,7 +12650,8 @@ var locales = {
12601
12650
  dmr: "fuzil de precis\xE3o semiautom\xE1tico",
12602
12651
  hunting: "arma de ca\xE7a",
12603
12652
  machine_gun: "metralhadora",
12604
- launcher: "lan\xE7ador"
12653
+ launcher: "lan\xE7ador",
12654
+ pdw: "PDW (arma de defesa pessoal)"
12605
12655
  },
12606
12656
  explosives: {
12607
12657
  m67: "Granada M67",
@@ -12701,7 +12751,13 @@ var DEFAULT_RULES = {
12701
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)
12702
12752
  attachments: { fitSeconds: { field: 2, tool: 15, bench: 30 }, switchSeconds: 0.8, speedOfSound: 343 },
12703
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)
12704
- 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
+ },
12705
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)
12706
12762
  stock: {
12707
12763
  seconds: 0.6,
@@ -14411,6 +14467,79 @@ function muzzleSmokeOf({ caliber, weapon, suppressed }) {
14411
14467
  const id = caliber?.propellant === "black_powder" ? "black_powder" : caliber?.propellant === "none" ? "none" : "smokeless";
14412
14468
  return MUZZLE_SMOKE[id];
14413
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
+ }
14414
14543
  export {
14415
14544
  AMMO,
14416
14545
  ARCHETYPE_IDS,
@@ -14424,6 +14553,8 @@ export {
14424
14553
  MUZZLE_SMOKE,
14425
14554
  RELOAD_STAGES,
14426
14555
  WEAPONS,
14556
+ WEAPON_MENU_GROUPS,
14557
+ aimZoomOf,
14427
14558
  ammoId,
14428
14559
  ammoIgnition,
14429
14560
  backblastEffect,
@@ -14434,14 +14565,17 @@ export {
14434
14565
  createArsenal,
14435
14566
  createExplosiveBody,
14436
14567
  createRng,
14568
+ genericWeapons,
14437
14569
  locales,
14438
14570
  muzzleEnergy,
14439
14571
  muzzleSmokeOf,
14440
14572
  nominalFuse,
14573
+ realLoadout,
14441
14574
  resolveLoad,
14442
14575
  resolveLoadout,
14443
14576
  resolveStrings,
14444
14577
  sampleFuse,
14445
- tripwireSegment
14578
+ tripwireSegment,
14579
+ weaponMenu
14446
14580
  };
14447
14581
  //# sourceMappingURL=index.js.map