From d9dfee0c7bca9fc8adc299c46d7c4108d2020d40 Mon Sep 17 00:00:00 2001 From: Hizumi <33106048+user4752@users.noreply.github.com> Date: Tue, 9 Jan 2024 02:15:53 -0600 Subject: [PATCH] rewrite logic for inventory check --- functions/server/fn_logPlayerInventory.sqf | 30 +++++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/functions/server/fn_logPlayerInventory.sqf b/functions/server/fn_logPlayerInventory.sqf index 3e3f2f8..c63f769 100644 --- a/functions/server/fn_logPlayerInventory.sqf +++ b/functions/server/fn_logPlayerInventory.sqf @@ -3,7 +3,7 @@ params [ ["_player", objNull, [objNull]] ]; -if (!isPlayer _player) exitWith { diag_log("exitWith inventotry")}; +if (!isPlayer _player) exitWith { diag_log("exitWith logPlayerInventory")}; _items = []; _items append uniformItems _player; @@ -13,6 +13,9 @@ _items pushback hmd _player; _items pushback binocular _player; _items append primaryWeaponItems _player; +_noncompliant = []; +_unlisted = []; + { _item = _x; _modes = getArray(configfile >> "CfgWeapons" >> _item >> "visionMode"); @@ -26,15 +29,28 @@ _items append primaryWeaponItems _player; _restrictedItemList = ["A3_GPNVG18b_REC_TI","A3_GPNVG18_REC_TI","A3_GPNVG18b_TI","A3_GPNVG18_TI","A3_GPNVG18b_REC_BLK_TI","A3_GPNVG18_REC_BLK_TI","A3_GPNVG18b_BLK_TI","A3_GPNVG18_BLK_TI","NVGogglesB_gry_F","NVGogglesB_grn_F","NVGogglesB_blk_F","optic_Nightstalker","rhsusf_acc_anpas13gv1","Tier1_ANPVS10_Tan","rhsusf_acc_anpvs27","optic_tws_mg","optic_tws"]; if ( _x in _restrictedItemList ) then { - diag_log text format["[MILSIM] (logPlayerInventory): %1 has a restricted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _item >> "displayName" )]; - } else if ((count _modes) isNotEqualTo 0) then { + _noncompliant pushBackUnique _item; + }; + + if ((count _modes) isNotEqualTo 0) then { _modes = _modes apply { toLower _x }; if ( "ti" in _modes ) then { - diag_log text format["[MILSIM] (logPlayerInventory): %1 has an unlisted thermal item: %2", name _player, getText( configfile >> "CfgWeapons" >> _item >> "displayName" )]; + _unlisted pushBackUnique _item; }; - } else { - diag_log text format["[MILSIM] (logPlayerInventory): %1 inventory in compliance", name _player]; - } + }; + } forEach _items; +{ + diag_log text format["[MILSIM] (logPlayerInventory): %1 has a restricted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; +} forEach _noncompliant; + +{ + diag_log text format["[MILSIM] (logPlayerInventory): %1 has an unlisted thermal item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )]; +} forEach _unlisted; + +if (((count _noncompliant) isEqualTo 0) && ((count _unlisted) isEqualTo 0)) then { + diag_log text format["[MILSIM] (logPlayerInventory): %1 inventory in compliance", name _player]; +}; + nil \ No newline at end of file