2023-09-12 18:58:10 +00:00
#include "..\script_component.hpp"
2016-02-27 03:29:30 +00:00
/*
* Author: esteldunedain
* Calculate cooldown of all the stored spare barrels.
*
2016-06-18 09:50:41 +00:00
* Arguments:
2016-02-27 03:29:30 +00:00
* None
*
2016-06-18 09:50:41 +00:00
* Return Value:
2016-02-27 03:29:30 +00:00
* None
*
* Example:
* [] call ace_overheating_fnc_updateSpareBarrelsTemperaturesThread
*
* Public: No
*/
TRACE_1("updateSpareBarrelsTemperaturesThread1",GVAR(storedSpareBarrels));
{
2021-10-10 16:55:14 +00:00
_y params ["_initialTemp","_initialTime", "_barrelMass"];
2016-02-27 03:29:30 +00:00
// Calculate cooling
2024-03-06 17:45:41 +00:00
private _finalTemp = [_initialTemp, _barrelMass, CBA_missionTime - _initialTime, 0] call FUNC(calculateCooling); //the zero is to indicate an open bolt gun. Barrel is outside of a gun here, so always open.
2021-10-10 16:55:14 +00:00
TRACE_4("updateSpareBarrelsTemperaturesThread2",_barrelMagazineID,_initialTemp,_finalTemp,_barrelMass);
2024-03-06 17:45:41 +00:00
if (_finalTemp <= (ambientTemperature select 0)) then {
// The barrel is cool enough to finish calculating. Remove it from the hash
2021-10-10 16:55:14 +00:00
GVAR(storedSpareBarrels) deleteAt _x;
2016-02-27 03:29:30 +00:00
} else {
// Store the new temp
2021-10-10 16:55:14 +00:00
GVAR(storedSpareBarrels) set [_x, [_finalTemp, CBA_missionTime, _barrelMass]];
2016-02-27 03:29:30 +00:00
};
2021-10-10 16:55:14 +00:00
} forEach GVAR(storedSpareBarrels);
2016-02-27 03:29:30 +00:00
// Schedule for execution again after 10 seconds
2016-05-22 13:27:24 +00:00
[DFUNC(updateSpareBarrelsTemperaturesThread), [], 10] call CBA_fnc_waitAndExecute;