Skip to content

Instantly share code, notes, and snippets.

@Heyoxe
Created February 16, 2020 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Heyoxe/ebd6ceba3193013674c21835bc5b0e30 to your computer and use it in GitHub Desktop.
Save Heyoxe/ebd6ceba3193013674c21835bc5b0e30 to your computer and use it in GitHub Desktop.
Arma 3 - No-Recoil Detector
player addEventHandler ["FiredMan", {
_this spawn {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
if (!((stance _unit) in ["STAND", "CROUCH"]) || { isWeaponRested _unit } || { isWeaponDeployed _unit }) exitWith {};
private _onFireFrameVector = getCameraViewDirection _unit;
uiSleep (diag_deltaTime * 2);
private _onFireBufferedFrameVector = getCameraViewDirection _unit;
private _onFireVectorDeltaArray = (_onFireFrameVector vectorDiff _onFireBufferedFrameVector) apply { parseNumber ((abs _x) toFixed 5) };
private _onFireVectorDeltaAbsolute = 0;
{ _onFireVectorDeltaAbsolute = _onFireVectorDeltaAbsolute + _x } forEach _onFireVectorDeltaArray;
private _isSuspect = _onFireVectorDeltaAbsolute <= 0.001; // Tweak delta
if (_isSuspect) exitWith {
// moar calculation (check % of suspect bullets, maybe by each series, etc)
};
};
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment