@adatechnology/game-weapons 0.12.2 → 0.13.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/README.md +7 -0
- package/dist/index.d.ts +27 -1
- package/dist/index.global.js +30 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +30 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -271,6 +271,13 @@ optic that is fitted over `aimSeconds`), and only when the click lands on the ro
|
|
|
271
271
|
a throwable) leaves the button to the room, which grabs with it. The bench's **Supported** switch (`supported_stance`) puts the weapon in the supported stance (deployed or prone), so the bipod effect can be exercised;
|
|
272
272
|
it goes back off when another tool is taken. The laser measures its distance at most 30 times a second and ignores hidden nodes (a hidden ancestor counts) and the weapon in the hands.
|
|
273
273
|
|
|
274
|
+
### The hands a weapon takes and where it goes
|
|
275
|
+
|
|
276
|
+
`rules.hands` says how many hands each weapon takes and where on the body it goes when the hands are wanted for something else: `twoHanded` (by category: the SMGs, rifles, carbines,
|
|
277
|
+
shotguns, launchers, bows, the extinguisher; by id: the flamethrower; or a `two_handed` tag) unless it goes one in each hand (`dualWield`), `slots` by category (`hip`: a holster for the
|
|
278
|
+
handguns, knives, tools and throwables; `back`: a sling for the long guns), `weaponSlots` by id over it, and `bare` (the kick, the shove, the fists: nothing in the hand).
|
|
279
|
+
`weaponHandsOf(arsenal, id)` answers `{ hands: 0 | 1 | 2, slot }`; `planHands` of `@adatechnology/game-player` turns it into what happens to the weapon (decision of the owner, 2026-11-24).
|
|
280
|
+
|
|
274
281
|
### A weapon in each hand
|
|
275
282
|
|
|
276
283
|
`rules.dualWield` says which weapons go one in each hand and what that costs: `categories` (`pistol`, `revolver`), `weapons` (the Mini Uzi, Uzi, MAC-10, vz. 61, MP7, the knives, the
|
package/dist/index.d.ts
CHANGED
|
@@ -516,6 +516,21 @@ interface WeaponRules {
|
|
|
516
516
|
*/
|
|
517
517
|
readonly stowSeconds: number;
|
|
518
518
|
};
|
|
519
|
+
/**
|
|
520
|
+
* The hands a weapon takes and where it goes when the hands are wanted for something else (`weaponHandsOf`). A weapon is two-handed by its category (`twoHanded.categories`), its
|
|
521
|
+
* id (`twoHanded.weapons`) or a `two_handed` tag, unless it goes one in each hand (`dualWield`). `slots` names, by category, the place on the body that takes it (`hip` a holster,
|
|
522
|
+
* `back` a sling or back slot), and `weaponSlots` by id over it (null: none); a weapon left out of both has none, and goes to the ground when the hands are needed. The ids in
|
|
523
|
+
* `bare` are the body itself (a kick, a shove, the fists): nothing in the hand, nothing to put away.
|
|
524
|
+
*/
|
|
525
|
+
readonly hands: {
|
|
526
|
+
readonly twoHanded: {
|
|
527
|
+
readonly categories: readonly WeaponCategory[];
|
|
528
|
+
readonly weapons: readonly WeaponId[];
|
|
529
|
+
};
|
|
530
|
+
readonly slots: Readonly<Partial<Record<WeaponCategory, string>>>;
|
|
531
|
+
readonly weaponSlots: Readonly<Record<WeaponId, string | null>>;
|
|
532
|
+
readonly bare: readonly WeaponId[];
|
|
533
|
+
};
|
|
519
534
|
/** Folding or sliding in the stock: the seconds it takes and what it does to the weapon while it is in. */
|
|
520
535
|
readonly stock: {
|
|
521
536
|
readonly seconds: number;
|
|
@@ -1393,6 +1408,17 @@ declare function aimZoomOf(arsenal: Arsenal, weaponId: WeaponId, attachments?: r
|
|
|
1393
1408
|
*/
|
|
1394
1409
|
declare function canDualWield(arsenal: Pick<Arsenal, 'weapons' | 'rules'>, weaponId: WeaponId): boolean;
|
|
1395
1410
|
|
|
1411
|
+
/**
|
|
1412
|
+
* The hands a weapon takes (`0` the bare hand, nothing to put away; `1` one hand, the other is free; `2` both) and the place on the body that takes it when the hands are wanted
|
|
1413
|
+
* for something else (`rules.hands.slots`: `hip`, `back`...), or null when it has none and has to go to the ground.
|
|
1414
|
+
*/
|
|
1415
|
+
interface WeaponHands {
|
|
1416
|
+
readonly hands: 0 | 1 | 2;
|
|
1417
|
+
readonly slot: string | null;
|
|
1418
|
+
}
|
|
1419
|
+
/** What `rules.hands` of the arsenal says of a weapon; an unknown id is the bare hand. */
|
|
1420
|
+
declare function weaponHandsOf(arsenal: Pick<Arsenal, 'weapons' | 'rules'>, weaponId: WeaponId): WeaponHands;
|
|
1421
|
+
|
|
1396
1422
|
/** One group of the weapon menu as a game declares it: the categories it lists, in order, each a section of its own. */
|
|
1397
1423
|
interface WeaponMenuGroupDef {
|
|
1398
1424
|
readonly id: string;
|
|
@@ -1444,4 +1470,4 @@ declare function genericWeapons(arsenal: Arsenal): ReadonlyMap<WeaponId, WeaponI
|
|
|
1444
1470
|
/** A loadout with each generic gun swapped for the real weapon that stands for it (dropped when none does), and no id twice. */
|
|
1445
1471
|
declare function realLoadout(arsenal: Arsenal, loadout: readonly WeaponId[]): WeaponId[];
|
|
1446
1472
|
|
|
1447
|
-
export { AMMO, ARCHETYPE_IDS, ATTACHMENTS, type AmmoCore, type AmmoDef, type AmmoJacket, type AmmoKind, type AmmoLoad, type AmmoPenetration, type AmmoQualityDef, type Arsenal, type ArsenalOptions, type AttachmentDef, type AttachmentId, type AttachmentInstall, type AttachmentKind, type BlastEffect, CALIBERS, type CaliberDef, type CaliberId, type CanFit, type CanFitContext, type CartridgeDims, type CaseType, type ConditionDef, DEFAULT_LOADOUT, DEFAULT_RULES, type DataSource, type Detonation, EXPLOSIVES, type EffectCondition, ExplosiveBody, type ExplosiveBodyInit, type ExplosiveChain, type ExplosiveDef, type ExplosiveEvent, type ExplosiveId, type ExplosiveLeak, type ExplosiveShell, type ExplosiveSmoke, type ExplosiveTrigger, type ExplosiveTripwire, type FaultContext, type FaultId, type FireMode, type FirearmAction, type FitOptions, type FitRefusal, type FitResult, type FittedAttachment, GALLERY_HEAT, type GroundHeight, type GroundSweepHit, type GroundSweepOptions, type IsCompatible, type Loadout, type LoadoutContext, MUZZLE_SMOKE, type MountDef, type MountKind, type MuzzleSmokeParams, type MuzzleSmokeProfile, type MuzzleSmokeProfileId, RELOAD_STAGES, type ReloadFamily, type ReloadKind, type ReloadRequest, type ReloadStage, type ReloadStageId, type RimType, type RoundsToWarningParams, type StatModifier, type StockDef, type StockState, type SurfaceProbe, type TriggerResult, type TripwireSegment, WEAPONS, WEAPON_MENU_GROUPS, type WeaponAction, type WeaponCategory, type WeaponDef, type WeaponDimensions, type WeaponEvent, type WeaponId, type WeaponMenuEntry, type WeaponMenuGroup, type WeaponMenuGroupDef, type WeaponMenuOptions, type WeaponMenuSection, type WeaponPatch, type WeaponPhase, type WeaponRules, type WeaponSnapshot, type WeaponStance, type WeaponStat, type WeaponState, type WeaponTimings, type WeaponsLocale, type WeaponsStrings, aimZoomOf, ammoId, ammoIgnition, backblastEffect, barrelMassOf, blastEffect, canDualWield, canFit, canInstallWith, checkArsenal, coolingTimeConstant, createArsenal, createExplosiveBody, createRng, decayHeat, genericWeapons, locales, muzzleEnergy, muzzleSmokeOf, nominalFuse, realLoadout, resolveLoad, resolveLoadout, resolveStrings, roundsToWarning, roundsToWarningOf, sampleFuse, sweepGround, tripwireSegment, weaponMenu };
|
|
1473
|
+
export { AMMO, ARCHETYPE_IDS, ATTACHMENTS, type AmmoCore, type AmmoDef, type AmmoJacket, type AmmoKind, type AmmoLoad, type AmmoPenetration, type AmmoQualityDef, type Arsenal, type ArsenalOptions, type AttachmentDef, type AttachmentId, type AttachmentInstall, type AttachmentKind, type BlastEffect, CALIBERS, type CaliberDef, type CaliberId, type CanFit, type CanFitContext, type CartridgeDims, type CaseType, type ConditionDef, DEFAULT_LOADOUT, DEFAULT_RULES, type DataSource, type Detonation, EXPLOSIVES, type EffectCondition, ExplosiveBody, type ExplosiveBodyInit, type ExplosiveChain, type ExplosiveDef, type ExplosiveEvent, type ExplosiveId, type ExplosiveLeak, type ExplosiveShell, type ExplosiveSmoke, type ExplosiveTrigger, type ExplosiveTripwire, type FaultContext, type FaultId, type FireMode, type FirearmAction, type FitOptions, type FitRefusal, type FitResult, type FittedAttachment, GALLERY_HEAT, type GroundHeight, type GroundSweepHit, type GroundSweepOptions, type IsCompatible, type Loadout, type LoadoutContext, MUZZLE_SMOKE, type MountDef, type MountKind, type MuzzleSmokeParams, type MuzzleSmokeProfile, type MuzzleSmokeProfileId, RELOAD_STAGES, type ReloadFamily, type ReloadKind, type ReloadRequest, type ReloadStage, type ReloadStageId, type RimType, type RoundsToWarningParams, type StatModifier, type StockDef, type StockState, type SurfaceProbe, type TriggerResult, type TripwireSegment, WEAPONS, WEAPON_MENU_GROUPS, type WeaponAction, type WeaponCategory, type WeaponDef, type WeaponDimensions, type WeaponEvent, type WeaponHands, type WeaponId, type WeaponMenuEntry, type WeaponMenuGroup, type WeaponMenuGroupDef, type WeaponMenuOptions, type WeaponMenuSection, type WeaponPatch, type WeaponPhase, type WeaponRules, type WeaponSnapshot, type WeaponStance, type WeaponStat, type WeaponState, type WeaponTimings, type WeaponsLocale, type WeaponsStrings, aimZoomOf, ammoId, ammoIgnition, backblastEffect, barrelMassOf, blastEffect, canDualWield, canFit, canInstallWith, checkArsenal, coolingTimeConstant, createArsenal, createExplosiveBody, createRng, decayHeat, genericWeapons, locales, muzzleEnergy, muzzleSmokeOf, nominalFuse, realLoadout, resolveLoad, resolveLoadout, resolveStrings, roundsToWarning, roundsToWarningOf, sampleFuse, sweepGround, tripwireSegment, weaponHandsOf, weaponMenu };
|
package/dist/index.global.js
CHANGED
|
@@ -65,6 +65,7 @@ var GameWeapons = (() => {
|
|
|
65
65
|
sampleFuse: () => sampleFuse,
|
|
66
66
|
sweepGround: () => sweepGround,
|
|
67
67
|
tripwireSegment: () => tripwireSegment,
|
|
68
|
+
weaponHandsOf: () => weaponHandsOf,
|
|
68
69
|
weaponMenu: () => weaponMenu
|
|
69
70
|
});
|
|
70
71
|
|
|
@@ -2946,7 +2947,8 @@ var GameWeapons = (() => {
|
|
|
2946
2947
|
},
|
|
2947
2948
|
mass: 5.5,
|
|
2948
2949
|
tags: [
|
|
2949
|
-
"heavy"
|
|
2950
|
+
"heavy",
|
|
2951
|
+
"two_handed"
|
|
2950
2952
|
]
|
|
2951
2953
|
},
|
|
2952
2954
|
{
|
|
@@ -3030,7 +3032,10 @@ var GameWeapons = (() => {
|
|
|
3030
3032
|
rpm: 45,
|
|
3031
3033
|
noise: 8
|
|
3032
3034
|
},
|
|
3033
|
-
mass: 1.6
|
|
3035
|
+
mass: 1.6,
|
|
3036
|
+
tags: [
|
|
3037
|
+
"two_handed"
|
|
3038
|
+
]
|
|
3034
3039
|
},
|
|
3035
3040
|
{
|
|
3036
3041
|
id: "knife",
|
|
@@ -14230,7 +14235,8 @@ var GameWeapons = (() => {
|
|
|
14230
14235
|
},
|
|
14231
14236
|
mass: 2.8,
|
|
14232
14237
|
tags: [
|
|
14233
|
-
"heavy"
|
|
14238
|
+
"heavy",
|
|
14239
|
+
"two_handed"
|
|
14234
14240
|
]
|
|
14235
14241
|
},
|
|
14236
14242
|
{
|
|
@@ -14308,7 +14314,8 @@ var GameWeapons = (() => {
|
|
|
14308
14314
|
},
|
|
14309
14315
|
mass: 6,
|
|
14310
14316
|
tags: [
|
|
14311
|
-
"heavy"
|
|
14317
|
+
"heavy",
|
|
14318
|
+
"two_handed"
|
|
14312
14319
|
]
|
|
14313
14320
|
},
|
|
14314
14321
|
{
|
|
@@ -14879,6 +14886,14 @@ var GameWeapons = (() => {
|
|
|
14879
14886
|
// tucking a pistol in the belt and drawing it back is a short motion of one hand
|
|
14880
14887
|
stowSeconds: 0.45
|
|
14881
14888
|
},
|
|
14889
|
+
// 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
|
|
14890
|
+
hands: {
|
|
14891
|
+
twoHanded: { categories: ["smg", "rifle", "carbine", "sniper", "dmr", "hunting", "machine_gun", "launcher", "shotgun", "bow", "crossbow", "extinguisher"], weapons: ["flamethrower"] },
|
|
14892
|
+
slots: { pistol: "hip", revolver: "hip", melee_blade: "hip", melee_blunt: "hip", tool: "hip", throwable: "hip", heat: "hip", smg: "back", rifle: "back", carbine: "back", sniper: "back", dmr: "back", hunting: "back", shotgun: "back", bow: "back", crossbow: "back", machine_gun: "back", launcher: "back" },
|
|
14893
|
+
// the long-handled tools and the long blade hang across the back; a chainsaw has no place on the body
|
|
14894
|
+
weaponSlots: { lighter: "hip", flamethrower: "back", axe: "back", sledgehammer: "back", pickaxe: "back", shovel: "back", katana: "back", chainsaw: null },
|
|
14895
|
+
bare: ["kick", "shove", "fists"]
|
|
14896
|
+
},
|
|
14882
14897
|
// 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)
|
|
14883
14898
|
stock: {
|
|
14884
14899
|
seconds: 0.6,
|
|
@@ -16722,6 +16737,17 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
16722
16737
|
return rule.weapons.includes(weaponId) || rule.categories.includes(category);
|
|
16723
16738
|
};
|
|
16724
16739
|
|
|
16740
|
+
// src/weapon-hands.ts
|
|
16741
|
+
var BARE = { hands: 0, slot: null };
|
|
16742
|
+
function weaponHandsOf(arsenal, weaponId) {
|
|
16743
|
+
const def = arsenal.weapons.get(weaponId);
|
|
16744
|
+
const rule = arsenal.rules.hands;
|
|
16745
|
+
if (!def || def.category === "hand" || rule.bare.includes(weaponId)) return BARE;
|
|
16746
|
+
const isTwoHanded = (rule.twoHanded.categories.includes(def.category) || rule.twoHanded.weapons.includes(weaponId) || (def.tags ?? []).includes("two_handed")) && !canDualWield(arsenal, weaponId);
|
|
16747
|
+
const slot = weaponId in rule.weaponSlots ? rule.weaponSlots[weaponId] : rule.slots[def.category];
|
|
16748
|
+
return { hands: isTwoHanded ? 2 : 1, slot: slot ?? null };
|
|
16749
|
+
}
|
|
16750
|
+
|
|
16725
16751
|
// src/generics.ts
|
|
16726
16752
|
var isGenericKind = (kind, category) => kind === "firearm" && category !== "bow" && category !== "crossbow" || kind === "flame";
|
|
16727
16753
|
function genericWeapons(arsenal) {
|