2018-09-17 19:19:29 +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
|
2016-05-18 09:57:40 +00:00
|
|
|
private _finalTemp = [_initialTemp, _barrelMass, CBA_missionTime - _initialTime] call FUNC(calculateCooling);
|
2021-10-10 16:55:14 +00:00
|
|
|
TRACE_4("updateSpareBarrelsTemperaturesThread2",_barrelMagazineID,_initialTemp,_finalTemp,_barrelMass);
|
2016-02-27 03:29:30 +00:00
|
|
|
if (_finalTemp < 5) then {
|
|
|
|
// The barrel is cool enough to keep 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;
|