weapons

Weapon definitions and the shot's spread, range and recoil (since API 3).

weapons.get(id) returns a weapon's definition (Weapon): power, precision, pellets, loudness, rate, ammunition, magazine, aim. Writes act at once (ammo and magazine: at the next hunt, resupply or reload) and are undone when your mod unloads. The hunter's own slots, with their ammunition, are player.slot(n) / player.weapons() (WeaponSlot). The data guide has the whole picture.

Functions

# weapons.get(id) → Weapon

since API 3

A weapon definition.

ParameterType
idstring|integera weapon id ("rifle") or type
Returns
Weapon
local rifle = weapons.get("rifle")
rifle.power = rifle.power * 2

# weapons.list() → table

since API 3

Every weapon of the content registry.

Returns
tableWeapon list

# weapons.spreadScale(k?) → number

since API 3

A factor on every shot's spread (0 = dead accurate). Kept until your mod unloads.

ParameterType
k optionalnumber0-100 (nil = 1)
Returns
number

# weapons.rangeScale(k?) → number

since API 3

A factor on the shot's range (76 cells).

ParameterType
k optionalnumber0.01-10
Returns
number

# weapons.recoilScale(k?) → number

since API 3

A factor on the camera kick of each shot.

ParameterType
k optionalnumber0-100
Returns
number