2015-08-06 21:51:17 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Handle medical menu opened
|
2015-08-02 14:56:27 +00:00
|
|
|
*
|
2015-08-06 21:51:17 +00:00
|
|
|
* Arguments:
|
2015-08-07 03:37:41 +00:00
|
|
|
* 0: Medical Menu display <DISPLAY>
|
2015-08-06 21:51:17 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-07 03:37:41 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-10-13 07:01:59 +00:00
|
|
|
* [medical_menu] call ace_medical_menu_fnc_onMenuOpen
|
2015-08-06 21:51:17 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
2015-08-02 14:56:27 +00:00
|
|
|
*/
|
2015-08-07 03:37:41 +00:00
|
|
|
#include "script_component.hpp"
|
2015-08-09 07:14:42 +00:00
|
|
|
#define MAX_DISTANCE 10
|
2015-08-02 14:56:27 +00:00
|
|
|
|
2015-08-07 03:37:41 +00:00
|
|
|
private "_target";
|
2015-08-06 21:51:17 +00:00
|
|
|
|
2015-08-07 03:37:41 +00:00
|
|
|
params ["_display"];
|
|
|
|
|
2015-11-30 16:14:05 +00:00
|
|
|
if (isNil "_display") exitWith {};
|
2015-08-02 14:56:27 +00:00
|
|
|
|
2015-09-05 10:49:23 +00:00
|
|
|
if (EGVAR(interact_menu,menuBackground)==1) then {[QGVAR(id), true] call EFUNC(common,blurScreen);};
|
|
|
|
if (EGVAR(interact_menu,menuBackground)==2) then {0 cutRsc[QEGVAR(interact_menu,menuBackground), "PLAIN", 1, false];};
|
|
|
|
|
2015-08-07 03:37:41 +00:00
|
|
|
if (isNil QGVAR(LatestDisplayOptionMenu)) then {
|
2015-08-02 14:56:27 +00:00
|
|
|
GVAR(LatestDisplayOptionMenu) = "triage";
|
|
|
|
} else {
|
|
|
|
if (GVAR(LatestDisplayOptionMenu) == "toggle") then {
|
|
|
|
GVAR(LatestDisplayOptionMenu) = "triage";
|
|
|
|
GVAR(INTERACTION_TARGET) = GVAR(INTERACTION_TARGET_PREVIOUS);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
_target = GVAR(INTERACTION_TARGET);
|
2015-08-07 03:37:41 +00:00
|
|
|
if (isNil QGVAR(INTERACTION_TARGET_PREVIOUS)) then {
|
2015-08-02 14:56:27 +00:00
|
|
|
GVAR(INTERACTION_TARGET_PREVIOUS) = _target;
|
|
|
|
};
|
|
|
|
[GVAR(LatestDisplayOptionMenu)] call FUNC(handleUI_DisplayOptions);
|
|
|
|
|
|
|
|
disableSerialization;
|
2015-08-07 03:37:41 +00:00
|
|
|
|
2015-08-06 21:51:17 +00:00
|
|
|
[_target, _display] call FUNC(updateUIInfo);
|
2015-08-02 14:56:27 +00:00
|
|
|
|
2015-08-07 03:37:41 +00:00
|
|
|
(_display displayCtrl 11) ctrlSetTooltip localize LSTRING(VIEW_TRIAGE_CARD);
|
|
|
|
(_display displayCtrl 12) ctrlSetTooltip localize LSTRING(EXAMINE_PATIENT);
|
|
|
|
(_display displayCtrl 13) ctrlSetTooltip localize LSTRING(BANDAGE_FRACTURES);
|
|
|
|
(_display displayCtrl 14) ctrlSetTooltip localize LSTRING(MEDICATION);
|
|
|
|
(_display displayCtrl 15) ctrlSetTooltip localize LSTRING(AIRWAY_MANAGEMENT);
|
|
|
|
(_display displayCtrl 16) ctrlSetTooltip localize LSTRING(ADVANCED_TREATMENT);
|
|
|
|
(_display displayCtrl 17) ctrlSetTooltip localize LSTRING(DRAG_CARRY);
|
|
|
|
(_display displayCtrl 18) ctrlSetTooltip localize LSTRING(TOGGLE_SELF);
|
2015-08-02 14:56:27 +00:00
|
|
|
|
2015-08-07 03:37:41 +00:00
|
|
|
(_display displayCtrl 301) ctrlSetTooltip localize LSTRING(SELECT_HEAD);
|
|
|
|
(_display displayCtrl 302) ctrlSetTooltip localize LSTRING(SELECT_TORSO);
|
|
|
|
(_display displayCtrl 303) ctrlSetTooltip localize LSTRING(SELECT_ARM_R);
|
|
|
|
(_display displayCtrl 304) ctrlSetTooltip localize LSTRING(SELECT_ARM_L);
|
|
|
|
(_display displayCtrl 305) ctrlSetTooltip localize LSTRING(SELECT_LEG_R);
|
|
|
|
(_display displayCtrl 306) ctrlSetTooltip localize LSTRING(SELECT_LEG_L);
|
|
|
|
(_display displayCtrl 2001) ctrlSetTooltip localize LSTRING(SELECT_TRIAGE_STATUS);
|
2015-08-02 14:56:27 +00:00
|
|
|
|
2015-08-07 03:37:41 +00:00
|
|
|
(_display displayCtrl 1) ctrlSetText format ["%1", [_target] call EFUNC(common,getName)];
|
|
|
|
setMousePosition [0.4, 0.4];
|
2015-08-02 14:56:27 +00:00
|
|
|
|
2015-10-13 07:01:59 +00:00
|
|
|
if (GVAR(MenuPFHID) != -1) exitWith {ERROR("PFID already running");};
|
|
|
|
|
2015-08-22 20:33:15 +00:00
|
|
|
GVAR(MenuPFHID) = [{
|
|
|
|
|
|
|
|
(_this select 0) params ["_display"];
|
2015-08-02 14:56:27 +00:00
|
|
|
if (isNull GVAR(INTERACTION_TARGET)) then {
|
|
|
|
GVAR(INTERACTION_TARGET) = ACE_player;
|
|
|
|
};
|
2015-08-07 03:37:41 +00:00
|
|
|
[GVAR(INTERACTION_TARGET), _display] call FUNC(updateUIInfo);
|
2015-08-02 14:56:27 +00:00
|
|
|
[GVAR(INTERACTION_TARGET)] call FUNC(updateIcons);
|
|
|
|
[GVAR(LatestDisplayOptionMenu)] call FUNC(handleUI_DisplayOptions);
|
|
|
|
|
2015-10-13 07:01:59 +00:00
|
|
|
//Check that it's valid to stay open:
|
2015-12-20 02:50:57 +00:00
|
|
|
if !(([ACE_player, GVAR(INTERACTION_TARGET), ["isNotInside"]] call EFUNC(common,canInteractWith)) && {[ACE_player, GVAR(INTERACTION_TARGET)] call FUNC(canOpenMenu)}) then {
|
2015-08-09 07:14:42 +00:00
|
|
|
closeDialog 314412;
|
2015-10-13 07:01:59 +00:00
|
|
|
//If we failed because of distance check, show UI message:
|
|
|
|
if ((ACE_player distance GVAR(INTERACTION_TARGET)) > GVAR(maxRange)) then {
|
2015-12-20 02:50:57 +00:00
|
|
|
["displayTextStructured", [[ELSTRING(medical,DistanceToFar), [GVAR(INTERACTION_TARGET)] call EFUNC(common,getName)], 2, ACE_player]] call EFUNC(common,localEvent);
|
2015-10-13 07:01:59 +00:00
|
|
|
};
|
2015-08-09 07:14:42 +00:00
|
|
|
};
|
|
|
|
|
2015-08-22 20:33:15 +00:00
|
|
|
}, 0, [_display]] call CBA_fnc_addPerFrameHandler;
|
2015-08-02 14:56:27 +00:00
|
|
|
|
2015-10-13 07:01:59 +00:00
|
|
|
["Medical_onMenuOpen", [ACE_player, _target]] call EFUNC(common,localEvent);
|