mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical - Add treating with items from vehicle inventory (#9286)
* allow pulling items from vehicle inventory * use vehicle items first
This commit is contained in:
parent
938f421ac3
commit
aa107ed517
@ -4,6 +4,7 @@
|
||||
* 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.
|
||||
* If medic or patient are in a vehicle then vehicle's inventory will also be checked.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Medic <OBJECT>
|
||||
@ -25,6 +26,10 @@ private _fnc_checkItems = {
|
||||
params ["_unit"];
|
||||
|
||||
private _unitItems = _unit call EFUNC(common,uniqueItems);
|
||||
private _unitVehicle = objectParent _unit;
|
||||
if (!isNull _unitVehicle) then {
|
||||
_unitItems append (itemCargo _unitVehicle);
|
||||
};
|
||||
_items findIf {_x in _unitItems} != -1
|
||||
};
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
/*
|
||||
* Author: Glowbal, mharis001
|
||||
* Uses one of the treatment items. Respects the priority defined by the allowSharedEquipment setting.
|
||||
* Can use items from vehicle inventory if either unit is in a vehicle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Medic <OBJECT>
|
||||
@ -25,9 +26,14 @@ private _useOrder = [[_patient, _medic], [_medic, _patient], [_medic]] select GV
|
||||
|
||||
{
|
||||
private _unit = _x;
|
||||
private _unitVehicle = objectParent _unit;
|
||||
private _unitItems = _x call EFUNC(common,uniqueItems);
|
||||
|
||||
{
|
||||
if (!isNull _unitVehicle && {_x in (itemCargo _unitVehicle)}) then {
|
||||
_unitVehicle addItemCargoGlobal [_x, -1];
|
||||
[_unit, _x] breakOut "Main";
|
||||
};
|
||||
if (_x in _unitItems) then {
|
||||
_unit removeItem _x;
|
||||
[_unit, _x] breakOut "Main";
|
||||
|
Loading…
Reference in New Issue
Block a user