34 lines
1.2 KiB
Plaintext
34 lines
1.2 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
// Executed where object is local and removes electronics from inventory
|
|
|
|
params [["_object", objNull, [objNull]]];
|
|
if (isNull _object) exitWith {};
|
|
if (_object isKindOf "CAManBase") exitWith {["Param _object is not a vehicle: %1", _object] call BIS_fnc_error};
|
|
|
|
|
|
// get all items in vehicle that are electronic
|
|
private _vehicleItems = itemCargo _object;
|
|
// filter array to identify electronic items
|
|
_vehicleItems = _vehicleItems select {[_x] call FUNC(isItemElectronic)};
|
|
{
|
|
// remove item from vehicle
|
|
_object addItemCargoGlobal [_x, -1];
|
|
true;
|
|
} count _vehicleItems;
|
|
|
|
{ // forEach everyContainer _object - process vests, uniforms, backpacks in a vehicle
|
|
_x params ["_containerClass", "_containerObject"];
|
|
private _subItemsOfContainer = itemCargo _containerObject;
|
|
// filter array to identify electronic items
|
|
_subItemsOfContainer = _subItemsOfContainer select {[_x] call FUNC(isItemElectronic)};
|
|
{
|
|
// remove item from container
|
|
_subContainer addItemCargoGlobal [_x, -1];
|
|
true;
|
|
} count _subItemsOfContainer;
|
|
} forEach (everyContainer _object);
|
|
|
|
|
|
// vehicle is now empty of electronics
|
|
// built-in vehicle radios cannot be removed and are left in place |