ACE3/addons/overheating/functions/fnc_displayTemperature.sqf

49 lines
1.2 KiB
Plaintext
Raw Normal View History

2015-01-16 02:36:31 +00:00
/*
2015-03-24 04:18:00 +00:00
* Author: Commy2 and esteldunedain
* Displays the weapon temperature
2015-01-16 02:36:31 +00:00
*
* Arguments:
2015-02-08 22:54:12 +00:00
* 0: Player <OBJECT>
* 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
2015-12-15 07:09:26 +00:00
params ["_player", "_weapon"];
TRACE_2("params",_player,_weapon);
2015-01-16 01:00:01 +00:00
// Calculate cool down of weapon since last shot
2015-12-15 07:09:26 +00:00
private _temperature = [_player, _weapon, 0] call FUNC(updateTemperature);
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
};
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);