Skip to content
Dinorush edited this page Feb 26, 2024 · 12 revisions

ExtraRecoilData adds 2 main features: Recoil Scaling and Recoil Patterns. These are added via custom jsons located under [GameDataPath]/Custom/ExtraRecoilData/. Each file contain lists of custom recoil datablocks, each of which includes ArchetypeID, the archetype datablock it is tied to, Name, purely for readability, and any of the fields for Recoil Scaling and Recoil Patterns.

Note: Custom files can be edited without restarting the game (uses live edit). However, to apply changes, you must change the weapon in the slot and then back (similar to hot reloading datablock changes).

Recoil Scaling

System that allows recoil to grow (or diminish) with every shot. Every shot accumulates 1 growth, which is used to determines the current recoil scale.

  • RecoilScaleCap: Float - Default 1. The amount of total growth required to reach the maximum recoil modifier, RecoilScaleMax.
  • RecoilScaleThreshold: Float - Default 0. The amount of total growth required to begin scaling from RecoilScaleMin to RecoilScaleMax.
  • RecoilScaleDecay: Float - Default 1. The amount of growth removed per second when not firing.
  • RecoilScaleDecayDelay: Float - Default 0.016. The length of time in seconds before growth begins decaying.
    • Delay is relative to when the gun can be fired, not from when the last shot was fired. This does not include charge up delay.
  • RecoilScaleMin: Float - Default 1. The minimum random recoil modifier, reached when growth is at or below RecoilScaleThreshold.
  • RecoilScaleMax: Float - Default 1. The maximum random recoil modifier, reached when growth is at RecoilScaleCap.
  • RecoilPatternScaleMin: Float - Default 1. Identical to RecoilScaleMin, but applies to recoil pattern power instead of random recoil.
  • RecoilPatternScaleMax: Float - Default 1. Identical to RecoilScaleMax, but applies to recoil pattern power instead of random recoil.
    • The recoil modifiers scale linearly between Min and Max values.

Recoil Pattern

System that allows defining pre-determined recoil patterns.

  • RecoilPattern: List<Float> - Default []. The direction of the recoil, with each element representing each sequential shot's recoil direction. Loops back to the start of the pattern once the end is reached.
    • Accepts either 2D coordinates bounded by [-1, 1] or polar coordinates.
      • If any value does not lie in the range [-1, 1], it is interpreted as polar coordinates. Otherwise, it is interpreted as 2D coordinates.
      • 2D coordinates: Each pair of numbers is interpreted as (x, y) where positive values are right for x and up for y. Values are normalized to a magnitude of 1. (0, 0) is interpreted as up.
      • Polar coordinates: Each number is interpreted as a separate angle in degrees. At least one value must not be in the range [-1, 1]. A value of 0 is up, with positive values going clockwise.
    • An empty list defaults to up.
  • RecoilPatternFirst: List<Float> - Default []. A recoil pattern used prior to RecoilPattern that does not loop once finished.
    • Uses the same coordinate interpretation as RecoilPattern.
    • Skipped if the list is empty.
    • Can use a different coordinate type than RecoilPattern.
  • RecoilPatternAlign: Enum - Default ALIGN. Determines how the base game random recoil is adjusted by the recoil pattern.
    • Accepted values: ALIGN, ABSOLUTE
    • ALIGN: Random recoil is rotated to the recoil pattern direction.
    • ABSOLUTE: Random recoil is unaffected.
  • RecoilPatternPower: MinMax - Default {"Min": 0, "Max": 0}. Random power of additional recoil in the direction of the recoil pattern.
  • RecoilPatternResetDelay: Float - Default 0.016. The length of time in seconds before the recoil patterns reset to their initial states.
    • Delay is relative to when the gun can be fired, not from when the last shot was fired. This does not include charge up delay.

Template

{
  "ArchetypeID": 19,
  "Name": "Machine Pistol"

  "RecoilScaleCap": 10,
  "RecoilScaleThreshold": 5,
  "RecoilScaleDecay": 20.0,    // It takes 0.5s time + 0.2s delay + 0.05s shot delay = 0.75s for the scale to fully reset
  "RecoilScaleDecayDelay": 0.2,
  "RecoilScaleMin": 0.8,       // Recoil is lower for the first 5 shots
  "RecoilScaleMax": 2.5,       // Recoil increases significantly after 5 shots, capping out after 10 shots (5 more after threshold)
  "RecoilPatternScaleMin": 1,  // The recoil pattern power never changes
  "RecoilPatternScaleMax": 1,

  "RecoilPatternFirst": [      // Goes up, left-up, right-up, left-down, right-down
    0, 1, 
    -1, 1, 
    1, 1,
    -1, -1, 
    1, -1
  ],
  "RecoilPattern": [           // After RecoilPatternFirst, fires in a circle, starting up and turning clockwise
    0, 45, 90, 135, 180,
    225, 270, 315
  ],
  "RecoilPatternAlign": "ABSOLUTE", // The normal random recoil of machine pistol is unaffected by the pattern
  "RecoilPatternPower": {
    "Min": 0.5,
    "Max": 0.75
  },
  "RecoilPatternResetDelay": 0.3
}
Clone this wiki locally