Helper functions
The script includes built-in helper functions for developers:Getting perk values
Access perk values programmatically:Perk values are pre-computed at startup, so lookups are cheap and safe to call during gameplay.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Weapon controller helper functions and programmatic access to perk values
-- Linear interpolation helper
local function lerp(a, b, t)
return a + (b - a) * t
end
-- Get interpolation factor based on curve type
local function getInterpT(curve, level)
local minL, maxL = curve.minLevel, curve.maxLevel
local range = maxL - minL
local t = (range > 0) and ((level - minL) / range) or 0
if curve.interpolation == "linear" then
return t
elseif curve.interpolation == "exponential" then
return math.pow(t, curve.expPower or 1)
elseif curve.interpolation == "custom" then
return nil -- custom values handled separately
else
return t -- fallback to linear
end
end
-- Get perk values for a specific level
local perkValues = Config.GetPerk(playerLevel)
local accuracy = perkValues.minAccuracy
local recoil = perkValues.maxScopeRecoil