mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
56 lines
1.7 KiB
Plaintext
56 lines
1.7 KiB
Plaintext
/*
|
|
* Author: Glowbal
|
|
*
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
params ["_unit"];
|
|
|
|
private ["_magazine", "_data", "_magID", "_unMatchedDevices", "_ownedDevices", "_matchedIDs"];
|
|
|
|
if !(local _unit) exitwith {};
|
|
|
|
{
|
|
[_unit, _x] call FUNC(checkItem);
|
|
} forEach items _unit;
|
|
|
|
_ownedDevices = _unit getvariable [QGVAR(ownedDevices), []];
|
|
_matchedIDs = [];
|
|
{
|
|
_magID = [_x] call FUNC(getMagazineID);
|
|
_data = [_magID] call FUNC(getDeviceData);
|
|
if (count _data > 0) then {
|
|
if !(_magID in _ownedDevices) then {
|
|
systemChat format["validate - new picked up ID: %1 %2", _unit, _magID];
|
|
diag_log format["validate - new picked up ID: %1 %2", _unit, _magID];
|
|
};
|
|
[_magID, _unit] call FUNC(setDeviceOwner);
|
|
_matchedIDs pushback _magID;
|
|
} else {
|
|
if (!(_magId in GVAR(pendingIdAssignmentList))) then {
|
|
_magazine = (magazines _unit) select _forEachIndex;
|
|
if (getText (configFile >> "CfgMagazines" >> _magazine >> QGVAR(type)) != "") then {
|
|
["bft_itemCreated", [_unit, getText (configFile >> "CfgMagazines" >> _magazine >> QGVAR(type)), _magazine, _magID]] call EFUNC(common,serverEvent);
|
|
};
|
|
};
|
|
};
|
|
}foreach (magazinesDetail _unit);
|
|
|
|
_unMatchedDevices = _ownedDevices - _matchedIDs;
|
|
{
|
|
systemChat format["validate - no longer has ID: %1 %2", _unit, _x];
|
|
diag_log format["validate - no longer has ID: %1 %2", _unit, _x];
|
|
["bft_updateDeviceOwner", [_x, objNull]] call EFUNC(common,globalEvent);
|
|
systemChat format["Dropped a bft device: %1 - %2", _unit, _X];
|
|
diag_log format["Dropped a bft device: %1 - %2", _unit, _X];
|
|
} forEach _unMatchedDevices;
|