2015-01-16 02:36:31 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: Commy2 and esteldunedain
|
2015-01-17 06:13:05 +00:00
|
|
|
* Displays the weapon temperature
|
2015-01-16 02:36:31 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2016-07-03 17:58:40 +00:00
|
|
|
* 0: Unit <OBJECT>
|
2015-02-08 22:54:12 +00:00
|
|
|
* 1: Weapon <STRING>
|
2015-01-16 02:36:31 +00:00
|
|
|
*
|
|
|
|
* Return Values:
|
|
|
|
* None
|
|
|
|
*
|
2015-12-15 07:09:26 +00:00
|
|
|
* Example:
|
|
|
|
* [player, currentWeapon player] call ace_overheating_fnc_displayTemperature
|
|
|
|
*
|
2015-02-08 22:54:12 +00:00
|
|
|
* Public: No
|
2015-01-16 02:36:31 +00:00
|
|
|
*/
|
2015-12-15 07:09:26 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-16 01:00:01 +00:00
|
|
|
|
2016-07-03 17:58:40 +00:00
|
|
|
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];
|
2015-01-16 01:00:01 +00:00
|
|
|
|
2015-12-15 07:09:26 +00:00
|
|
|
private _scaledTemperature = (_temperature / 1000) min 1;
|
2015-01-16 01:00:01 +00:00
|
|
|
|
2015-12-15 07:09:26 +00:00
|
|
|
private _color = [
|
2015-05-11 02:58:32 +00:00
|
|
|
2 * (_scaledTemperature * 2 min 1) min 1,
|
|
|
|
2 * (1 - (_scaledTemperature * 2 min 1)) min 1,
|
2015-04-16 17:12:49 +00:00
|
|
|
00
|
2015-01-16 01:00:01 +00:00
|
|
|
];
|
|
|
|
|
2015-12-15 07:09:26 +00:00
|
|
|
private _count = round (12 * _scaledTemperature);
|
|
|
|
private _string = "";
|
2015-01-16 01:00:01 +00:00
|
|
|
for "_a" from 1 to _count do {
|
2015-04-16 17:12:49 +00:00
|
|
|
_string = _string + "|";
|
2015-01-16 01:00:01 +00:00
|
|
|
};
|
2015-12-15 07:09:26 +00:00
|
|
|
private _text = [_string, _color] call EFUNC(common,stringToColoredText);
|
2015-01-16 01:00:01 +00:00
|
|
|
|
|
|
|
_string = "";
|
|
|
|
for "_a" from (_count + 1) to 12 do {
|
2015-04-16 17:12:49 +00:00
|
|
|
_string = _string + "|";
|
2015-01-16 01:00:01 +00:00
|
|
|
};
|
|
|
|
|
2016-07-03 17:58:40 +00:00
|
|
|
TRACE_3("",_temperature,_color,_string);
|
|
|
|
|
2015-12-15 07:09:26 +00:00
|
|
|
_text = composeText [_text, [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText)];
|
2015-01-16 01:00:01 +00:00
|
|
|
|
2015-12-15 07:09:26 +00:00
|
|
|
private _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
|
2015-01-16 01:00:01 +00:00
|
|
|
|
|
|
|
[_text, _picture] call EFUNC(common,displayTextPicture);
|