From 292a9b89a88a4637076430cab6bd50065e164a92 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Mon, 25 Oct 2021 00:24:53 -0700 Subject: [PATCH 01/24] move overheating cookoff into separate function --- .../functions/fnc_cookoffWeapon.sqf | 66 +++++++++++++++++++ .../functions/fnc_updateAmmoTemperature.sqf | 57 ++-------------- 2 files changed, 72 insertions(+), 51 deletions(-) create mode 100644 addons/overheating/functions/fnc_cookoffWeapon.sqf diff --git a/addons/overheating/functions/fnc_cookoffWeapon.sqf b/addons/overheating/functions/fnc_cookoffWeapon.sqf new file mode 100644 index 00000000000..d8387c9d2cf --- /dev/null +++ b/addons/overheating/functions/fnc_cookoffWeapon.sqf @@ -0,0 +1,66 @@ +#include "script_component.hpp" +/* + * Author: drofseh + * Cookoff loaded round. + * + * Arguments: + * 0: Unit + * 1: Weapon + * 2: Is Weapon Jammed + * 3: Type of Jam + * + * Return Value: + * Current ammunition temperature + * + * Example: + * [player, currentWeapon player, true, "Fire"] call ace_overheating_fnc_cookoffWeapon + * + * Public: No + */ + +params ["_unit", "_weapon", "_canUnjam", "_jamType"]; +TRACE_4("params",_unit,_weapon,_canUnjam,_jamType); + +// a weapon with a failure to fire or dud type jam will be unjammed from cooking off +// this is first so that the fired event from the cookoff can also cause a jam +if (_canUnjam && {_jamType in ["Fire","Dud"]}) then { + [_unit, currentMuzzle _unit, true] call FUNC(clearJam); + + // clearJam will remove a dud round, but so will the forced fire, so give back the lost round and shoot it + if (_jamType isEqualTo "Dud") then { + _unit setAmmo [_weapon, (_unit ammo _weapon) + 1]; + }; +}; + +// get valid mode and muzzle for the main weapon, we don't want the cookoff to come from an underbarrel launcher +([_weapon] call FUNC(getWeaponData)) params ["", "", "", "_modes", "_muzzle", "_reloadTime"]; + +// get an appropriate firemode and muzzle, cache the current muzzle +// trying to match firemodes and switching back to the cached muzzle will hide the change from the player and prevent unexpected mode/muzzle changes (going from full auto to semi auto, or from underbarrel GL to rifle for example) +private _muzzleCache = currentMuzzle _unit; +private _mode = currentWeaponMode _unit; +if !(_mode in _modes) then { + _mode = _modes select 0; +}; + +// delay cookoff to ensure any previous animation from a fired event is finished +[ + { + params ["_unit", "_muzzleCache", "_mode", "_muzzle"]; + + // fire the cookoff + _unit forceWeaponFire [_muzzle, _mode]; + + // switch back to the cached muzzle if required + if (_muzzle != _muzzleCache) then { + _unit selectWeapon _muzzleCache; + }; + + [ + [localize LSTRING(WeaponCookedOff)], + true // allows the hint to be overwritten by another hint, such as a jam or another cookoff + ] call CBA_fnc_notify; + }, + [_unit, _muzzleCache, _mode, _muzzle], + _reloadTime +] call CBA_fnc_waitAndExecute; diff --git a/addons/overheating/functions/fnc_updateAmmoTemperature.sqf b/addons/overheating/functions/fnc_updateAmmoTemperature.sqf index 12944774b77..721f300ea66 100644 --- a/addons/overheating/functions/fnc_updateAmmoTemperature.sqf +++ b/addons/overheating/functions/fnc_updateAmmoTemperature.sqf @@ -22,14 +22,15 @@ TRACE_3("params",_unit,_weapon,_barrelTemperature); private _closedBolt = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(closedBolt)); private _canUnjam = [_unit] call FUNC(canUnjam); +private _jamType = _unit getVariable [format [QGVAR(%1_jamType), _weapon], "None"]; // Skip if no ammo in chamber if ( _unit ammo _weapon < 1 // closed bolt, and jammed and type not failure to fire - || {_closedBolt == 1 && {_canUnjam} && {!(_unit getVariable [format [QGVAR(%1_jamType), _weapon], "None"] in ["Fire","Dud"])}} + || {_closedBolt == 1 && {_canUnjam} && {!(_jamType in ["Fire","Dud"])}} // open bolt, and not jammed, or jammed and type not failure to fire - || {_closedBolt == 0 && {!_canUnjam || {_canUnjam && {!(_unit getVariable [format [QGVAR(%1_jamType), _weapon], "None"] in ["Fire","Dud"])}}}} + || {_closedBolt == 0 && {!_canUnjam || {_canUnjam && {!(_jamType in ["Fire","Dud"])}}}} ) exitWith { _unit setVariable [format [QGVAR(%1_ammoTemp), _weapon], 0]; 0 @@ -47,57 +48,11 @@ if (_ammoTemperature < _barrelTemperature) then { _ammoTemperature = _barrelTemperature; }; -// check for cook off +// cookoff if too hot if (_ammoTemperature > (GUNPOWDER_IGNITION_TEMP * GVAR(cookoffCoef))) then { + [_unit, _weapon, _canUnjam, _jamType] call ace_overheating_fnc_cookoffWeapon; - // a weapon with a failure to fire or dud type jam will be unjammed from cooking off - // this is first so that the fired event from the cookoff can also cause a jam - private _jamType = _unit getVariable [format [QGVAR(%1_jamType), _weapon], "None"]; - if (_canUnjam && {_jamType in ["Fire","Dud"]}) then { - - [_unit, currentMuzzle _unit, true] call FUNC(clearJam); - - // clearJam will remove a dud round, but so will the forced fire, so give back the lost round and shoot it - if (_jamType isEqualTo "Dud") then { - private _ammo = _unit ammo _weapon; - _unit setAmmo [_weapon, _ammo + 1]; - }; - }; - - // get valid mode and muzzle for the main weapon, we don't want the cookoff to come from an underbarrel launcher - ([_weapon] call FUNC(getWeaponData)) params ["", "", "", "_modes", "_muzzle", "_reloadTime"]; - - // get an appropriate firemode and muzzle, cache the current muzzle - // trying to match firemodes and switching back to the cached muzzle will hide the change from the player and prevent unexpected mode/muzzle changes (going from full auto to semi auto, or from underbarrel GL to rifle for example) - private _muzzleCache = currentMuzzle _unit; - private _mode = currentWeaponMode _unit; - if !(_mode in _modes) then { - _mode = _modes select 0; - }; - - // delay cookoff to ensure any previous animation from a fired event is finished - [ - { - params ["_unit", "_muzzleCache", "_mode", "_muzzle"]; - - // fire the cookoff - _unit forceWeaponFire [_muzzle, _mode]; - - // switch back to the cached muzzle if required - if (_muzzle != _muzzleCache) then { - _unit selectWeapon _muzzleCache; - }; - - [ - [localize LSTRING(WeaponCookedOff)], - true // allows the hint to be overwritten by another hint, such as a jam or another cookoff - ] call CBA_fnc_notify; - }, - [_unit, _muzzleCache, _mode, _muzzle], - _reloadTime - ] call CBA_fnc_waitAndExecute; - - // if the cookoff happened then the next round should start at 0 + // since a cookoff happened then the next round should start at 0 _ammoTemperature = 0; }; From 78a9726e5831f50617f8cfd77485af973e9a4035 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Mon, 25 Oct 2021 00:29:30 -0700 Subject: [PATCH 02/24] move heatCoef and require mission restart for setting change - move heatCoef to a more sensible place - require mission restart for heatCoef setting change (it gets cached per ammo type) --- addons/overheating/functions/fnc_overheat.sqf | 12 +++++++----- .../overheating/functions/fnc_updateTemperature.sqf | 2 +- addons/overheating/initSettings.sqf | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/addons/overheating/functions/fnc_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf index f1eb7b16c07..00abb7849cb 100644 --- a/addons/overheating/functions/fnc_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -28,7 +28,7 @@ BEGIN_COUNTER(overheat); // Get bullet parameters private _energyIncrement = GVAR(cacheAmmoData) getVariable _ammo; if (isNil "_energyIncrement") then { - _bulletMass = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_BulletMass"); + private _bulletMass = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_BulletMass"); if (_bulletMass == 0) then { // If the bullet mass is not configured, estimate it _bulletMass = 3.4334 + 0.5171 * (getNumber (configFile >> "CfgAmmo" >> _ammo >> "hit") + getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber")); @@ -38,7 +38,7 @@ if (isNil "_energyIncrement") then { // Ref: https://en.wikipedia.org/wiki/Physics_of_firearms // Muzzle Engergy = 1/2 * m * v^2 = (1/2 * 0.001 g/kg * bulletMass (grams) * v^2) // Multiple by 3 becase we only calc every 3rd bullet: (3 * 1/2 * 0.001) = 0.0015 - _energyIncrement = 0.0015 * _bulletMass * (vectorMagnitudeSqr velocity _projectile); + _energyIncrement = GVAR(heatCoef) * 0.0015 * _bulletMass * (vectorMagnitudeSqr velocity _projectile); GVAR(cacheAmmoData) setVariable [_ammo, _energyIncrement]; }; @@ -54,9 +54,11 @@ private _silencer = switch (_weapon) do { if (_silencer != "") then { private _silencerCoef = GVAR(cacheSilencerData) getVariable _silencer; if (isNil "_silencerCoef") then { - _silencerCoef = 1 + - (1 - getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire")) + - (1 - getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFire")); + _silencerCoef = 1 + ( + 1 - getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire") + ) + ( + 1 - getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFire") + ); GVAR(cacheSilencerData) setVariable [_silencer, _silencerCoef]; }; _energyIncrement = _energyIncrement * _silencerCoef; diff --git a/addons/overheating/functions/fnc_updateTemperature.sqf b/addons/overheating/functions/fnc_updateTemperature.sqf index 351323d54a3..c4afbe672a7 100644 --- a/addons/overheating/functions/fnc_updateTemperature.sqf +++ b/addons/overheating/functions/fnc_updateTemperature.sqf @@ -35,7 +35,7 @@ _temperature = [_temperature, _barrelMass, CBA_missionTime - _lastTime] call FUN TRACE_1("cooledTo",_temperature); // Calculate heating // Steel Heat Capacity = 466 J/(Kg.K) -_temperature = _temperature + _heatIncrement * GVAR(heatCoef) / (_barrelMass * 466); +_temperature = _temperature + _heatIncrement / (_barrelMass * 466); // Publish the temperature variable [_unit, _tempVarName, _temperature, TEMP_TOLERANCE] call EFUNC(common,setApproximateVariablePublic); diff --git a/addons/overheating/initSettings.sqf b/addons/overheating/initSettings.sqf index b351a8bed78..65290f207a9 100644 --- a/addons/overheating/initSettings.sqf +++ b/addons/overheating/initSettings.sqf @@ -15,7 +15,9 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)]; [LSTRING(heatCoef_displayName), LSTRING(heatCoef_description)], _category, [0, 5, 1, 2], - 1 + 1, + {}, + true ] call CBA_fnc_addSetting; [ From 409b5a80f9e6018171894e18fb3c19bc69ff7c68 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Mon, 25 Oct 2021 00:30:58 -0700 Subject: [PATCH 03/24] add exit to ammo temp loop if cookoffCoef is changed to 0 mid-mission - add exit to ammo temp loop if cookoffCoef is changed to 0 mid-mission, this prevents an issue where all weapon cookoff regardless of temp, because required temp gets multiplied by cookoffCoef which has been set to 0. --- .../functions/fnc_updateAmmoTemperatureThread.sqf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/overheating/functions/fnc_updateAmmoTemperatureThread.sqf b/addons/overheating/functions/fnc_updateAmmoTemperatureThread.sqf index 2b191102d56..4fff0f59db0 100644 --- a/addons/overheating/functions/fnc_updateAmmoTemperatureThread.sqf +++ b/addons/overheating/functions/fnc_updateAmmoTemperatureThread.sqf @@ -15,6 +15,11 @@ * Public: No */ +// If the ace_overheating_cookoffCoef setting is set to 0 mid mission we want to exit right away or it will immediate cause all player weapons to cook off. +if (GVAR(cookoffCoef) isEqualTo 0) exitWith { + WARNING_1("'%1' has been set to 0 mid mission. Changing this setting requires mission restart.",GVAR(cookoffCoef)); +}; + private _currentWeapon = currentWeapon ACE_player; if ((_currentWeapon != "") && {_currentWeapon == primaryWeapon ACE_player || {_currentWeapon == handgunWeapon ACE_player}}) then { private _temperature = ACE_player getVariable [format [QGVAR(%1_temp), _currentWeapon], 0]; From 264885d75f34fed1aaf45576eba5f03d3d6bee25 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Mon, 25 Oct 2021 00:31:20 -0700 Subject: [PATCH 04/24] file end new line --- addons/overheating/functions/fnc_coolWeaponWithItem.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/overheating/functions/fnc_coolWeaponWithItem.sqf b/addons/overheating/functions/fnc_coolWeaponWithItem.sqf index 8558303829c..7c3bf50aa92 100644 --- a/addons/overheating/functions/fnc_coolWeaponWithItem.sqf +++ b/addons/overheating/functions/fnc_coolWeaponWithItem.sqf @@ -95,4 +95,4 @@ private _fnc_condition = { {}, //_fnc_onFailure, _consumeText, _fnc_condition -] call EFUNC(common,progressBar); \ No newline at end of file +] call EFUNC(common,progressBar); From 51385df4e44fb0dd810cf9dc1e02a6273f24f08b Mon Sep 17 00:00:00 2001 From: Drofseh Date: Mon, 25 Oct 2021 00:35:02 -0700 Subject: [PATCH 05/24] update header for ace_overheating_fnc_cookoffWeapon --- addons/overheating/functions/fnc_cookoffWeapon.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/overheating/functions/fnc_cookoffWeapon.sqf b/addons/overheating/functions/fnc_cookoffWeapon.sqf index d8387c9d2cf..f3be3a5dbe5 100644 --- a/addons/overheating/functions/fnc_cookoffWeapon.sqf +++ b/addons/overheating/functions/fnc_cookoffWeapon.sqf @@ -10,7 +10,7 @@ * 3: Type of Jam * * Return Value: - * Current ammunition temperature + * None * * Example: * [player, currentWeapon player, true, "Fire"] call ace_overheating_fnc_cookoffWeapon From cc6c353b7035d5ef4d258ea08d4aaa6a82fc1edb Mon Sep 17 00:00:00 2001 From: Drofseh Date: Mon, 25 Oct 2021 01:00:46 -0700 Subject: [PATCH 06/24] use ambientTemperature as floor for weapon and ammo temp --- addons/overheating/functions/fnc_calculateCooling.sqf | 11 +++++++---- .../functions/fnc_updateAmmoTemperature.sqf | 11 ++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/addons/overheating/functions/fnc_calculateCooling.sqf b/addons/overheating/functions/fnc_calculateCooling.sqf index 8fd39c70249..fbead028529 100644 --- a/addons/overheating/functions/fnc_calculateCooling.sqf +++ b/addons/overheating/functions/fnc_calculateCooling.sqf @@ -19,9 +19,12 @@ params ["_temperature", "_barrelMass", "_totalTime"]; -if (_temperature < 1) exitWith {0}; +// The lowest temperaure a weapon can reach is the ambient air temperature. +private _ambientTemperature = ambientTemperature select 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}; +if (_totalTime > 1800) exitWith {_ambientTemperature}; +if (_temperature <= _ambientTemperature) exitWith {_ambientTemperature}; //AR-15 (0.00570m bullet diameter) (barrel diameter usually 0.75" or 0.008255m radius) //Steel Denisty = 7850 m^3 / kg @@ -53,7 +56,7 @@ while {true} do { + 0.4 * 5.67e-8 * _barrelSurface * ((_temperature + 273.15) ^ 4 - 273.15 ^ 4) ) * _deltaTime / (_barrelMass * 466); - if (_temperature < 1) exitWith {0}; + if (_temperature <= _ambientTemperature) exitWith {_ambientTemperature}; if (isNil "_temperature") exitWith { diag_log text format ["[ACE] ERROR: _totalTime = %1; _time = %2; _deltaTime = %3;", _totalTime, _time, _deltaTime]; @@ -61,5 +64,5 @@ while {true} do { }; _time = _time + _deltaTime; - if (_time >= _totalTime) exitWith { _temperature max 0 }; + if (_time >= _totalTime) exitWith {_temperature max _ambientTemperature}; }; diff --git a/addons/overheating/functions/fnc_updateAmmoTemperature.sqf b/addons/overheating/functions/fnc_updateAmmoTemperature.sqf index 721f300ea66..d48739b49e1 100644 --- a/addons/overheating/functions/fnc_updateAmmoTemperature.sqf +++ b/addons/overheating/functions/fnc_updateAmmoTemperature.sqf @@ -32,12 +32,13 @@ if ( // open bolt, and not jammed, or jammed and type not failure to fire || {_closedBolt == 0 && {!_canUnjam || {_canUnjam && {!(_jamType in ["Fire","Dud"])}}}} ) exitWith { - _unit setVariable [format [QGVAR(%1_ammoTemp), _weapon], 0]; - 0 + private _ambientTemperature = ambientTemperature select 0; + _unit setVariable [format [QGVAR(%1_ammoTemp), _weapon], _ambientTemperature]; + _ambientTemperature }; private _ammoTempVarName = format [QGVAR(%1_ammoTemp), _weapon]; -private _ammoTemperature = _unit getVariable [_ammoTempVarName, 0]; +private _ammoTemperature = _unit getVariable [_ammoTempVarName, ambientTemperature select 0]; // heat or cool the ammo if (_ammoTemperature < _barrelTemperature) then { @@ -52,8 +53,8 @@ if (_ammoTemperature < _barrelTemperature) then { if (_ammoTemperature > (GUNPOWDER_IGNITION_TEMP * GVAR(cookoffCoef))) then { [_unit, _weapon, _canUnjam, _jamType] call ace_overheating_fnc_cookoffWeapon; - // since a cookoff happened then the next round should start at 0 - _ammoTemperature = 0; + // since a cookoff happened then the next round should start at the ambient temperature. + _ammoTemperature = ambientTemperature select 0; }; _unit setVariable [_ammoTempVarName, _ammoTemperature]; From d6a4900b7689aae83ffdfde00af1ec37b8a475ab Mon Sep 17 00:00:00 2001 From: Drofseh Date: Mon, 25 Oct 2021 01:13:51 -0700 Subject: [PATCH 07/24] add coolingCoef setting --- addons/overheating/functions/fnc_calculateCooling.sqf | 2 +- addons/overheating/initSettings.sqf | 10 ++++++++++ addons/overheating/stringtable.xml | 8 +++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/addons/overheating/functions/fnc_calculateCooling.sqf b/addons/overheating/functions/fnc_calculateCooling.sqf index fbead028529..dd8faa5fd5c 100644 --- a/addons/overheating/functions/fnc_calculateCooling.sqf +++ b/addons/overheating/functions/fnc_calculateCooling.sqf @@ -54,7 +54,7 @@ while {true} do { _convectionRate * _barrelSurface * _temperature // Radiative cooling + 0.4 * 5.67e-8 * _barrelSurface * ((_temperature + 273.15) ^ 4 - 273.15 ^ 4) - ) * _deltaTime / (_barrelMass * 466); + ) * GVAR(coolingCoef) * _deltaTime / (_barrelMass * 466); if (_temperature <= _ambientTemperature) exitWith {_ambientTemperature}; diff --git a/addons/overheating/initSettings.sqf b/addons/overheating/initSettings.sqf index 65290f207a9..1b0815b0dfb 100644 --- a/addons/overheating/initSettings.sqf +++ b/addons/overheating/initSettings.sqf @@ -20,6 +20,16 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)]; true ] call CBA_fnc_addSetting; +[ + QGVAR(coolingCoef), "SLIDER", + [LSTRING(coolingCoef_displayName), LSTRING(coolingCoef_description)], + _category, + [0, 5, 1, 2], + 1, + {}, + true +] call CBA_fnc_addSetting; + [ QGVAR(showParticleEffects), "CHECKBOX", [LSTRING(showParticleEffects_displayName), LSTRING(showParticleEffects_description)], diff --git a/addons/overheating/stringtable.xml b/addons/overheating/stringtable.xml index 97286a1afa0..dcdfd00cef3 100644 --- a/addons/overheating/stringtable.xml +++ b/addons/overheating/stringtable.xml @@ -60,6 +60,12 @@ Коэффициент количества тепла, выделяемого оружием за выстрел. \nБольшие значения увеличивают нагрев. Współczynnik wpływający na ilość ciepła generowanego przez broń przy każdym strzale. + + Cooling Coefficient + + + Coefficient for how quickly a weapon cools down.\nHigher value increases cooling speed. + Display Text on Jam Zeige Text bei Ladehemmung @@ -266,7 +272,7 @@ Unjam on Barrel Swap 銃身交換で弾詰まり解消 Désenrayer l'arme au changement de canon - Замена ствола устраняет заклинивание оружия. + Замена ствола устраняет заклинивание оружия. Usuń zacięcie przy wymianie lufy From 4800c61b63c06ac216658bc67b6e1e73ab5835ac Mon Sep 17 00:00:00 2001 From: Drofseh Date: Mon, 25 Oct 2021 01:14:08 -0700 Subject: [PATCH 08/24] improve feature documentation --- docs/wiki/feature/overheating.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/wiki/feature/overheating.md b/docs/wiki/feature/overheating.md index 1fe090aceb1..39628856a37 100644 --- a/docs/wiki/feature/overheating.md +++ b/docs/wiki/feature/overheating.md @@ -53,12 +53,11 @@ Jams can be cleared in the following ways: - Select `Equipment`. - Select `Check weapon temperature`. -**NOTE** When the bar is half full (yellow) it means the barrel is around 500°c. -Your weapon will be even more prone to jams, and it'll get worse if you don't let the barrel cool down or swap it. +**NOTE** Each section on the bar represents 100°c. When the bar reaches 2 sections weapons can start to cookoff. When it is half full (yellow) it means the barrel is around 500°c. Your weapon will be even more prone to jams, and it'll get worse if you don't let the barrel cool down or swap it. ### 2.4 Cooling your weapon -- Weapons and spare barrels will cool off over time. +- Weapons and spare barrels will cool off over time, down to the ambient temperature in the mission. - Cooling speed of weapons in increased in windy or rainy weather, and when swimming. - If ACE Field Rations is loaded then weapons can be cooled with canteens, water bottles, or other beverage items. This does not require the Field Rations system to be enabled. - If ACE Field Rations is enabled then weapons can also be cooled with the same water sources used to refill canteens and water bottles. From 18a4cf57caf05b4aed383040d4b1d51f14aa6905 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Mon, 25 Oct 2021 20:52:26 -0700 Subject: [PATCH 09/24] add fnc_cookoffWeapon to XEH_PREP --- addons/overheating/XEH_PREP.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/overheating/XEH_PREP.hpp b/addons/overheating/XEH_PREP.hpp index f4b56c3c3ff..4cf47c5f3f3 100644 --- a/addons/overheating/XEH_PREP.hpp +++ b/addons/overheating/XEH_PREP.hpp @@ -6,6 +6,7 @@ PREP(canCheckSpareBarrelsTemperatures); PREP(checkSpareBarrelsTemperatures); PREP(checkTemperature); PREP(clearJam); +PREP(cookoffWeapon); PREP(coolWeaponWithItem); PREP(coolWeaponWithWaterSource); PREP(displayTemperature); From c60ab9a174fd171ecfc6b0913dea40723fd62788 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Wed, 27 Oct 2021 13:02:28 -0700 Subject: [PATCH 10/24] add type of jam to ace_weaponJammed local event - add type of jam to ace_weaponJammed local event - fix #8637 --- addons/overheating/functions/fnc_jamWeapon.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/overheating/functions/fnc_jamWeapon.sqf b/addons/overheating/functions/fnc_jamWeapon.sqf index ea77e11ba46..3f6f0838c30 100644 --- a/addons/overheating/functions/fnc_jamWeapon.sqf +++ b/addons/overheating/functions/fnc_jamWeapon.sqf @@ -51,7 +51,9 @@ if (_jamTypesAllowed isEqualTo []) then { }; }; -_unit setVariable [format [QGVAR(%1_jamType), _weapon], selectRandomWeighted _jamTypesAllowed]; +private _jamType = selectRandomWeighted _jamTypesAllowed; +_unit setVariable [format [QGVAR(%1_jamType), _weapon], _jamType]; + // Stop current burst _unit setAmmo [_weapon, 0]; @@ -72,7 +74,7 @@ if (_weapon == primaryWeapon _unit) then { // only display the hint once, after you try to shoot an already jammed weapon GVAR(knowAboutJam) = false; -["ace_weaponJammed", [_unit,_weapon]] call CBA_fnc_localEvent; +["ace_weaponJammed", [_unit, _weapon, _jamType]] call CBA_fnc_localEvent; if (_unit getVariable [QGVAR(JammingActionID), -1] == -1) then { From 654c1d1236ea8cf329545510700ff6315b29ca21 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Thu, 28 Oct 2021 09:24:06 -0700 Subject: [PATCH 11/24] fix misspelling Co-authored-by: TyroneMF --- addons/overheating/functions/fnc_calculateCooling.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/overheating/functions/fnc_calculateCooling.sqf b/addons/overheating/functions/fnc_calculateCooling.sqf index dd8faa5fd5c..db65fb1d2ac 100644 --- a/addons/overheating/functions/fnc_calculateCooling.sqf +++ b/addons/overheating/functions/fnc_calculateCooling.sqf @@ -19,7 +19,7 @@ params ["_temperature", "_barrelMass", "_totalTime"]; -// The lowest temperaure a weapon can reach is the ambient air temperature. +// The lowest temperature a weapon can reach is the ambient air temperature. private _ambientTemperature = ambientTemperature select 0; // If a long time passed since the last shot, there's no need to calculate anything; the weapon should be cool From 1ceb513fafb5be875f85a6009b22e33a547fc044 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Thu, 28 Oct 2021 10:23:47 -0700 Subject: [PATCH 12/24] clear all weapon heat on death --- addons/overheating/XEH_postInit.sqf | 11 ++++++++++- .../overheating/functions/fnc_updateTemperature.sqf | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/addons/overheating/XEH_postInit.sqf b/addons/overheating/XEH_postInit.sqf index fbd0f94f1c2..c8ffc8253f3 100644 --- a/addons/overheating/XEH_postInit.sqf +++ b/addons/overheating/XEH_postInit.sqf @@ -76,8 +76,18 @@ if (hasInterface) then { }] call CBA_fnc_addClassEventHandler; }; + // Reset all weapon heat to ambient on death to prevent cookoffs when a unit respawns. + ["CAManBase", "Killed", { + params ["_unit"]; + { + _unit setVariable [_x, ambientTemperature select 0]; + } forEach (_unit getVariable [QGVAR(trackedWeapons), []]); + _unit setVariable [QGVAR(trackedWeapons), []]; + }] call CBA_fnc_addClassEventHandler; + // Install event handler to display temp when a barrel was swapped [QGVAR(showWeaponTemperature), DFUNC(displayTemperature)] call CBA_fnc_addEventHandler; + // Install event handler to initiate an assisted barrel swap [QGVAR(initiateSwapBarrelAssisted), DFUNC(swapBarrel)] call CBA_fnc_addEventHandler; @@ -107,5 +117,4 @@ if (hasInterface) then { [] ] call CBA_fnc_waitUntilAndExecute; }; - }] call CBA_fnc_addEventHandler; diff --git a/addons/overheating/functions/fnc_updateTemperature.sqf b/addons/overheating/functions/fnc_updateTemperature.sqf index c4afbe672a7..ab48b19f8c1 100644 --- a/addons/overheating/functions/fnc_updateTemperature.sqf +++ b/addons/overheating/functions/fnc_updateTemperature.sqf @@ -26,9 +26,12 @@ private _tempVarName = format [QGVAR(%1_temp), _weapon]; private _timeVarName = format [QGVAR(%1_time), _weapon]; private _temperature = _unit getVariable [_tempVarName, 0]; private _lastTime = _unit getVariable [_timeVarName, 0]; - private _barrelMass = _weapon call FUNC(getBarrelMass); +// keep track of weapons that have heat, so they can be set to ambient temperaure on killed/respawn +private _trackedWeapons = _unit getVariable [QGVAR(trackedWeapons), []]; +_unit setVariable [QGVAR(trackedWeapons), _trackedWeapons pushBackUnique _tempVarName]; + // Calculate cooling _temperature = [_temperature, _barrelMass, CBA_missionTime - _lastTime] call FUNC(calculateCooling); @@ -39,6 +42,7 @@ _temperature = _temperature + _heatIncrement / (_barrelMass * 466); // Publish the temperature variable [_unit, _tempVarName, _temperature, TEMP_TOLERANCE] call EFUNC(common,setApproximateVariablePublic); + // Store the update time locally _unit setVariable [_timeVarName, CBA_missionTime]; From 5364e6902c16bac5f8017b760d3649eef0b4ede6 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Fri, 29 Oct 2021 22:43:12 -0700 Subject: [PATCH 13/24] Update addons/overheating/functions/fnc_updateTemperature.sqf Co-authored-by: GhostIsSpooky <69561145+Salluci@users.noreply.github.com> --- addons/overheating/functions/fnc_updateTemperature.sqf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/overheating/functions/fnc_updateTemperature.sqf b/addons/overheating/functions/fnc_updateTemperature.sqf index ab48b19f8c1..d8ca5b23462 100644 --- a/addons/overheating/functions/fnc_updateTemperature.sqf +++ b/addons/overheating/functions/fnc_updateTemperature.sqf @@ -30,7 +30,8 @@ private _barrelMass = _weapon call FUNC(getBarrelMass); // keep track of weapons that have heat, so they can be set to ambient temperaure on killed/respawn private _trackedWeapons = _unit getVariable [QGVAR(trackedWeapons), []]; -_unit setVariable [QGVAR(trackedWeapons), _trackedWeapons pushBackUnique _tempVarName]; +_trackedWeapons pushBackUnique _tempVarName; +_unit setVariable [QGVAR(trackedWeapons), _trackedWeapons]; // Calculate cooling _temperature = [_temperature, _barrelMass, CBA_missionTime - _lastTime] call FUNC(calculateCooling); From 14822bad049a9211e3c19da33bbfe660264eb90d Mon Sep 17 00:00:00 2001 From: Drofseh Date: Fri, 29 Oct 2021 23:42:17 -0700 Subject: [PATCH 14/24] deprecate ace_overheating_fnc_getBarrelMass, cache weapon bolt and barrel mass values - cache closed bolt value by moving config look up to ace_overheating_fnc_getWeaponData - cache barrel mass value by moving calculation from ace_overheating_fnc_getBarrelMass to ace_overheating_fnc_getWeaponData - deprecate ace_overheating_fnc_getBarrelMass to be a wrapper for ace_overheating_fnc_getWeaponData that only returns barrel mass --- addons/overheating/functions/fnc_cookoffWeapon.sqf | 4 ++-- .../functions/fnc_coolWeaponWithItem.sqf | 2 +- .../functions/fnc_coolWeaponWithWaterSource.sqf | 2 +- addons/overheating/functions/fnc_getBarrelMass.sqf | 4 +++- addons/overheating/functions/fnc_getWeaponData.sqf | 14 ++++++++++++-- .../functions/fnc_swapBarrelCallback.sqf | 2 +- .../functions/fnc_updateAmmoTemperature.sqf | 2 +- .../functions/fnc_updateTemperature.sqf | 2 +- 8 files changed, 22 insertions(+), 10 deletions(-) diff --git a/addons/overheating/functions/fnc_cookoffWeapon.sqf b/addons/overheating/functions/fnc_cookoffWeapon.sqf index f3be3a5dbe5..ae2311243c2 100644 --- a/addons/overheating/functions/fnc_cookoffWeapon.sqf +++ b/addons/overheating/functions/fnc_cookoffWeapon.sqf @@ -46,7 +46,7 @@ if !(_mode in _modes) then { // delay cookoff to ensure any previous animation from a fired event is finished [ { - params ["_unit", "_muzzleCache", "_mode", "_muzzle"]; + params ["_unit", "_mode", "_muzzle", "_muzzleCache"]; // fire the cookoff _unit forceWeaponFire [_muzzle, _mode]; @@ -61,6 +61,6 @@ if !(_mode in _modes) then { true // allows the hint to be overwritten by another hint, such as a jam or another cookoff ] call CBA_fnc_notify; }, - [_unit, _muzzleCache, _mode, _muzzle], + [_unit, _mode, _muzzle, _muzzleCache], _reloadTime ] call CBA_fnc_waitAndExecute; diff --git a/addons/overheating/functions/fnc_coolWeaponWithItem.sqf b/addons/overheating/functions/fnc_coolWeaponWithItem.sqf index 7c3bf50aa92..3a8091584bc 100644 --- a/addons/overheating/functions/fnc_coolWeaponWithItem.sqf +++ b/addons/overheating/functions/fnc_coolWeaponWithItem.sqf @@ -61,7 +61,7 @@ private _fnc_onSuccess = { }; // cool the weapon - private _barrelMass = _weapon call FUNC(getBarrelMass); + ([_weapon] call FUNC(getWeaponData)) params ["", "", "", "", "", "", "", "_barrelMass"]; _temperature = [_temperature, _barrelMass, _liquidAmount * 10] call FUNC(calculateCooling); [_target, _tempVarName, _temperature, TEMP_TOLERANCE] call EFUNC(common,setApproximateVariablePublic); }; diff --git a/addons/overheating/functions/fnc_coolWeaponWithWaterSource.sqf b/addons/overheating/functions/fnc_coolWeaponWithWaterSource.sqf index 2e142602ec6..2ed62e02f3d 100644 --- a/addons/overheating/functions/fnc_coolWeaponWithWaterSource.sqf +++ b/addons/overheating/functions/fnc_coolWeaponWithWaterSource.sqf @@ -59,7 +59,7 @@ private _fnc_condition = { }; //Cool the weapon down - private _barrelMass = _weapon call FUNC(getBarrelMass); + ([_weapon] call FUNC(getWeaponData)) params ["", "", "", "", "", "", "", "_barrelMass"]; _temperature = [_temperature, _barrelMass, 20] call FUNC(calculateCooling); [_player, _tempVarName, _temperature, TEMP_TOLERANCE] call EFUNC(common,setApproximateVariablePublic); diff --git a/addons/overheating/functions/fnc_getBarrelMass.sqf b/addons/overheating/functions/fnc_getBarrelMass.sqf index 1504442a600..3dab9cae89a 100644 --- a/addons/overheating/functions/fnc_getBarrelMass.sqf +++ b/addons/overheating/functions/fnc_getBarrelMass.sqf @@ -17,4 +17,6 @@ params ["_weapon"]; -METAL_MASS_RATIO * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; +([_weapon] call FUNC(getWeaponData)) params ["", "", "", "", "", "", "", "_barrelMass"]; + +_barrelMass diff --git a/addons/overheating/functions/fnc_getWeaponData.sqf b/addons/overheating/functions/fnc_getWeaponData.sqf index c5cfb40d4a7..aaa288e6126 100644 --- a/addons/overheating/functions/fnc_getWeaponData.sqf +++ b/addons/overheating/functions/fnc_getWeaponData.sqf @@ -7,9 +7,14 @@ * 0: weapon type * * Return Value: - * 0: dispresion + * 0: dispersion * 1: slowdownFactor * 2: jamChance + * 3: modes + * 4: muzzle + * 5: reloadTime + * 6: closedBolt + * 7: barrelMass * * Example: * ["gun"] call ace_overheating_fnc_getWeaponData @@ -71,10 +76,15 @@ private _muzzle = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles") if (_muzzle == "this") then { _muzzle = _weapon; }; + private _reloadTime = getNumber (configfile >> "CfgWeapons" >> _weapon >> (_modes select 0) >> "reloadTime"); +private _closedBolt = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(closedBolt)); + +private _barrelMass = METAL_MASS_RATIO * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; + // Cache the values -_weaponData = [_dispersion, _slowdownFactor, _jamChance, _modes, _muzzle, _reloadTime]; +_weaponData = [_dispersion, _slowdownFactor, _jamChance, _modes, _muzzle, _reloadTime, _closedBolt, _barrelMass]; TRACE_2("building cache",_weapon,_weaponData); GVAR(cacheWeaponData) setVariable [_weapon, _weaponData]; diff --git a/addons/overheating/functions/fnc_swapBarrelCallback.sqf b/addons/overheating/functions/fnc_swapBarrelCallback.sqf index 1f458bcc265..a418d35510e 100644 --- a/addons/overheating/functions/fnc_swapBarrelCallback.sqf +++ b/addons/overheating/functions/fnc_swapBarrelCallback.sqf @@ -34,7 +34,7 @@ if (GVAR(unJamOnSwapBarrel) && {[_gunner] call FUNC(canUnjam)}) then { [localize LSTRING(SwappedBarrel), QPATHTOF(UI\spare_barrel_ca.paa)] call EFUNC(common,displayTextPicture); private _temp = _gunner getVariable [format [QGVAR(%1_temp), _weapon], 0]; -private _barrelMass = _weapon call FUNC(getBarrelMass); +([_weapon] call FUNC(getWeaponData)) params ["", "", "", "", "", "", "", "_barrelMass"]; // Instruct the server to load the coolest spare barrel into the weapon and // store the removed barrel with the former weapon temperature. The server diff --git a/addons/overheating/functions/fnc_updateAmmoTemperature.sqf b/addons/overheating/functions/fnc_updateAmmoTemperature.sqf index d48739b49e1..b6fa3e61fb2 100644 --- a/addons/overheating/functions/fnc_updateAmmoTemperature.sqf +++ b/addons/overheating/functions/fnc_updateAmmoTemperature.sqf @@ -20,7 +20,7 @@ params ["_unit", "_weapon", "_barrelTemperature"]; TRACE_3("params",_unit,_weapon,_barrelTemperature); -private _closedBolt = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(closedBolt)); +([_weapon] call FUNC(getWeaponData)) params ["", "", "", "", "", "", "_closedBolt"]; private _canUnjam = [_unit] call FUNC(canUnjam); private _jamType = _unit getVariable [format [QGVAR(%1_jamType), _weapon], "None"]; diff --git a/addons/overheating/functions/fnc_updateTemperature.sqf b/addons/overheating/functions/fnc_updateTemperature.sqf index d8ca5b23462..ddba32bf982 100644 --- a/addons/overheating/functions/fnc_updateTemperature.sqf +++ b/addons/overheating/functions/fnc_updateTemperature.sqf @@ -26,7 +26,6 @@ private _tempVarName = format [QGVAR(%1_temp), _weapon]; private _timeVarName = format [QGVAR(%1_time), _weapon]; private _temperature = _unit getVariable [_tempVarName, 0]; private _lastTime = _unit getVariable [_timeVarName, 0]; -private _barrelMass = _weapon call FUNC(getBarrelMass); // keep track of weapons that have heat, so they can be set to ambient temperaure on killed/respawn private _trackedWeapons = _unit getVariable [QGVAR(trackedWeapons), []]; @@ -34,6 +33,7 @@ _trackedWeapons pushBackUnique _tempVarName; _unit setVariable [QGVAR(trackedWeapons), _trackedWeapons]; // Calculate cooling +([_weapon] call FUNC(getWeaponData)) params ["", "", "", "", "", "", "", "_barrelMass"]; _temperature = [_temperature, _barrelMass, CBA_missionTime - _lastTime] call FUNC(calculateCooling); TRACE_1("cooledTo",_temperature); From b48424cf324c415684dc13b118197521c6e3b80e Mon Sep 17 00:00:00 2001 From: Drofseh Date: Sat, 30 Oct 2021 17:37:03 -0700 Subject: [PATCH 15/24] add public functions to get and set weapon and ammo temperature --- addons/overheating/XEH_PREP.hpp | 4 +++ .../functions/fnc_getAmmoTemperature.sqf | 23 ++++++++++++++++ .../functions/fnc_getWeaponTemperature.sqf | 23 ++++++++++++++++ .../functions/fnc_setAmmoTemperature.sqf | 26 +++++++++++++++++++ .../functions/fnc_setWeaponTemperature.sqf | 26 +++++++++++++++++++ .../functions/fnc_updateAmmoTemperature.sqf | 2 +- .../functions/fnc_updateTemperature.sqf | 2 +- 7 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 addons/overheating/functions/fnc_getAmmoTemperature.sqf create mode 100644 addons/overheating/functions/fnc_getWeaponTemperature.sqf create mode 100644 addons/overheating/functions/fnc_setAmmoTemperature.sqf create mode 100644 addons/overheating/functions/fnc_setWeaponTemperature.sqf diff --git a/addons/overheating/XEH_PREP.hpp b/addons/overheating/XEH_PREP.hpp index 4cf47c5f3f3..5a1d3c5387b 100644 --- a/addons/overheating/XEH_PREP.hpp +++ b/addons/overheating/XEH_PREP.hpp @@ -11,15 +11,19 @@ PREP(coolWeaponWithItem); PREP(coolWeaponWithWaterSource); PREP(displayTemperature); PREP(firedEH); +PREP(getAmmoTemperature); PREP(getBarrelMass); PREP(getConsumableChildren); PREP(getWeaponData); +PREP(getWeaponTemperature); PREP(handleTakeEH); PREP(handleRespawn); PREP(jamWeapon); PREP(loadCoolestSpareBarrel); PREP(overheat); PREP(sendSpareBarrelsTemperaturesHint); +PREP(setAmmoTemperature); +PREP(setWeaponTemperature); PREP(swapBarrel); PREP(swapBarrelAssistant); PREP(swapBarrelCallback); diff --git a/addons/overheating/functions/fnc_getAmmoTemperature.sqf b/addons/overheating/functions/fnc_getAmmoTemperature.sqf new file mode 100644 index 00000000000..01499d0ea55 --- /dev/null +++ b/addons/overheating/functions/fnc_getAmmoTemperature.sqf @@ -0,0 +1,23 @@ +#include "script_component.hpp" +/* + * Author: drofseh + * Get current temperaure of weapon's ammo. + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * Current ammunition temperature + * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_getAmmoTemperature + * + * Public: Yes + */ + +params ["_unit", "_weapon"]; + +private _ammoTempVarName = format [QGVAR(%1_ammoTemp), _weapon]; + +_unit getVariable [_ammoTempVarName, ambientTemperature select 0]; diff --git a/addons/overheating/functions/fnc_getWeaponTemperature.sqf b/addons/overheating/functions/fnc_getWeaponTemperature.sqf new file mode 100644 index 00000000000..f17f14a3fc6 --- /dev/null +++ b/addons/overheating/functions/fnc_getWeaponTemperature.sqf @@ -0,0 +1,23 @@ +#include "script_component.hpp" +/* + * Author: drofseh + * Get current temperaure of weapon. + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * Current ammunition temperature + * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_getWeaponTemperature + * + * Public: Yes + */ + +params ["_unit", "_weapon"]; + +private _weaponTempVarName = format [QGVAR(%1_temp), _weapon]; + +_unit getVariable [_weaponTempVarName, ambientTemperature select 0]; diff --git a/addons/overheating/functions/fnc_setAmmoTemperature.sqf b/addons/overheating/functions/fnc_setAmmoTemperature.sqf new file mode 100644 index 00000000000..43794f97ac5 --- /dev/null +++ b/addons/overheating/functions/fnc_setAmmoTemperature.sqf @@ -0,0 +1,26 @@ +#include "script_component.hpp" +/* + * Author: drofseh + * Set weapon's ammo to specific temperature. + * + * Arguments: + * 0: Unit + * 1: Weapon + * 2: Temperature + * + * Return Value: + * None + * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_setAmmoTemperature + * + * Public: Yes + */ + +params ["_unit", "_weapon", "_temp"]; + +private _ammoTempVarName = format [QGVAR(%1_ammoTemp), _weapon]; + +_unit setVariable [_ammoTempVarName, _temp]; + +nil diff --git a/addons/overheating/functions/fnc_setWeaponTemperature.sqf b/addons/overheating/functions/fnc_setWeaponTemperature.sqf new file mode 100644 index 00000000000..5fb738f5b0f --- /dev/null +++ b/addons/overheating/functions/fnc_setWeaponTemperature.sqf @@ -0,0 +1,26 @@ +#include "script_component.hpp" +/* + * Author: drofseh + * Set weapon to specific temperature. + * + * Arguments: + * 0: Unit + * 1: Weapon + * 2: Temperature + * + * Return Value: + * None + * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_setWeaponTemperature + * + * Public: Yes + */ + +params ["_unit", "_weapon", "_temp"]; + +private _ammoTempVarName = format [QGVAR(%1_ammoTemp), _weapon]; + +_unit setVariable [_ammoTempVarName, _temp]; + +nil diff --git a/addons/overheating/functions/fnc_updateAmmoTemperature.sqf b/addons/overheating/functions/fnc_updateAmmoTemperature.sqf index b6fa3e61fb2..5e06e09a271 100644 --- a/addons/overheating/functions/fnc_updateAmmoTemperature.sqf +++ b/addons/overheating/functions/fnc_updateAmmoTemperature.sqf @@ -9,7 +9,7 @@ * 2: Barrel Temperature * * Return Value: - * Current ammunition temperature + * New temperature * * Example: * [player, currentWeapon player, 600] call ace_overheating_fnc_updateAmmoTemperature diff --git a/addons/overheating/functions/fnc_updateTemperature.sqf b/addons/overheating/functions/fnc_updateTemperature.sqf index ddba32bf982..e1368ea2e50 100644 --- a/addons/overheating/functions/fnc_updateTemperature.sqf +++ b/addons/overheating/functions/fnc_updateTemperature.sqf @@ -9,7 +9,7 @@ * 2: Heat increment (J) * * Return Value: - * Current temperature + * New temperature * * Example: * [player, currentWeapon player, 2000] call ace_overheating_fnc_updateTemperature From 3418448e1d92ef9ad73a34109ece58be5bd1b86e Mon Sep 17 00:00:00 2001 From: Drofseh Date: Mon, 1 Nov 2021 09:27:33 -0700 Subject: [PATCH 16/24] add `canCoolWeaponWithItem` function, workaround for #8657 --- addons/overheating/CfgVehicles.hpp | 4 +-- .../functions/fnc_canCoolWeaponWithItem.sqf | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf diff --git a/addons/overheating/CfgVehicles.hpp b/addons/overheating/CfgVehicles.hpp index 5a854699e2d..7f9206461b2 100644 --- a/addons/overheating/CfgVehicles.hpp +++ b/addons/overheating/CfgVehicles.hpp @@ -38,7 +38,7 @@ class CfgVehicles { }; class GVAR(CoolWeaponWithItem) { displayName = CSTRING(CoolWeaponWithItem); - condition = QUOTE(GVAR(enabled) && {isClass (configfile >> 'CfgPatches' >> 'acex_field_rations')}); + condition = QUOTE(GVAR(enabled) && {[ARR_2(_player, _player)] call FUNC(canCoolWeaponWithItem)}); exceptions[] = {"isNotInside", "isNotSwimming", "isNotSitting"}; statement = "true"; showDisabled = 0; @@ -66,7 +66,7 @@ class CfgVehicles { }; class GVAR(CoolWeaponWithItem) { displayName = CSTRING(CoolWeaponWithItem); - condition = QUOTE(GVAR(enabled) && {isClass (configfile >> 'CfgPatches' >> 'acex_field_rations')}); + condition = 'GVAR(enabled) && {[_player, _target] call FUNC(canCoolWeaponWithItem)} && {!(_unit getVariable [QEGVAR(captives,isSurrendering), false])} && {!(_unit getVariable [QEGVAR(captives,isHandcuffed), false])}'; exceptions[] = {"isNotInside", "isNotSwimming", "isNotSitting"}; statement = "true"; showDisabled = 0; diff --git a/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf b/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf new file mode 100644 index 00000000000..2bec154ba9a --- /dev/null +++ b/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf @@ -0,0 +1,36 @@ +#include "script_component.hpp" +/* + * Author: drofseh + * Return true if the target's weapon can be cooled with an item in the player's inventory + * + * Arguments: + * 0: Player + * 1: Target + * + * Return Value: + * Bool + * + * Example: + * [bob, joe] call ace_overheating_fnc_canCoolWeaponWithItem + * + * Public: No + */ + +params ["_player", "_unit"]; +TRACE_2("_player, _unit",_player, _unit); + +private _return = false; + +if ( + GVAR(enabled) + && {isClass (configfile >> "CfgPatches" >> "acex_field_rations")} + && {[_unit, currentWeapon _unit] call FUNC(getWeaponTemperature) > (ambientTemperature select 0)} +) then { + { + if (getNumber (configFile >> "CfgWeapons" >> _x >> QEXGVAR(field_rations,thirstQuenched)) > 0) exitWith { + _return = true; + }; + } forEach (_player call EFUNC(common,uniqueItems)); +}; + +_return From 77199dc74cd1d70201bdfbef47eed37b894ee630 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Wed, 3 Nov 2021 00:22:05 -0700 Subject: [PATCH 17/24] Apply suggestions from code review Co-authored-by: PabstMirror --- addons/overheating/CfgVehicles.hpp | 2 +- addons/overheating/functions/fnc_updateAmmoTemperature.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/overheating/CfgVehicles.hpp b/addons/overheating/CfgVehicles.hpp index 7f9206461b2..4f70fa0bf07 100644 --- a/addons/overheating/CfgVehicles.hpp +++ b/addons/overheating/CfgVehicles.hpp @@ -66,7 +66,7 @@ class CfgVehicles { }; class GVAR(CoolWeaponWithItem) { displayName = CSTRING(CoolWeaponWithItem); - condition = 'GVAR(enabled) && {[_player, _target] call FUNC(canCoolWeaponWithItem)} && {!(_unit getVariable [QEGVAR(captives,isSurrendering), false])} && {!(_unit getVariable [QEGVAR(captives,isHandcuffed), false])}'; + condition = 'GVAR(enabled) && {[_player, _target] call FUNC(canCoolWeaponWithItem)} && {!(_target getVariable [QEGVAR(captives,isSurrendering), false])} && {!(_target getVariable [QEGVAR(captives,isHandcuffed), false])}'; exceptions[] = {"isNotInside", "isNotSwimming", "isNotSitting"}; statement = "true"; showDisabled = 0; diff --git a/addons/overheating/functions/fnc_updateAmmoTemperature.sqf b/addons/overheating/functions/fnc_updateAmmoTemperature.sqf index 5e06e09a271..fd1ac2880ca 100644 --- a/addons/overheating/functions/fnc_updateAmmoTemperature.sqf +++ b/addons/overheating/functions/fnc_updateAmmoTemperature.sqf @@ -51,7 +51,7 @@ if (_ammoTemperature < _barrelTemperature) then { // cookoff if too hot if (_ammoTemperature > (GUNPOWDER_IGNITION_TEMP * GVAR(cookoffCoef))) then { - [_unit, _weapon, _canUnjam, _jamType] call ace_overheating_fnc_cookoffWeapon; + [_unit, _weapon, _canUnjam, _jamType] call FUNC(cookoffWeapon); // since a cookoff happened then the next round should start at the ambient temperature. _ammoTemperature = ambientTemperature select 0; From 5ef3945cfd6c74bfa5197adbce0f168ad520e5a6 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Wed, 3 Nov 2021 00:25:05 -0700 Subject: [PATCH 18/24] add coef setting for addition heat from suppressor --- addons/overheating/functions/fnc_overheat.sqf | 19 ++++++++----------- addons/overheating/initSettings.sqf | 10 ++++++++++ addons/overheating/stringtable.xml | 6 ++++++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/addons/overheating/functions/fnc_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf index 00abb7849cb..2b2e8713397 100644 --- a/addons/overheating/functions/fnc_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -46,22 +46,19 @@ if (isNil "_energyIncrement") then { // Increase overheating depending on how obstrusive is the current supressor, // if any. Typical arma supressors have visibleFire=0.5 and audibleFire=0.3, // so they produce x2.1 overheating -private _silencer = switch (_weapon) do { +private _suppressor = switch (_weapon) do { case (primaryWeapon _unit) : {(primaryWeaponItems _unit) select 0}; case (handgunWeapon _unit) : {(handgunItems _unit) select 0}; default {""}; }; -if (_silencer != "") then { - private _silencerCoef = GVAR(cacheSilencerData) getVariable _silencer; - if (isNil "_silencerCoef") then { - _silencerCoef = 1 + ( - 1 - getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire") - ) + ( - 1 - getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFire") - ); - GVAR(cacheSilencerData) setVariable [_silencer, _silencerCoef]; +if (_suppressor != "") then { + private _suppressorCoef = GVAR(cacheSilencerData) getVariable _suppressor; + if (isNil "_suppressorCoef") then { + private _config = configFile >> "CfgWeapons" >> _suppressor >> "ItemInfo" >> "AmmoCoef"; + _suppressorCoef = GVAR(suppressorCoef) * (1 + (1 - getNumber (_config >> "audibleFire")) + (1 - getNumber (_config >> "visibleFire"))); + GVAR(cacheSilencerData) setVariable [_suppressor, _suppressorCoef]; }; - _energyIncrement = _energyIncrement * _silencerCoef; + _energyIncrement = _energyIncrement * _suppressorCoef; }; TRACE_1("heat",_energyIncrement); diff --git a/addons/overheating/initSettings.sqf b/addons/overheating/initSettings.sqf index 1b0815b0dfb..40802bdeab7 100644 --- a/addons/overheating/initSettings.sqf +++ b/addons/overheating/initSettings.sqf @@ -30,6 +30,16 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)]; true ] call CBA_fnc_addSetting; +[ + QGVAR(suppressorCoef), "SLIDER", + [LSTRING(suppressorCoef_displayName), LSTRING(suppressorCoef_description)], + _category, + [0, 5, 1, 2], + 1, + {}, + true +] call CBA_fnc_addSetting; + [ QGVAR(showParticleEffects), "CHECKBOX", [LSTRING(showParticleEffects_displayName), LSTRING(showParticleEffects_description)], diff --git a/addons/overheating/stringtable.xml b/addons/overheating/stringtable.xml index 1d293c1b20a..63b53d3d39e 100644 --- a/addons/overheating/stringtable.xml +++ b/addons/overheating/stringtable.xml @@ -68,6 +68,12 @@ Coefficient for how quickly a weapon cools down.\nHigher value increases cooling speed. + + Suppressor Coefficient + + + Coefficient for how much additional heat is added from having a suppressor attached.\nHigher value increases heat, 0 means no additional heat from the suppressor. + Display Text on Jam Zeige Text bei Ladehemmung From 132fb6b540b968484acbb29e7bedcae65181acf4 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Wed, 3 Nov 2021 00:29:26 -0700 Subject: [PATCH 19/24] Update fnc_overheat.sqf --- addons/overheating/functions/fnc_overheat.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/overheating/functions/fnc_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf index 2b2e8713397..8c05ec30c96 100644 --- a/addons/overheating/functions/fnc_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -51,7 +51,7 @@ private _suppressor = switch (_weapon) do { case (handgunWeapon _unit) : {(handgunItems _unit) select 0}; default {""}; }; -if (_suppressor != "") then { +if (_suppressor != "" && {GVAR(suppressorCoef) > 0}) then { private _suppressorCoef = GVAR(cacheSilencerData) getVariable _suppressor; if (isNil "_suppressorCoef") then { private _config = configFile >> "CfgWeapons" >> _suppressor >> "ItemInfo" >> "AmmoCoef"; From 69a903fad29d5154dfdda2df0cf496f888ae985b Mon Sep 17 00:00:00 2001 From: Drofseh Date: Fri, 5 Nov 2021 20:08:04 -0700 Subject: [PATCH 20/24] improve fnc_canCoolWeaponWithItem --- .../functions/fnc_canCoolWeaponWithItem.sqf | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf b/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf index 2bec154ba9a..cc561076ccb 100644 --- a/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf +++ b/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf @@ -19,18 +19,7 @@ params ["_player", "_unit"]; TRACE_2("_player, _unit",_player, _unit); -private _return = false; - -if ( - GVAR(enabled) - && {isClass (configfile >> "CfgPatches" >> "acex_field_rations")} - && {[_unit, currentWeapon _unit] call FUNC(getWeaponTemperature) > (ambientTemperature select 0)} -) then { - { - if (getNumber (configFile >> "CfgWeapons" >> _x >> QEXGVAR(field_rations,thirstQuenched)) > 0) exitWith { - _return = true; - }; - } forEach (_player call EFUNC(common,uniqueItems)); -}; - -_return +GVAR(enabled) +&& {isClass (configfile >> "CfgPatches" >> "acex_field_rations")} +&& {[_unit, currentWeapon _unit] call FUNC(getWeaponTemperature) > (ambientTemperature select 0)} +&& {(((_player call EFUNC(common,uniqueItems)) findIf {getNumber (configFile >> "CfgWeapons" >> _x >> QEXGVAR(field_rations,thirstQuenched)) > 0}) != -1} From 8c6ed26909c66c60c13ec895aab3eafc39de635d Mon Sep 17 00:00:00 2001 From: Drofseh Date: Fri, 5 Nov 2021 20:16:43 -0700 Subject: [PATCH 21/24] remove extra ( --- addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf b/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf index cc561076ccb..4228f8f5837 100644 --- a/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf +++ b/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf @@ -22,4 +22,4 @@ TRACE_2("_player, _unit",_player, _unit); GVAR(enabled) && {isClass (configfile >> "CfgPatches" >> "acex_field_rations")} && {[_unit, currentWeapon _unit] call FUNC(getWeaponTemperature) > (ambientTemperature select 0)} -&& {(((_player call EFUNC(common,uniqueItems)) findIf {getNumber (configFile >> "CfgWeapons" >> _x >> QEXGVAR(field_rations,thirstQuenched)) > 0}) != -1} +&& {((_player call EFUNC(common,uniqueItems)) findIf {getNumber (configFile >> "CfgWeapons" >> _x >> QEXGVAR(field_rations,thirstQuenched)) > 0}) != -1} From f82ae7ad32845d8320673c4aac3ada64d8850b6a Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 7 Nov 2021 11:29:26 -0600 Subject: [PATCH 22/24] Move canCoolWeaponWithItem action code to function --- addons/overheating/CfgVehicles.hpp | 4 ++-- .../functions/fnc_canCoolWeaponWithItem.sqf | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/addons/overheating/CfgVehicles.hpp b/addons/overheating/CfgVehicles.hpp index 4f70fa0bf07..e17f030a2b4 100644 --- a/addons/overheating/CfgVehicles.hpp +++ b/addons/overheating/CfgVehicles.hpp @@ -38,7 +38,7 @@ class CfgVehicles { }; class GVAR(CoolWeaponWithItem) { displayName = CSTRING(CoolWeaponWithItem); - condition = QUOTE(GVAR(enabled) && {[ARR_2(_player, _player)] call FUNC(canCoolWeaponWithItem)}); + condition = QUOTE(call FUNC(canCoolWeaponWithItem)); exceptions[] = {"isNotInside", "isNotSwimming", "isNotSitting"}; statement = "true"; showDisabled = 0; @@ -66,7 +66,7 @@ class CfgVehicles { }; class GVAR(CoolWeaponWithItem) { displayName = CSTRING(CoolWeaponWithItem); - condition = 'GVAR(enabled) && {[_player, _target] call FUNC(canCoolWeaponWithItem)} && {!(_target getVariable [QEGVAR(captives,isSurrendering), false])} && {!(_target getVariable [QEGVAR(captives,isHandcuffed), false])}'; + condition = QUOTE(call FUNC(canCoolWeaponWithItem)); exceptions[] = {"isNotInside", "isNotSwimming", "isNotSitting"}; statement = "true"; showDisabled = 0; diff --git a/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf b/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf index 4228f8f5837..ba31bbebc5f 100644 --- a/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf +++ b/addons/overheating/functions/fnc_canCoolWeaponWithItem.sqf @@ -4,22 +4,24 @@ * Return true if the target's weapon can be cooled with an item in the player's inventory * * Arguments: - * 0: Player - * 1: Target + * 0: Target + * 1: Player * * Return Value: * Bool * * Example: - * [bob, joe] call ace_overheating_fnc_canCoolWeaponWithItem + * [cursorObject, player] call ace_overheating_fnc_canCoolWeaponWithItem * * Public: No */ -params ["_player", "_unit"]; -TRACE_2("_player, _unit",_player, _unit); +params ["_unit", "_player"]; +TRACE_2("canCoolWeaponWithItem",_unit,_player); GVAR(enabled) && {isClass (configfile >> "CfgPatches" >> "acex_field_rations")} +&& {!(_unit getVariable [QEGVAR(captives,isSurrendering), false])} // interaction point will overlap with ace_captives +&& {!(_unit getVariable [QEGVAR(captives,isHandcuffed), false])} && {[_unit, currentWeapon _unit] call FUNC(getWeaponTemperature) > (ambientTemperature select 0)} && {((_player call EFUNC(common,uniqueItems)) findIf {getNumber (configFile >> "CfgWeapons" >> _x >> QEXGVAR(field_rations,thirstQuenched)) > 0}) != -1} From 53f408557d0df3d5cca5646253915e208c23e76d Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 7 Nov 2021 11:30:08 -0600 Subject: [PATCH 23/24] Use hashmaps and reset on settings change --- addons/overheating/XEH_postInit.sqf | 6 +++--- .../overheating/functions/fnc_getWeaponData.sqf | 4 ++-- addons/overheating/functions/fnc_overheat.sqf | 8 ++++---- addons/overheating/initSettings.sqf | 16 ++++++++++++---- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/addons/overheating/XEH_postInit.sqf b/addons/overheating/XEH_postInit.sqf index c8ffc8253f3..66bb7bebfd3 100644 --- a/addons/overheating/XEH_postInit.sqf +++ b/addons/overheating/XEH_postInit.sqf @@ -44,9 +44,9 @@ if (hasInterface) then { if !(hasInterface) exitWith {}; - GVAR(cacheWeaponData) = call CBA_fnc_createNamespace; - GVAR(cacheAmmoData) = call CBA_fnc_createNamespace; - GVAR(cacheSilencerData) = call CBA_fnc_createNamespace; + GVAR(cacheWeaponData) = createHashMap; + GVAR(cacheAmmoData) = createHashMap; + GVAR(cacheSilencerData) = createHashMap; //Add Take EH if required if (GVAR(unJamOnReload) || {GVAR(cookoffCoef) > 0}) then { diff --git a/addons/overheating/functions/fnc_getWeaponData.sqf b/addons/overheating/functions/fnc_getWeaponData.sqf index aaa288e6126..2a9dc406b9b 100644 --- a/addons/overheating/functions/fnc_getWeaponData.sqf +++ b/addons/overheating/functions/fnc_getWeaponData.sqf @@ -25,7 +25,7 @@ params ["_weapon"]; // Look in the cache first -private _weaponData = GVAR(cacheWeaponData) getVariable _weapon; +private _weaponData = GVAR(cacheWeaponData) get _weapon; if (!isNil "_weaponData") exitWith {_weaponData}; // Search the config @@ -86,6 +86,6 @@ private _barrelMass = METAL_MASS_RATIO * (getNumber (configFile >> "CfgWeapons" // Cache the values _weaponData = [_dispersion, _slowdownFactor, _jamChance, _modes, _muzzle, _reloadTime, _closedBolt, _barrelMass]; TRACE_2("building cache",_weapon,_weaponData); -GVAR(cacheWeaponData) setVariable [_weapon, _weaponData]; +GVAR(cacheWeaponData) set [_weapon, _weaponData]; _weaponData diff --git a/addons/overheating/functions/fnc_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf index 8c05ec30c96..d63dfe919dc 100644 --- a/addons/overheating/functions/fnc_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -26,7 +26,7 @@ TRACE_4("params",_unit,_weapon,_ammo,_projectile); BEGIN_COUNTER(overheat); // Get bullet parameters -private _energyIncrement = GVAR(cacheAmmoData) getVariable _ammo; +private _energyIncrement = GVAR(cacheAmmoData) get _ammo; if (isNil "_energyIncrement") then { private _bulletMass = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_BulletMass"); if (_bulletMass == 0) then { @@ -40,7 +40,7 @@ if (isNil "_energyIncrement") then { // Multiple by 3 becase we only calc every 3rd bullet: (3 * 1/2 * 0.001) = 0.0015 _energyIncrement = GVAR(heatCoef) * 0.0015 * _bulletMass * (vectorMagnitudeSqr velocity _projectile); - GVAR(cacheAmmoData) setVariable [_ammo, _energyIncrement]; + GVAR(cacheAmmoData) set [_ammo, _energyIncrement]; }; // Increase overheating depending on how obstrusive is the current supressor, @@ -52,11 +52,11 @@ private _suppressor = switch (_weapon) do { default {""}; }; if (_suppressor != "" && {GVAR(suppressorCoef) > 0}) then { - private _suppressorCoef = GVAR(cacheSilencerData) getVariable _suppressor; + private _suppressorCoef = GVAR(cacheSilencerData) get _suppressor; if (isNil "_suppressorCoef") then { private _config = configFile >> "CfgWeapons" >> _suppressor >> "ItemInfo" >> "AmmoCoef"; _suppressorCoef = GVAR(suppressorCoef) * (1 + (1 - getNumber (_config >> "audibleFire")) + (1 - getNumber (_config >> "visibleFire"))); - GVAR(cacheSilencerData) setVariable [_suppressor, _suppressorCoef]; + GVAR(cacheSilencerData) set [_suppressor, _suppressorCoef]; }; _energyIncrement = _energyIncrement * _suppressorCoef; }; diff --git a/addons/overheating/initSettings.sqf b/addons/overheating/initSettings.sqf index 40802bdeab7..b3eaf240298 100644 --- a/addons/overheating/initSettings.sqf +++ b/addons/overheating/initSettings.sqf @@ -16,8 +16,12 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)]; _category, [0, 5, 1, 2], 1, - {}, - true + { + if (!GVAR(enabled)) exitWith {}; + TRACE_2("reseting cache",GVAR(heatCoef),count GVAR(cacheAmmoData)); + GVAR(cacheAmmoData) = createHashMap; + }, + false ] call CBA_fnc_addSetting; [ @@ -36,8 +40,12 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)]; _category, [0, 5, 1, 2], 1, - {}, - true + { + if (!GVAR(enabled)) exitWith {}; + TRACE_2("reseting cache",GVAR(suppressorCoef),count GVAR(cacheSilencerData)); + GVAR(cacheSilencerData) = createHashMap; + }, + false ] call CBA_fnc_addSetting; [ From e80765032846d7eb657c68bef7e7b4dcb423cff2 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Sun, 7 Nov 2021 18:51:16 -0800 Subject: [PATCH 24/24] Apply suggestions from code review Co-authored-by: jonpas --- addons/overheating/functions/fnc_getAmmoTemperature.sqf | 4 ++-- addons/overheating/functions/fnc_getWeaponTemperature.sqf | 2 +- addons/overheating/functions/fnc_setAmmoTemperature.sqf | 2 -- addons/overheating/functions/fnc_setWeaponTemperature.sqf | 2 -- docs/wiki/feature/overheating.md | 2 +- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/addons/overheating/functions/fnc_getAmmoTemperature.sqf b/addons/overheating/functions/fnc_getAmmoTemperature.sqf index 01499d0ea55..98553351013 100644 --- a/addons/overheating/functions/fnc_getAmmoTemperature.sqf +++ b/addons/overheating/functions/fnc_getAmmoTemperature.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: drofseh - * Get current temperaure of weapon's ammo. + * Get current temperature of weapon's ammo. * * Arguments: * 0: Unit @@ -20,4 +20,4 @@ params ["_unit", "_weapon"]; private _ammoTempVarName = format [QGVAR(%1_ammoTemp), _weapon]; -_unit getVariable [_ammoTempVarName, ambientTemperature select 0]; +_unit getVariable [_ammoTempVarName, ambientTemperature select 0] diff --git a/addons/overheating/functions/fnc_getWeaponTemperature.sqf b/addons/overheating/functions/fnc_getWeaponTemperature.sqf index f17f14a3fc6..7aa49d9d0b2 100644 --- a/addons/overheating/functions/fnc_getWeaponTemperature.sqf +++ b/addons/overheating/functions/fnc_getWeaponTemperature.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: drofseh - * Get current temperaure of weapon. + * Get current temperature of weapon. * * Arguments: * 0: Unit diff --git a/addons/overheating/functions/fnc_setAmmoTemperature.sqf b/addons/overheating/functions/fnc_setAmmoTemperature.sqf index 43794f97ac5..b999d609ac6 100644 --- a/addons/overheating/functions/fnc_setAmmoTemperature.sqf +++ b/addons/overheating/functions/fnc_setAmmoTemperature.sqf @@ -22,5 +22,3 @@ params ["_unit", "_weapon", "_temp"]; private _ammoTempVarName = format [QGVAR(%1_ammoTemp), _weapon]; _unit setVariable [_ammoTempVarName, _temp]; - -nil diff --git a/addons/overheating/functions/fnc_setWeaponTemperature.sqf b/addons/overheating/functions/fnc_setWeaponTemperature.sqf index 5fb738f5b0f..06e183f91f0 100644 --- a/addons/overheating/functions/fnc_setWeaponTemperature.sqf +++ b/addons/overheating/functions/fnc_setWeaponTemperature.sqf @@ -22,5 +22,3 @@ params ["_unit", "_weapon", "_temp"]; private _ammoTempVarName = format [QGVAR(%1_ammoTemp), _weapon]; _unit setVariable [_ammoTempVarName, _temp]; - -nil diff --git a/docs/wiki/feature/overheating.md b/docs/wiki/feature/overheating.md index 39628856a37..eaad8357a54 100644 --- a/docs/wiki/feature/overheating.md +++ b/docs/wiki/feature/overheating.md @@ -53,7 +53,7 @@ Jams can be cleared in the following ways: - Select `Equipment`. - Select `Check weapon temperature`. -**NOTE** Each section on the bar represents 100°c. When the bar reaches 2 sections weapons can start to cookoff. When it is half full (yellow) it means the barrel is around 500°c. Your weapon will be even more prone to jams, and it'll get worse if you don't let the barrel cool down or swap it. +**NOTE** Each section on the bar represents 100°C. When the bar reaches 2 sections weapons can start to cookoff. When it is half full (yellow) it means the barrel is around 500°C. Your weapon will be even more prone to jams, and it'll get worse if you don't let the barrel cool down or swap it. ### 2.4 Cooling your weapon