2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-07-15 10:23:47 +00:00
|
|
|
/*
|
2019-06-03 15:31:46 +00:00
|
|
|
* Author: Glowbal, mharis001
|
|
|
|
* Checks if one of the given items are present between the medic and patient.
|
|
|
|
* Does not respect the priority defined by the allowSharedEquipment setting.
|
|
|
|
* Will check medic first and then patient if shared equipment is allowed.
|
2023-09-05 14:20:56 +00:00
|
|
|
* If medic or patient are in a vehicle then vehicle's inventory will also be checked.
|
2016-07-15 10:23:47 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Medic <OBJECT>
|
|
|
|
* 1: Patient <OBJECT>
|
2019-06-03 15:31:46 +00:00
|
|
|
* 2: Items <ARRAY>
|
2016-07-15 10:23:47 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Return Value:
|
2019-06-03 15:31:46 +00:00
|
|
|
* Has Item <BOOL>
|
2016-07-15 10:23:47 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
2020-04-25 06:41:45 +00:00
|
|
|
* [player, cursorObject, ["ACE_fieldDressing"]] 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
|
|
|
*/
|
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
params ["_medic", "_patient", "_items"];
|
2016-07-15 10:23:47 +00:00
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
private _fnc_checkItems = {
|
|
|
|
params ["_unit"];
|
2016-09-29 17:31:48 +00:00
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
private _unitItems = _unit call EFUNC(common,uniqueItems);
|
2023-09-05 14:20:56 +00:00
|
|
|
private _unitVehicle = objectParent _unit;
|
|
|
|
if (!isNull _unitVehicle) then {
|
|
|
|
_unitItems append (itemCargo _unitVehicle);
|
|
|
|
};
|
2019-06-03 15:31:46 +00:00
|
|
|
_items findIf {_x in _unitItems} != -1
|
2016-07-15 10:23:47 +00:00
|
|
|
};
|
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
_medic call _fnc_checkItems || {GVAR(allowSharedEquipment) != 2 && {_patient call _fnc_checkItems}}
|