2015-03-10 20:12:35 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Display triage card for a unit
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The unit <OBJECT>
|
2015-08-22 14:25:10 +00:00
|
|
|
* 1: Show <BOOL> (default: true)
|
2015-03-10 20:12:35 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-22 14:25:10 +00:00
|
|
|
* None
|
2015-03-10 20:12:35 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [bob, true] call ace_medical_fnc_displayTriageCard
|
|
|
|
*
|
2015-03-10 20:12:35 +00:00
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-22 14:25:10 +00:00
|
|
|
params ["_target", ["_show", true]];
|
2015-03-10 20:12:35 +00:00
|
|
|
|
|
|
|
GVAR(TriageCardTarget) = if (_show) then {_target} else {ObjNull};
|
|
|
|
|
|
|
|
if (_show) then {
|
|
|
|
//("ACE_MedicalTriageCard" call BIS_fnc_rscLayer) cutRsc [QGVAR(triageCard),"PLAIN"];
|
|
|
|
createDialog QGVAR(triageCard);
|
|
|
|
|
|
|
|
[{
|
2015-08-22 14:25:10 +00:00
|
|
|
params ["_args", "_idPFH"];
|
|
|
|
_args params ["_target"];
|
2015-11-30 16:14:05 +00:00
|
|
|
if (GVAR(TriageCardTarget) != _target) exitWith {
|
2015-08-22 14:25:10 +00:00
|
|
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
2015-03-10 20:12:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
disableSerialization;
|
2016-06-13 12:27:43 +00:00
|
|
|
private _display = uiNamespace getVariable QGVAR(triageCard);
|
2015-11-30 16:22:16 +00:00
|
|
|
if (isNil "_display") exitWith {
|
2015-08-22 14:25:10 +00:00
|
|
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
2015-03-10 20:12:35 +00:00
|
|
|
};
|
|
|
|
|
2016-06-13 12:27:43 +00:00
|
|
|
private _triageCardTexts = [];
|
2015-03-10 20:12:35 +00:00
|
|
|
|
|
|
|
// TODO fill the lb with the appropiate information for the patient
|
2016-06-13 12:27:43 +00:00
|
|
|
private _lbCtrl = (_display displayCtrl 200);
|
2015-03-10 20:12:35 +00:00
|
|
|
lbClear _lbCtrl;
|
|
|
|
|
2016-06-13 12:27:43 +00:00
|
|
|
private _log = _target getVariable [QGVAR(triageCard), []];
|
2015-03-10 20:12:35 +00:00
|
|
|
{
|
2015-08-22 14:25:10 +00:00
|
|
|
_x params ["_item", "_amount"];
|
2016-06-13 12:27:43 +00:00
|
|
|
private _message = _item;
|
2015-04-05 20:07:38 +00:00
|
|
|
if (isClass(configFile >> "CfgWeapons" >> _item)) then {
|
|
|
|
_message = getText(configFile >> "CfgWeapons" >> _item >> "DisplayName");
|
|
|
|
} else {
|
|
|
|
if (isLocalized _message) then {
|
|
|
|
_message = localize _message;
|
2015-03-10 20:12:35 +00:00
|
|
|
};
|
2015-04-05 20:07:38 +00:00
|
|
|
};
|
2015-11-30 16:21:28 +00:00
|
|
|
_triageCardTexts pushBack format["%1x - %2", _amount, _message];
|
2015-11-30 16:23:48 +00:00
|
|
|
} forEach _log;
|
2015-03-10 20:12:35 +00:00
|
|
|
|
|
|
|
if (count _triageCardTexts == 0) then {
|
2015-05-28 19:59:04 +00:00
|
|
|
_lbCtrl lbAdd (localize LSTRING(TriageCard_NoEntry));
|
2015-03-10 20:12:35 +00:00
|
|
|
};
|
2015-04-05 20:07:38 +00:00
|
|
|
{
|
|
|
|
_lbCtrl lbAdd _x;
|
2015-11-30 16:23:48 +00:00
|
|
|
} forEach _triageCardTexts;
|
2015-03-10 20:12:35 +00:00
|
|
|
|
2016-06-13 12:27:43 +00:00
|
|
|
private _triageStatus = [_target] call FUNC(getTriageStatus);
|
2015-09-03 16:30:29 +00:00
|
|
|
_triageStatus params ["_text", "", "_color"];
|
2015-08-22 14:25:10 +00:00
|
|
|
|
|
|
|
(_display displayCtrl 2000) ctrlSetText _text;
|
|
|
|
(_display displayCtrl 2000) ctrlSetBackgroundColor _color;
|
2015-03-10 20:12:35 +00:00
|
|
|
|
|
|
|
}, 0, [_target]] call CBA_fnc_addPerFrameHandler;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
//("ACE_MedicalTriageCard" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
|
|
|
|
closeDialog 7010;
|
|
|
|
};
|