Content Tool Tutorial ‐ Modifiers - FlansMods/FlansModReloaded GitHub Wiki

Guns have damage, spread, recoil and so on. Attachments modify those stats. How?

Modifier Layers

Modifiers are calculated in a series of layers. Each layer is summed (or multiplied) together, and then the results of each layer are applied to the base stat.
"Layer" 0: Unmodded - The value on the gun (or other modifiable Definition)
Layer 1: "BaseAdd" - A simple additive bonus, in the same units as the stat
Layer 2: "StackablePercentage" - The simpler percent boost, these add up before being applied, so +10%, -3% and +15% will multiply your stat by 1.22x
Layer 3: "IndependentPercentage" - Each of these is multiplied separately, after other multipliers. So 120%, 50% and 110% would be 1.2 x 0.5 x 1.1 = 0.66x
Layer 4: "FinalAdd" - The final addition layer, in case you want your bonus to not be affected by any multipliers.

Some examples

Our weapon has "impact_damage" = 10, "vertical_recoil = 0"
SoloSilencer has impact_damage: +10 FinalAdd
ComboSilencer has impact_damage: +10 BaseAdd
BoomGrip has impact_damage: +4 BaseAdd and +50% StackablePercentage, and vertical_recoil: +200% StackablePercentage
PerfectRecoilStock has vertical_recoil: 0% IndependentPercentage and +2 FinalAdd

Attaching just BoomGrip, it gives;
impact_damage = (10 + 4) x (100 + 50)% = 14 x 1.5 = 21
vertical_recoil = (0) x (100 + 200)% = 0 x 3 = 0

Attaching SoloSilencer and BoomGrip, it gives;
impact_damage = (10 + 4) x (100 + 50)% + 10 = 14 x 1.5 + 10 = 31

Attaching ComboSilencer and BoomGrip, it gives;
impact_damage = (10 + 4 + 10) x (100 + 50)% = 24 x 1.5 = 36

Attaching PerfectRecoilStock, by multiplying by 0%, eliminates most contributions, leaving only the FinalAdd component;
By itself, it means that the vertical_recoil is always 2, but attaching two of these for example would make it always 4.
vertical_recoil = (0 + Any Base Adds) x (Any Indep. %) x 0% + 2 = 2