ACE3/addons/overheating/functions/fnc_displayTemperature.sqf
PabstMirror 5ad1f752ca Fix overheating spare barrels
- Remove ACE_SpareBarrel from CfgWeapons as it is now a magazine
- Don't call updateTemperature in displayTemp, as unit may not be local
- Fix targetEvent error
2016-07-03 12:58:40 -05:00

53 lines
1.3 KiB
Plaintext

/*
* Author: Commy2 and esteldunedain
* Displays the weapon temperature
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
*
* Return Values:
* None
*
* Example:
* [player, currentWeapon player] call ace_overheating_fnc_displayTemperature
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_weapon"];
TRACE_2("params",_unit,_weapon);
// Get unit's weapon's temperature:
private _tempVarName = format [QGVAR(%1_temp), _weapon];
private _temperature = _unit getVariable [_tempVarName, 0];
private _scaledTemperature = (_temperature / 1000) min 1;
private _color = [
2 * (_scaledTemperature * 2 min 1) min 1,
2 * (1 - (_scaledTemperature * 2 min 1)) min 1,
00
];
private _count = round (12 * _scaledTemperature);
private _string = "";
for "_a" from 1 to _count do {
_string = _string + "|";
};
private _text = [_string, _color] call EFUNC(common,stringToColoredText);
_string = "";
for "_a" from (_count + 1) to 12 do {
_string = _string + "|";
};
TRACE_3("",_temperature,_color,_string);
_text = composeText [_text, [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText)];
private _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
[_text, _picture] call EFUNC(common,displayTextPicture);