change logPlayerInventory to return lines, which handlers send to CBA ev

This commit is contained in:
2024-01-29 13:48:35 -08:00
parent f77e418ac8
commit cada98e15a
4 changed files with 46 additions and 11 deletions

View File

@@ -1,9 +1,25 @@
/*
Function: milsim_fnc_logPlayerInventory
Description:
Checks a player's inventory for non-compliant items and logs results to all machines.
Author: Hizumi, EagleTrooper, IndigoFox
Parameters:
0: _player - <OBJECT> - Player to check inventory of.
Returns:
<ARRAY> - Array of strings to be logged.
*/
params [
["_player", objNull, [objNull]]
];
if (!isPlayer _player) exitWith { diag_log("exitWith logPlayerInventory")};
if (!isPlayer _player) exitWith {
["[MILSIM] (logPlayerInventory): ERROR :: _player is not a player"]
};
// DEFINITIONS
_blackListItems = [ // Items that NO member is allowed to use.
@@ -206,6 +222,8 @@ _memeItems = [ // Items that serve no purpose other than to MEME
// INSTANTIATE VARS
private _returnLines = [];
_unlisted = [];
_restricted = [];
@@ -219,13 +237,13 @@ private _nonCompliantItemsCount = 0;
private _logItem = {
params ["_playerObj", "_categoryText", "_itemClassName"];
private _cfg = _itemClassName call CBA_fnc_getItemConfig;
diag_log text format[
_returnLines pushBack (format[
"[MILSIM] (logPlayerInventory): %1 :: className=""%2"" displayName=""%3"" %4",
_categoryText,
_itemClassName,
[_cfg] call BIS_fnc_displayName,
[_playerObj] call _playerInfoString
];
]);
};
private _playerInfoString = {
@@ -264,10 +282,10 @@ _items pushBack (headgear _player);
_items pushBack (uniform _player);
// CHECK INVENTORY
diag_log text format[
_returnLines pushBack (format[
"[MILSIM] (logPlayerInventory): CHECKING :: %1",
[_player] call _playerInfoString
];
]);
{
_item = _x;
@@ -338,10 +356,11 @@ diag_log text format[
} forEach _unlisted;
if (_nonCompliantItemsCount isEqualTo 0) then {
diag_log text format[
_returnLines pushBack (format[
"[MILSIM] (logPlayerInventory): COMPLIANT :: %1",
[_player] call _playerInfoString
];
]);
};
nil
// returns array of strings
_returnLines;