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
This commit is contained in:
Daniel Lee 2019-10-08 16:44:36 +01:00 committed by PabstMirror
parent b514541bec
commit f4dbe5229e
5 changed files with 58 additions and 0 deletions

View File

@ -10,6 +10,7 @@ PREP(canSplint);
PREP(canStitch);
PREP(canTreat);
PREP(canTreatCached);
PREP(canTreat_holsterCheck);
PREP(checkBloodPressure);
PREP(checkBloodPressureLocal);
PREP(checkItems);

View File

@ -26,6 +26,7 @@ isClass _config
&& {_patient isKindOf "CAManBase"}
&& {_medic != _patient || {GET_NUMBER_ENTRY(_config >> "allowSelfTreatment") == 1}}
&& {[_medic, GET_NUMBER_ENTRY(_config >> "medicRequired")] call FUNC(isMedic)}
&& {[_medic, _patient, _config] call FUNC(canTreat_holsterCheck)}
&& {
private _selections = getArray (_config >> "allowedSelections") apply {toLower _x};
"all" in _selections || {_bodyPart in _selections}

View File

@ -0,0 +1,27 @@
#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

View File

@ -200,3 +200,14 @@
[-1, 3600, 600, 0],
true
] call CBA_settings_fnc_init;
[
QGVAR(holsterRequired),
"LIST",
[LSTRING(HolsterRequired_DisplayName), LSTRING(HolsterRequired_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)],
[[0, 1, 2, 3, 4], [ELSTRING(common,Disabled), LSTRING(HolsterRequired_Lowered), LSTRING(HolsterRequired_LoweredExam), LSTRING(HolsterRequired_Holstered), LSTRING(HolsterRequired_HolsteredExam)], 0],
true
] call CBA_settings_fnc_init;

View File

@ -426,6 +426,24 @@
<Russian>Техника и госпитали</Russian>
<Portuguese>Veículos e Instalações Médicas</Portuguese>
</Key>
<Key ID="STR_ACE_Medical_Treatment_HolsterRequired_DisplayName">
<English>Holster Required</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_HolsterRequired_Description">
<English>Controls whether weapons must be holstered / lowered in order to perform medical actions.\nExcept Exam - Allows examination actions (checking pulse, blood pressure, response) at all times regardless of Holster Required setting.</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_HolsterRequired_Lowered">
<English>Lowered or Holstered</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_HolsterRequired_LoweredExam">
<English>Lowered or Holstered (Except Exam)</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_HolsterRequired_Holstered">
<English>Holstered only</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_HolsterRequired_HolsteredExam">
<English>Holstered only (Except Exam)</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_medicalSupplyCrate">
<English>[ACE] Medical Supply Crate (Basic)</English>
<Russian>[ACE] Ящик с медикаментами (базовая медицина)</Russian>