Compare commits

...

2 Commits

4 changed files with 46 additions and 11 deletions

View File

@@ -39,11 +39,13 @@ addMissionEventHandler ["HandleChatMessage",
["ace_arsenal_displayClosed", {
player remoteExec["milsim_fnc_logPlayerInventory", 0];
private _lines = [player] call milsim_fnc_logPlayerInventory;
["milsim_logText", [_lines]] call CBA_fnc_globalEvent;
}] call CBA_fnc_addEventHandler;
[missionNamespace, "arsenalClosed", {
player remoteExec["milsim_fnc_logPlayerInventory", 0];
private _lines = [player] call milsim_fnc_logPlayerInventory;
["milsim_logText", [_lines]] call CBA_fnc_globalEvent;
}] call BIS_fnc_addScriptedEventHandler;
diag_log text "[MILSIM] (client) event handlers bound";

View File

@@ -1,5 +1,14 @@
if ( !hasInterface ) exitWith {};
if (!isServer) then {
["milsim_logText", {
params [["_strArray", [""], [[]]]];
{
diag_log text _x;
} forEach _strArray;
}] call CBA_fnc_addEventHandler;
};
["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups;
nil;

View File

@@ -53,7 +53,12 @@ publicVariable "milsim_var_rotaryAssets";
// Initializes the Dynamic Groups framework and groups
["Initialize", [true]] call BIS_fnc_dynamicGroups;
["milsim_logText", {
params [["_strArray", [""], [[]]]];
{
diag_log text _x;
} forEach _strArray;
}] call CBA_fnc_addEventHandler;
missionNamespace setVariable ["milsim_complete", true];
diag_log text "[MILSIM] (initServer) milsim_complete: version 2.3";

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;