2016-07-15 10:23:26 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
GVAR(target) = objNull;
|
|
|
|
GVAR(previousTarget) = objNull;
|
|
|
|
GVAR(selectedBodyPart) = 0;
|
|
|
|
GVAR(selectedCategory) = "triage";
|
|
|
|
|
2016-07-15 10:23:26 +00:00
|
|
|
GVAR(lastOpenedOn) = -1;
|
|
|
|
GVAR(pendingReopen) = false;
|
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
GVAR(menuPFH) = -1;
|
|
|
|
|
2023-10-08 21:34:51 +00:00
|
|
|
GVAR(peekLastOpenedOn) = -1;
|
2023-10-09 17:57:47 +00:00
|
|
|
GVAR(peekOnHitLastOpenedOn) = -1;
|
2023-10-08 21:34:51 +00:00
|
|
|
|
2019-04-01 14:40:02 +00:00
|
|
|
GVAR(selfInteractionActions) = [];
|
2019-03-24 22:17:48 +00:00
|
|
|
[] call FUNC(addTreatmentActions);
|
|
|
|
[] call FUNC(collectActions);
|
2016-09-21 12:36:00 +00:00
|
|
|
|
2019-04-01 14:40:02 +00:00
|
|
|
[QEGVAR(interact_menu,newControllableObject), {
|
|
|
|
params ["_type"]; // string of the object's classname
|
|
|
|
if (!(_type isKindOf "CAManBase")) exitWith {};
|
|
|
|
{
|
|
|
|
_x set [0, _type];
|
|
|
|
_x call EFUNC(interact_menu,addActionToClass);
|
|
|
|
} forEach GVAR(selfInteractionActions);
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2016-07-15 10:23:26 +00:00
|
|
|
["ace_treatmentSucceded", {
|
|
|
|
if (GVAR(openAfterTreatment) && {GVAR(pendingReopen)}) then {
|
|
|
|
GVAR(pendingReopen) = false;
|
2019-03-24 22:17:48 +00:00
|
|
|
[FUNC(openMenu), GVAR(target)] call CBA_fnc_execNextFrame;
|
2016-07-15 10:23:26 +00:00
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
["ACE3 Common", QGVAR(openMedicalMenuKey), localize LSTRING(OpenMedicalMenu), {
|
2021-10-11 08:29:09 +00:00
|
|
|
// Get target (cursorTarget, cursorObject, and lineIntersectsSurfaces along camera to maxDistance), if not valid then target is ACE_player
|
2019-03-24 22:17:48 +00:00
|
|
|
TRACE_3("Open menu key",cursorTarget,cursorObject,ACE_player);
|
2016-07-15 10:23:26 +00:00
|
|
|
private _target = cursorTarget;
|
2019-03-24 22:17:48 +00:00
|
|
|
if !(_target isKindOf "CAManBase" && {[ACE_player, _target] call FUNC(canOpenMenu)}) then {
|
|
|
|
_target = cursorObject;
|
|
|
|
if !(_target isKindOf "CAManBase" && {[ACE_player, _target] call FUNC(canOpenMenu)}) then {
|
2021-10-11 08:29:09 +00:00
|
|
|
private _start = AGLToASL positionCameraToWorld [0, 0, 0];
|
|
|
|
private _end = AGLToASL positionCameraToWorld [0, 0, GVAR(maxDistance)];
|
|
|
|
private _intersections = lineIntersectsSurfaces [_start, _end, ACE_player, objNull, true, -1, "FIRE"];
|
|
|
|
{
|
|
|
|
_x params ["", "", "_intersectObject"];
|
|
|
|
// Only look "through" player and player's vehicle
|
|
|
|
if (!(_intersectObject isKindOf "CAManBase") && {_intersectObject != vehicle ACE_player}) exitWith {};
|
|
|
|
if (_intersectObject != ACE_player && {_intersectObject isKindOf "CAManBase" && {[ACE_player, _intersectObject] call FUNC(canOpenMenu)}}) exitWith {
|
|
|
|
_target =_intersectObject
|
|
|
|
};
|
|
|
|
} forEach _intersections;
|
|
|
|
if (!(_target isKindOf "CAManBase") || {!([ACE_player, _target] call FUNC(canOpenMenu))}) then {
|
|
|
|
_target = ACE_player;
|
|
|
|
};
|
2019-03-24 22:17:48 +00:00
|
|
|
};
|
|
|
|
};
|
2016-07-15 10:23:26 +00:00
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
// Check conditions: canInteract and canOpenMenu
|
2017-08-22 18:30:56 +00:00
|
|
|
if !([ACE_player, _target, ["isNotInside", "isNotSwimming"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
2016-07-15 10:23:26 +00:00
|
|
|
if !([ACE_player, _target] call FUNC(canOpenMenu)) exitWith {false};
|
|
|
|
|
|
|
|
// Statement
|
|
|
|
[_target] call FUNC(openMenu);
|
|
|
|
false
|
2016-09-21 12:36:00 +00:00
|
|
|
}, {
|
2019-03-24 22:17:48 +00:00
|
|
|
// Close menu if enough time passed from opening
|
2016-07-15 10:23:26 +00:00
|
|
|
if (CBA_missionTime - GVAR(lastOpenedOn) > 0.5) exitWith {
|
|
|
|
[objNull] call FUNC(openMenu);
|
|
|
|
};
|
|
|
|
false
|
2019-03-24 22:17:48 +00:00
|
|
|
}, [DIK_H, [false, false, false]], false, 0] call CBA_fnc_addKeybind;
|
2018-05-08 13:45:24 +00:00
|
|
|
|
2023-10-08 21:34:51 +00:00
|
|
|
["ACE3 Common", QGVAR(peekMedicalInfoKey), localize LSTRING(PeekMedicalInfo),
|
|
|
|
{
|
|
|
|
// Conditions: canInteract
|
|
|
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
|
|
|
|
|
|
// Statement
|
2023-10-23 23:47:06 +00:00
|
|
|
[ACE_player, -1] call FUNC(displayPatientInformation);
|
2023-10-08 21:34:51 +00:00
|
|
|
false
|
|
|
|
}, {
|
|
|
|
if (CBA_missionTime - GVAR(peekLastOpenedOn) > GVAR(peekMedicalInfoReleaseDelay)) then {
|
|
|
|
[{
|
|
|
|
CBA_missionTime - GVAR(peekLastOpenedOn) > GVAR(peekMedicalInfoReleaseDelay)
|
|
|
|
}, {QGVAR(RscPatientInfo) cutFadeOut 0.3}] call CBA_fnc_waitUntilAndExecute;
|
|
|
|
};
|
|
|
|
GVAR(peekLastOpenedOn) = CBA_missionTime;
|
|
|
|
false
|
|
|
|
}, [DIK_H, [false, true, false]], false, 0] call CBA_fnc_addKeybind;
|
|
|
|
|
2018-05-08 13:45:24 +00:00
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
// Close patient information display when interaction menu is closed
|
|
|
|
["ace_interactMenuClosed", {
|
|
|
|
QGVAR(RscPatientInfo) cutFadeOut 0.3;
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
2023-10-09 17:57:47 +00:00
|
|
|
|
|
|
|
[QEGVAR(medical,woundReceived), {
|
|
|
|
params ["_unit", "_allDamages", ""];
|
|
|
|
if !(GVAR(peekMedicalOnHit) && {_unit == ACE_player}) exitWith {};
|
|
|
|
|
2024-03-07 21:08:13 +00:00
|
|
|
private _bodypart = toLowerANSI (_allDamages select 0 select 1);
|
2023-10-09 17:57:47 +00:00
|
|
|
private _bodypartIndex = ALL_BODY_PARTS find _bodypart;
|
|
|
|
|
|
|
|
[ACE_player, _bodypartIndex] call FUNC(displayPatientInformation);
|
|
|
|
|
|
|
|
if (CBA_missionTime - GVAR(peekOnHitLastOpenedOn) > GVAR(peekMedicalOnHitDuration)) then {
|
|
|
|
[{
|
|
|
|
CBA_missionTime - GVAR(peekOnHitLastOpenedOn) > GVAR(peekMedicalOnHitDuration)
|
|
|
|
}, {QGVAR(RscPatientInfo) cutFadeOut 0.3}] call CBA_fnc_waitUntilAndExecute;
|
|
|
|
};
|
|
|
|
GVAR(peekOnHitLastOpenedOn) = CBA_missionTime;
|
|
|
|
}] call CBA_fnc_addEventHandler;
|