ACE3/addons/medical_treatment/functions/fnc_canTreat.sqf
Grim e06c6f7835
General - Replace toLower with toLowerANSI where applicable (#9790)
* General - Replace toLower with toLowerANSI where applicable

* whoops

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

* Update addons/repair/functions/fnc_setHitPointDamage.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/repair/dev/draw_showRepairInfo.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/tagging/XEH_preStart.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/vehicle_damage/functions/fnc_handleCookoff.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/tagging/XEH_preStart.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* comparment -> compartment

* Update fnc_showHud.sqf

* Update fnc_registerObjects.sqf

* Update addons/common/functions/fnc_cbaSettings_settingChanged.sqf

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2024-03-07 22:08:13 +01:00

77 lines
2.5 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: Glowbal, mharis001
* Checks if the given treatment can be performed.
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* 2: Body Part <STRING>
* 3: Treatment <STRING>
*
* Return Value:
* Can treat <BOOL>
*
* Example:
* [player, cursorObject, "Head", "SurgicalKit"] call ace_medical_treatment_fnc_canTreat
*
* Public: No
*/
params ["_medic", "_patient", "_bodyPart", "_classname"];
private _config = configFile >> QGVAR(actions) >> _classname;
// Conditions that apply, regardless of curator status
(
isClass _config
) && {
_patient isKindOf "CAManBase"
} && {
private _selections = getArray (_config >> "allowedSelections") apply {toLowerANSI _x};
"all" in _selections || {_bodyPart in _selections}
} && {
GET_FUNCTION(_condition,_config >> "condition");
if (_condition isEqualType {}) then {
if (_condition isEqualTo {}) exitWith {
_condition = true;
};
_condition = call _condition;
};
_condition
} && {
// If in Zeus, the rest of the condition checks can be omitted
(_medic isEqualTo player && {!isNull findDisplay 312}) || {
// Conditions that apply when not in Zeus
(
_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 _items = getArray (_config >> "items");
_items isEqualTo [] || {[_medic, _patient, _items] call FUNC(hasItem)}
} && {
switch (GET_NUMBER_ENTRY(_config >> "treatmentLocations")) do {
case TREATMENT_LOCATIONS_ALL: {true};
case TREATMENT_LOCATIONS_VEHICLES: {
IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)}
};
case TREATMENT_LOCATIONS_FACILITIES: {
IN_MED_FACILITY(_medic) || {IN_MED_FACILITY(_patient)}
};
case TREATMENT_LOCATIONS_VEHICLES_AND_FACILITIES: {
IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)} || {IN_MED_FACILITY(_medic)} || {IN_MED_FACILITY(_patient)}
};
default {false};
};
} && {
!(_medic call EFUNC(common,isSwimming)) || {getNumber (_config >> "allowedUnderwater") == 1}
}
}
}