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
This commit is contained in:
ulteq 2017-11-11 20:45:13 +01:00 committed by GitHub
parent 9e11e39eb0
commit d4c4e68e42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -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};

View File

@ -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;