ACE3/addons/medical_gui/functions/fnc_handleToggle.sqf
johnb432 ac9044f2d6
Zeus - Add medical menu module (#9367)
* open medical menu from Zeus

* fix function header

* Zeus can use every action, add room for more buttons in medical menu

* Update addons/medical_treatment/functions/fnc_treatment.sqf

* Added zeus treatment time coeff

* Update addons/medical_gui/functions/fnc_canOpenMenu.sqf

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Update fnc_canOpenMenu.sqf

* Update initSettings.sqf

* Update fnc_moduleMedicalMenu.sqf

* Added check + documentation

* Update fnc_canTreat.sqf

---------

Authored-by: Brett <brett@mayson.io>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-11-20 13:52:29 -08:00

39 lines
866 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: mharis001
* Handles toggling of Medical Menu between the player and previous target.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_medical_gui_fnc_handleToggle
*
* Public: No
*/
// If in Zeus, ignore
if (!isNull findDisplay 312) exitWith {};
// Find new target to switch to
private _target = if (
GVAR(target) == ACE_player
&& {[ACE_player, GVAR(previousTarget)] call EFUNC(common,canInteractWith)}
&& {[ACE_player, GVAR(previousTarget)] call FUNC(canOpenMenu)}
) then {
GVAR(previousTarget);
} else {
ACE_player;
};
// Exit if new target is same as old
if (GVAR(target) == _target) exitWith {};
GVAR(previousTarget) = GVAR(target);
// Close and reopen dialog for new target
closeDialog 0;
[FUNC(openMenu), _target, 0.1] call CBA_fnc_waitAndExecute;