2018-07-30 09:22:14 +00:00
|
|
|
#include "script_component.hpp"
|
2016-07-15 10:23:47 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Check if the item is present between the patient and the medic
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Medic <OBJECT>
|
|
|
|
* 1: Patient <OBJECT>
|
|
|
|
* 2: Item <STRING>
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Return Value:
|
2016-09-29 17:31:48 +00:00
|
|
|
* Has the items <BOOL>
|
2016-07-15 10:23:47 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
2019-03-30 16:07:54 +00:00
|
|
|
* [bob, patient, "bandage"] call ace_medical_treatment_fnc_hasItem
|
2015-02-21 23:34:16 +00:00
|
|
|
*
|
2019-03-30 16:07:54 +00:00
|
|
|
* Public: No
|
2016-07-15 10:23:47 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_medic", "_patient", "_item"];
|
|
|
|
|
|
|
|
if (isNil QEGVAR(medical,setting_allowSharedEquipment)) then {
|
|
|
|
EGVAR(medical,setting_allowSharedEquipment) = true;
|
|
|
|
};
|
2016-09-29 17:31:48 +00:00
|
|
|
|
2016-07-15 10:23:47 +00:00
|
|
|
if (EGVAR(medical,setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitWith {
|
|
|
|
true
|
|
|
|
};
|
|
|
|
|
|
|
|
if ([_medic, _item] call EFUNC(common,hasItem)) exitWith {
|
|
|
|
true
|
|
|
|
};
|
|
|
|
|
2018-07-29 21:43:14 +00:00
|
|
|
private _hasItem = false;
|
2016-09-29 17:31:48 +00:00
|
|
|
|
2018-07-18 10:09:48 +00:00
|
|
|
if (vehicle _medic != _medic && {vehicle _medic call FUNC(isMedicalVehicle)}) then {
|
2016-07-15 10:23:47 +00:00
|
|
|
{
|
2016-09-29 17:31:48 +00:00
|
|
|
if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {[_x, _item] call EFUNC(common,hasItem)}) exitWith {
|
2018-07-29 21:43:14 +00:00
|
|
|
_hasItem = true;
|
2016-07-15 10:23:47 +00:00
|
|
|
};
|
2016-09-29 17:31:48 +00:00
|
|
|
} forEach crew vehicle _medic;
|
2016-07-15 10:23:47 +00:00
|
|
|
};
|
|
|
|
|
2018-07-29 21:43:14 +00:00
|
|
|
_hasItem
|