|
1 | | -#include "script_component.hpp" |
2 | | -/* |
3 | | - * Author: ACRE2Team |
4 | | - * Draws debug information and hints about attenuation values |
5 | | - * |
6 | | - * Arguments: |
7 | | - * None |
8 | | - * |
9 | | - * Return Value: |
10 | | - * None |
11 | | - * |
12 | | - * Example: |
13 | | - * [] call acre_sys_attenuate_fnc_debugDraw; |
14 | | - * |
15 | | - * Public: No |
16 | | - */ |
17 | | - |
18 | | -private _speakers = allUnits; |
19 | | -private _vehicleSpeakers = (_speakers) select {_x in (crew (vehicle acre_player))}; |
20 | | -private _outsideSpeakers = (_speakers - _vehicleSpeakers); |
21 | | - |
22 | | -private _hintMsg = []; |
23 | | -_hintMsg pushBack "<t align='left' size='1.15' color='#68bbff' font='PuristaMedium'>ACRE Attenuation</t><br/><br />"; |
24 | | - |
25 | | -// Print player's vehicle role and compartment |
26 | | -if (!isNull objectParent acre_player) then { |
27 | | - _hintMsg pushBack "<t align='left' size='1.15' color='#68bbff' font='PuristaMedium'>Vehicle</t><br/>"; |
28 | | - { |
29 | | - _hintMsg pushBack (format ["<t align='left' font='PuristaMedium'>%1</t><t align='right' font='PuristaBold'>%2</t><br/>", |
30 | | - format ["%1 (%2, %3)", name _x select [0, 10], [_x] call CBA_fnc_vehicleRole, [_x] call acre_sys_core_fnc_getCompartment], |
31 | | - ([_x] call acre_sys_attenuate_fnc_getUnitAttenuate) |
32 | | - ]); |
33 | | - } forEach _vehicleSpeakers; |
34 | | -}; |
35 | | - |
36 | | -// Print speakers or outside speakers and their roles |
37 | | -private _fnc_getSpeakerText = { |
38 | | - params ["_unit"]; |
39 | | - |
40 | | - private _name = name _unit select [0, 10]; |
41 | | - if (!isNull objectParent _unit) then { |
42 | | - _name = _name + format[" <t color='#0051a1'>(vehicle, %1)</t>", [_unit] call CBA_fnc_vehicleRole]; |
43 | | - }; |
44 | | - |
45 | | - format ["<t align='left' font='PuristaMedium'>%1</t><t align='right' font='PuristaBold'>%2</t><br/>", |
46 | | - _name, |
47 | | - ([_unit] call acre_sys_attenuate_fnc_getUnitAttenuate) |
48 | | - ] |
49 | | -}; |
50 | | - |
51 | | -if (count _outsideSpeakers > 0) then { |
52 | | - _hintMsg pushBack (format["<t align='left' size='1.15' color='#68bbff' font='PuristaMedium'>%1</t><br/>", ["Outside", "Speakers"] select (isNull objectParent acre_player)]); |
53 | | - { |
54 | | - _hintMsg pushBack ([_x] call _fnc_getSpeakerText); |
55 | | - } forEach _outsideSpeakers; |
56 | | -}; |
57 | | - |
58 | | -_hintMsg pushBack "<br/>"; |
59 | | - |
60 | | -// Print vehicle classname and compartment config values |
61 | | -private _type = typeOf (vehicle acre_player); |
62 | | -private _config = configFile >> "CfgVehicles" >> (typeOf (vehicle acre_player)); |
63 | | -private _compartments = ["Compartment1","Compartment2","Compartment3","Compartment4"] apply { |
64 | | - ["", _x] select (isClass (_config >> "ACRE" >> "attenuation" >> _x)) |
65 | | -}; |
66 | | -_compartments = _compartments - [""]; |
67 | | - |
68 | | -private _compartmentsCount = count _compartments; |
69 | | -if (_compartmentsCount > 0) then { |
70 | | - _hintMsg pushBack (format["<t align='left' size='1.15' color='#68bbff' font='PuristaMedium'>%1</t><br/>", _type]); |
71 | | -}; |
72 | | - |
73 | | -{ |
74 | | - private _rootAtt = _x; |
75 | | - private _attConfig = _config >> "ACRE" >> "attenuation" >> _rootAtt; |
76 | | - |
77 | | - _hintMsg pushBack (format ["<t align='left' size='1.15' color='#68bbff' font='PuristaMedium'>%1</t><br/>", _rootAtt]); |
78 | | - |
79 | | - { |
80 | | - private _attenuation = getNumber(_attConfig >> _x); |
81 | | - if (_attenuation > 0) then { |
82 | | - _hintMsg pushBack (format ["<t align='left' font='PuristaMedium'> %1 = %2", _x select [11], _attenuation]); |
83 | | - |
84 | | - if (_forEachIndex == (_compartmentsCount - 1)) then { |
85 | | - _hintMsg pushBack "</t>"; |
86 | | - } else { |
87 | | - _hintMsg pushBack " | </t>"; |
88 | | - }; |
89 | | - }; |
90 | | - } forEach _compartments; |
91 | | - _hintMsg pushBack "<br/>"; |
92 | | -} forEach _compartments; |
93 | | - |
94 | | -_compartmentsTurnedOut = ["Compartment1","Compartment2","Compartment3","Compartment4"] apply { |
95 | | - ["", _x] select (isClass (_config >> "ACRE" >> "attenuationTurnedOut" >> _x)) |
96 | | -}; |
97 | | -_compartmentsTurnedOut = _compartmentsTurnedOut - [""]; |
98 | | - |
99 | | -private _compartmentsTurnedOutCount = count _compartmentsTurnedOut; |
100 | | -if (_compartmentsTurnedOutCount > 0) then { |
101 | | - _hintMsg pushBack (format ["<t align='left' size='1.15' color='#0051a1' font='PuristaMedium'>%1</t><br/>", "Turned Out"]); |
102 | | -}; |
103 | | - |
104 | | -{ |
105 | | - private _rootAtt = _x; |
106 | | - private _attConfig = _config >> "ACRE" >> "attenuationTurnedOut" >> _rootAtt; |
107 | | - |
108 | | - _hintMsg pushBack (format ["<t align='left' size='1.15' color='#68bbff' font='PuristaMedium'>%1</t><br/>", _x]); |
109 | | - |
110 | | - { |
111 | | - private _attenuation = getNumber(_attConfig >> _x); |
112 | | - if (_attenuation > 0) then { |
113 | | - _hintMsg pushBack (format ["<t align='left' font='PuristaMedium'> %1 = %2", _x select [11], _attenuation]); |
114 | | - |
115 | | - if (_forEachIndex == (_compartmentsCount - 1)) then { |
116 | | - _hintMsg pushBack "</t>"; |
117 | | - } else { |
118 | | - _hintMsg pushBack " | </t>"; |
119 | | - }; |
120 | | - }; |
121 | | - } forEach _compartmentsTurnedOut; |
122 | | - _hintMsg pushBack "<br/>"; |
123 | | -} forEach _compartmentsTurnedOut; |
124 | | - |
125 | | -hintSilent parseText (_hintMsg joinString ""); |
126 | | - |
127 | | -// Draw attenuation values for all speakers |
128 | | -{ |
129 | | - private _dir = (getDir (missionNamespace getVariable ["BIS_DEBUG_CAM", acre_player])) - (getDir _x); |
130 | | - private _atten = [_x] call acre_sys_attenuate_fnc_getUnitAttenuate; |
131 | | - private _color = [0, 1 - _atten, _atten, _atten + .6]; |
132 | | - private _text = format ["%1: %2", (name _x) select [0,10], _atten]; |
133 | | - drawIcon3D ["\a3\ui_f\data\GUI\Cfg\Hints\icon_text\group_1_ca.paa", _color, _x modelToWorldVisual [0,0,0], 1, 1, _dir, _text, 1, 0.04, "RobotoCondensed"]; |
134 | | -} forEach _speakers; |
| 1 | +#include "script_component.hpp" |
| 2 | +/* |
| 3 | + * Author: ACRE2Team |
| 4 | + * Draws debug information and hints about attenuation values |
| 5 | + * |
| 6 | + * Arguments: |
| 7 | + * None |
| 8 | + * |
| 9 | + * Return Value: |
| 10 | + * None |
| 11 | + * |
| 12 | + * Example: |
| 13 | + * [] call acre_sys_attenuate_fnc_debugDraw; |
| 14 | + * |
| 15 | + * Public: No |
| 16 | + */ |
| 17 | + |
| 18 | +private _speakers = allUnits; |
| 19 | +private _vehicleSpeakers = (_speakers) select {_x in (crew (vehicle acre_player))}; |
| 20 | +private _outsideSpeakers = (_speakers - _vehicleSpeakers); |
| 21 | + |
| 22 | +private _hintMsg = []; |
| 23 | +_hintMsg pushBack "<t align='left' size='1.15' color='#68bbff' font='PuristaMedium'>ACRE Attenuation</t><br/><br />"; |
| 24 | + |
| 25 | +// Print player's vehicle role and compartment |
| 26 | +if (!isNull objectParent acre_player) then { |
| 27 | + _hintMsg pushBack "<t align='left' size='1.15' color='#68bbff' font='PuristaMedium'>Vehicle</t><br/>"; |
| 28 | + { |
| 29 | + _hintMsg pushBack (format ["<t align='left' font='PuristaMedium'>%1</t><t align='right' font='PuristaBold'>%2</t><br/>", |
| 30 | + format ["%1 (%2, %3)", name _x select [0, 10], [_x] call CBA_fnc_vehicleRole, [_x] call acre_sys_core_fnc_getCompartment], |
| 31 | + ([_x] call acre_sys_attenuate_fnc_getUnitAttenuate) |
| 32 | + ]); |
| 33 | + } forEach _vehicleSpeakers; |
| 34 | +}; |
| 35 | + |
| 36 | +// Print speakers or outside speakers and their roles |
| 37 | +private _fnc_getSpeakerText = { |
| 38 | + params ["_unit"]; |
| 39 | + |
| 40 | + private _name = name _unit select [0, 10]; |
| 41 | + if (!isNull objectParent _unit) then { |
| 42 | + _name = _name + format[" <t color='#0051a1'>(vehicle, %1)</t>", [_unit] call CBA_fnc_vehicleRole]; |
| 43 | + }; |
| 44 | + |
| 45 | + format ["<t align='left' font='PuristaMedium'>%1</t><t align='right' font='PuristaBold'>%2</t><br/>", |
| 46 | + _name, |
| 47 | + ([_unit] call acre_sys_attenuate_fnc_getUnitAttenuate) |
| 48 | + ] |
| 49 | +}; |
| 50 | + |
| 51 | +if (_outsideSpeakers isNotEqualTo []) then { |
| 52 | + _hintMsg pushBack (format["<t align='left' size='1.15' color='#68bbff' font='PuristaMedium'>%1</t><br/>", ["Outside", "Speakers"] select (isNull objectParent acre_player)]); |
| 53 | + { |
| 54 | + _hintMsg pushBack ([_x] call _fnc_getSpeakerText); |
| 55 | + } forEach _outsideSpeakers; |
| 56 | +}; |
| 57 | + |
| 58 | +_hintMsg pushBack "<br/>"; |
| 59 | + |
| 60 | +// Print vehicle classname and compartment config values |
| 61 | +private _type = typeOf (vehicle acre_player); |
| 62 | +private _config = configOf (vehicle acre_player); |
| 63 | +private _compartments = ["Compartment1","Compartment2","Compartment3","Compartment4"] apply { |
| 64 | + ["", _x] select (isClass (_config >> "ACRE" >> "attenuation" >> _x)) |
| 65 | +}; |
| 66 | +_compartments = _compartments - [""]; |
| 67 | + |
| 68 | +private _compartmentsCount = count _compartments; |
| 69 | +if (_compartmentsCount > 0) then { |
| 70 | + _hintMsg pushBack (format["<t align='left' size='1.15' color='#68bbff' font='PuristaMedium'>%1</t><br/>", _type]); |
| 71 | +}; |
| 72 | + |
| 73 | +{ |
| 74 | + private _rootAtt = _x; |
| 75 | + private _attConfig = _config >> "ACRE" >> "attenuation" >> _rootAtt; |
| 76 | + |
| 77 | + _hintMsg pushBack (format ["<t align='left' size='1.15' color='#68bbff' font='PuristaMedium'>%1</t><br/>", _rootAtt]); |
| 78 | + |
| 79 | + { |
| 80 | + private _attenuation = getNumber(_attConfig >> _x); |
| 81 | + if (_attenuation > 0) then { |
| 82 | + _hintMsg pushBack (format ["<t align='left' font='PuristaMedium'> %1 = %2", _x select [11], _attenuation]); |
| 83 | + |
| 84 | + if (_forEachIndex == (_compartmentsCount - 1)) then { |
| 85 | + _hintMsg pushBack "</t>"; |
| 86 | + } else { |
| 87 | + _hintMsg pushBack " | </t>"; |
| 88 | + }; |
| 89 | + }; |
| 90 | + } forEach _compartments; |
| 91 | + _hintMsg pushBack "<br/>"; |
| 92 | +} forEach _compartments; |
| 93 | + |
| 94 | +_compartmentsTurnedOut = ["Compartment1","Compartment2","Compartment3","Compartment4"] apply { |
| 95 | + ["", _x] select (isClass (_config >> "ACRE" >> "attenuationTurnedOut" >> _x)) |
| 96 | +}; |
| 97 | +_compartmentsTurnedOut = _compartmentsTurnedOut - [""]; |
| 98 | + |
| 99 | +private _compartmentsTurnedOutCount = count _compartmentsTurnedOut; |
| 100 | +if (_compartmentsTurnedOutCount > 0) then { |
| 101 | + _hintMsg pushBack (format ["<t align='left' size='1.15' color='#0051a1' font='PuristaMedium'>%1</t><br/>", "Turned Out"]); |
| 102 | +}; |
| 103 | + |
| 104 | +{ |
| 105 | + private _rootAtt = _x; |
| 106 | + private _attConfig = _config >> "ACRE" >> "attenuationTurnedOut" >> _rootAtt; |
| 107 | + |
| 108 | + _hintMsg pushBack (format ["<t align='left' size='1.15' color='#68bbff' font='PuristaMedium'>%1</t><br/>", _x]); |
| 109 | + |
| 110 | + { |
| 111 | + private _attenuation = getNumber(_attConfig >> _x); |
| 112 | + if (_attenuation > 0) then { |
| 113 | + _hintMsg pushBack (format ["<t align='left' font='PuristaMedium'> %1 = %2", _x select [11], _attenuation]); |
| 114 | + |
| 115 | + if (_forEachIndex == (_compartmentsCount - 1)) then { |
| 116 | + _hintMsg pushBack "</t>"; |
| 117 | + } else { |
| 118 | + _hintMsg pushBack " | </t>"; |
| 119 | + }; |
| 120 | + }; |
| 121 | + } forEach _compartmentsTurnedOut; |
| 122 | + _hintMsg pushBack "<br/>"; |
| 123 | +} forEach _compartmentsTurnedOut; |
| 124 | + |
| 125 | +hintSilent parseText (_hintMsg joinString ""); |
| 126 | + |
| 127 | +// Draw attenuation values for all speakers |
| 128 | +{ |
| 129 | + private _dir = (getDir (missionNamespace getVariable ["BIS_DEBUG_CAM", acre_player])) - (getDir _x); |
| 130 | + private _atten = [_x] call acre_sys_attenuate_fnc_getUnitAttenuate; |
| 131 | + private _color = [0, 1 - _atten, _atten, _atten + .6]; |
| 132 | + private _text = format ["%1: %2", (name _x) select [0,10], _atten]; |
| 133 | + drawIcon3D ["\a3\ui_f\data\GUI\Cfg\Hints\icon_text\group_1_ca.paa", _color, _x modelToWorldVisual [0,0,0], 1, 1, _dir, _text, 1, 0.04, "RobotoCondensed"]; |
| 134 | +} forEach _speakers; |
0 commit comments