Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions addons/recoil/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ PREP_RECOMPILE_END;

GVAR(recoilCache) = createHashMap;

// This is too niche to be a setting, but making it not just hardcoded is good
GVAR(extraLauncherShake) = 25.0;


ADDON = true;
12 changes: 11 additions & 1 deletion addons/recoil/functions/fnc_camshake.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ private _recoil = GVAR(recoilCache) getOrDefaultCall [_weapon + _muzzle, {
getText (_config >> _muzzle >> "recoil")
};

private _customShakeCoef = if (isNumber (configFile >> "CfgRecoils" >> _recoil >> QGVAR(customShakeCoef))) then {
getNumber (configFile >> "CfgRecoils" >> _recoil >> QGVAR(customShakeCoef))
} else {
1
};

if (isClass (configFile >> "CfgRecoils" >> _recoil)) then {
_recoil = getArray (configFile >> "CfgRecoils" >> _recoil >> "kickBack");

Expand All @@ -48,6 +54,10 @@ private _recoil = GVAR(recoilCache) getOrDefaultCall [_weapon + _muzzle, {
_recoil = [0, 0];
};



_recoil = _recoil vectorMultiply _customShakeCoef;

TRACE_3("Caching Recoil config",_weapon,_muzzle,_recoil);

// Ensure format is correct
Expand All @@ -62,7 +72,7 @@ private _powerCoef = RECOIL_COEF * linearConversion [0, 1, random 1, _recoil sel
if (isWeaponRested _unit) then {_powerMod = _powerMod - 0.07};
if (isWeaponDeployed _unit) then {_powerMod = _powerMod - 0.11};
if (_weapon isEqualTo secondaryWeapon _unit) then {
_powerCoef = _powerCoef + 25.0;
_powerCoef = _powerCoef + GVAR(extraLauncherShake);
};

private _camshake = [
Expand Down
Loading