ACE3/addons/medical_treatment/functions/fnc_canTreat_holsterCheck.sqf
Daniel Lee f4dbe5229e Medical - Option for treatment to require holstering/lowering weapon. (#7063)
* Option for medical treatment to require holstering/lowering weapon, with an option for examine category items to still be available.

* Vehicles cause holster settings to be ignored.

Unsure whether to expand this into it's own setting (disallow all medical in vehicles? only allow if both medic and patient are in the same vehicle? what about people in the back of transports healing those in the cab?), but just going to leave it as is for now.

* Replace !isEqualTo with != in for performance reasons.

Resolves line 33 PR review.

* Merge settings, short circuit

* move logic to new file
2019-10-08 10:44:36 -05:00

28 lines
880 B
Plaintext

#include "script_component.hpp"
/*
* Author: ddm999
* Handle holster settings [disabled, lowered, loweredExam, holster, holsterExam]
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* 2: Treatment Config <CONFIG>
*
* Return Value:
* Can Treat <BOOL>
*
* Example:
* [player, cursorObject, cfg] call ace_medical_treatment_fnc_canTreat_holsterCheck
*
* Public: No
*/
params ["_medic", "_patient", "_config"];
GVAR(holsterRequired) == 0
|| {vehicle _medic != _medic} // medic is in a vehicle, so weapon is considered holstered
|| {vehicle _patient != _patient} // patient is in a vehicle, ^
|| {(GVAR(holsterRequired) in [2,4]) && {getText (_config >> "category") == "examine"}} // if examine bypass is on
|| {currentWeapon _medic isEqualTo ""} // weapon is holstered
|| {(GVAR(holsterRequired) <= 2) && {weaponLowered _medic}} // if just lowered is allowed