2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-06-13 15:00:56 +00:00
|
|
|
/*
|
2019-06-03 15:31:46 +00:00
|
|
|
* Author: Glowbal, mharis001
|
|
|
|
* Checks if the given treatment can be performed.
|
2016-06-13 15:00:56 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2019-06-03 15:31:46 +00:00
|
|
|
* 0: Medic <OBJECT>
|
|
|
|
* 1: Patient <OBJECT>
|
|
|
|
* 2: Body Part <STRING>
|
|
|
|
* 3: Treatment <STRING>
|
2016-06-13 15:00:56 +00:00
|
|
|
*
|
2019-06-03 15:31:46 +00:00
|
|
|
* Return Value:
|
2016-06-13 15:00:56 +00:00
|
|
|
* Can Treat <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
2019-06-03 15:31:46 +00:00
|
|
|
* [player, cursorObject, "Head", "SurgicalKit"] call ace_medical_treatment_fnc_canTreat
|
2016-06-13 15:00:56 +00:00
|
|
|
*
|
2019-03-30 16:07:54 +00:00
|
|
|
* Public: No
|
2016-06-13 15:00:56 +00:00
|
|
|
*/
|
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
params ["_medic", "_patient", "_bodyPart", "_classname"];
|
2016-06-13 15:00:56 +00:00
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
private _config = configFile >> QGVAR(actions) >> _classname;
|
2016-06-13 15:00:56 +00:00
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
isClass _config
|
|
|
|
&& {_patient isKindOf "CAManBase"}
|
|
|
|
&& {_medic != _patient || {GET_NUMBER_ENTRY(_config >> "allowSelfTreatment") == 1}}
|
|
|
|
&& {[_medic, GET_NUMBER_ENTRY(_config >> "medicRequired")] call FUNC(isMedic)}
|
2019-10-08 15:44:36 +00:00
|
|
|
&& {[_medic, _patient, _config] call FUNC(canTreat_holsterCheck)}
|
2019-06-03 15:31:46 +00:00
|
|
|
&& {
|
|
|
|
private _selections = getArray (_config >> "allowedSelections") apply {toLower _x};
|
|
|
|
"all" in _selections || {_bodyPart in _selections}
|
|
|
|
} && {
|
|
|
|
private _items = getArray (_config >> "items");
|
|
|
|
_items isEqualTo [] || {[_medic, _patient, _items] call FUNC(hasItem)}
|
|
|
|
} && {
|
|
|
|
GET_FUNCTION(_condition,_config >> "condition");
|
2016-06-13 15:00:56 +00:00
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
if (_condition isEqualType {}) then {
|
2019-06-08 10:17:00 +00:00
|
|
|
if (_condition isEqualTo {}) exitWith {
|
|
|
|
_condition = true;
|
|
|
|
};
|
2021-10-30 21:42:03 +00:00
|
|
|
|
2016-09-29 14:00:19 +00:00
|
|
|
_condition = call _condition;
|
2016-06-13 15:00:56 +00:00
|
|
|
};
|
2016-09-29 14:00:19 +00:00
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
_condition
|
|
|
|
} && {
|
|
|
|
switch (GET_NUMBER_ENTRY(_config >> "treatmentLocations")) do {
|
|
|
|
case TREATMENT_LOCATIONS_ALL: {true};
|
|
|
|
case TREATMENT_LOCATIONS_VEHICLES: {
|
|
|
|
IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)}
|
2016-06-13 15:00:56 +00:00
|
|
|
};
|
2019-06-03 15:31:46 +00:00
|
|
|
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};
|
|
|
|
};
|
2023-05-16 05:47:00 +00:00
|
|
|
} && {
|
|
|
|
((getNumber (_config >> "allowedUnderwater")) == 1) || {!([_medic] call ace_common_fnc_isSwimming)}
|
2019-06-03 15:31:46 +00:00
|
|
|
}
|