-
Notifications
You must be signed in to change notification settings - Fork 749
Expand file tree
/
Copy pathfnc_sendSpareBarrelsTemperaturesHint.sqf
More file actions
84 lines (79 loc) · 2.57 KB
/
fnc_sendSpareBarrelsTemperaturesHint.sqf
File metadata and controls
84 lines (79 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "..\script_component.hpp"
/*
* Author: esteldunedain
* Collect the temperature of all the spare barrels a unit has and send a hint
* to a client. Runs on the server.
*
* Arguments:
* 0: Target unit of the hint <OBJECT>
* 1: Unit that has the spare barrels <STRING>
*
* Return Value:
* None
*
* Example:
* [bob, "bob"] call ace_overheating_fnc_sendSpareBarrelsTemperaturesHint
*
*
* Public: No
*/
params ["_player","_unit"];
// Find all spare barrel the player has
TRACE_2("sendSpareBarrelsTemperatureHunt",_player,_unit);
//Get the weapon of the target unit
private _weapon = currentWeapon _player;
//Get the classname of the spare barrel of that weapon
private _weaponBarrelClass = getText (configFile >> 'CfgWeapons' >> _weapon >> QGVAR(barrelClassname));
//If the weapon has no defined classname then use the ACE one
if (_weaponBarrelClass == "") then {
_weaponBarrelClass = "ACE_SpareBarrel";
};
private _allBarrels = [_unit, _weaponBarrelClass] call CBA_fnc_getMagazineIndex;
TRACE_1("_allBarrels",_allBarrels);
if (_allBarrels isEqualTo []) exitWith {};
// Determine the temp of each barrel
private _temps = [];
{
private _temp = GVAR(storedSpareBarrels) getOrDefault [_x, [0]] select 0;
_temps pushBack _temp;
} forEach _allBarrels;
TRACE_1("_temps",_temps);
// Count cool
private _countCool = {_x < 20} count _temps;
private _countWarm = {(_x >= 20) && (_x < 100)} count _temps;
private _countHot = {(_x >= 100) && (_x < 200)} count _temps;
private _countVeryHot = {(_x >= 200) && (_x < 600)} count _temps;
private _countExtremelyHot = {_x >= 600} count _temps;
private _output = ["%1 %2%3%4 %5%6%7 %8%9%10 %11%12%13 %14"];
private _size = 1.0;
if (_countCool > 0) then {
_output pushBack _countCool;
_output pushBack LSTRING(BarrelCool);
_output pushBack "<br/>";
_size = _size + 0.5;
};
if (_countWarm > 0) then {
_output pushBack _countWarm;
_output pushBack LSTRING(BarrelWarm);
_output pushBack "<br/>";
_size = _size + 0.5;
};
if (_countHot > 0) then {
_output pushBack _countHot;
_output pushBack LSTRING(BarrelHot);
_output pushBack "<br/>";
_size = _size + 0.5;
};
if (_countVeryHot > 0) then {
_output pushBack _countVeryHot;
_output pushBack LSTRING(BarrelVeryHot);
_output pushBack "<br/>";
_size = _size + 0.5;
};
if (_countExtremelyHot > 0) then {
_output pushBack _countExtremelyHot;
_output pushBack LSTRING(BarrelExtremelyHot);
_size = _size + 0.5;
};
TRACE_1("_output",_output);
[QEGVAR(common,displayTextStructured), [_output, _size, _player], [_player]] call CBA_fnc_targetEvent;