From d4c4e68e423b7f56c97d5f3465f0d35de26e7378 Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 11 Nov 2017 20:45:13 +0100 Subject: [PATCH] Overheating - Minor performance tweaks (#5739) * Don't try to cool down an already cooled barrel * Don't run the projectile direction update routine if we know that the max. possible deflection is < 0.05 mrad --- addons/overheating/functions/fnc_calculateCooling.sqf | 1 + addons/overheating/functions/fnc_firedEH.sqf | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/overheating/functions/fnc_calculateCooling.sqf b/addons/overheating/functions/fnc_calculateCooling.sqf index ced682d6d7..2986bcb9c7 100644 --- a/addons/overheating/functions/fnc_calculateCooling.sqf +++ b/addons/overheating/functions/fnc_calculateCooling.sqf @@ -19,6 +19,7 @@ params ["_temperature", "_barrelMass", "_totalTime"]; +if (_temperature < 1) exitWith {0}; // If a long time passed since the last shot, there's no need to calculate anything; the weapon should be cool if (_totalTime > 1800) exitWith {0}; diff --git a/addons/overheating/functions/fnc_firedEH.sqf b/addons/overheating/functions/fnc_firedEH.sqf index d690b85aa7..c6e4abde6a 100644 --- a/addons/overheating/functions/fnc_firedEH.sqf +++ b/addons/overheating/functions/fnc_firedEH.sqf @@ -41,7 +41,7 @@ TRACE_2("Unit fired with temp:",_unit,_temperature); TRACE_4("weapon data from cache",_weapon,_dispersion,_slowdownFactor,_jamChance); // Dispersion and bullet slow down -if (GVAR(overheatingDispersion)) then { +if (GVAR(overheatingDispersion) && _scaledTemperature > 0.1) then { // Exit if GVAR(pseudoRandomList) isn't synced yet if (isNil QGVAR(pseudoRandomList)) exitWith {ERROR("No pseudoRandomList sync");}; @@ -68,7 +68,7 @@ if (_unit != ACE_player && (!GVAR(showParticleEffectsForEveryone) || {_unit dist }; //Particle Effects: -if (GVAR(showParticleEffects) && {(CBA_missionTime > ((_unit getVariable [QGVAR(lastDrop), -1000]) + 0.40)) && {_scaledTemperature > 0.1}}) then { +if (GVAR(showParticleEffects) && _scaledTemperature > 0.1 && {CBA_missionTime > (_unit getVariable [QGVAR(lastDrop), -1000]) + 0.40}) then { _unit setVariable [QGVAR(lastDrop), CBA_missionTime]; private _direction = (_unit weaponDirection _weapon) vectorMultiply 0.25;