changes logging, and eval inv on server only

This commit is contained in:
2024-01-30 18:22:45 -08:00
parent dbff8d31d4
commit dc33829751
2 changed files with 29 additions and 31 deletions

View File

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

View File

@@ -18,7 +18,11 @@ params [
]; ];
if (!isPlayer _player) exitWith { if (!isPlayer _player) exitWith {
["[MILSIM] (logPlayerInventory): ERROR :: _player is not a player"] [
"logPlayerInventory",
"PARAM PLAYER IS NOT A PLAYER",
[["player", _player]]
] call milsim_fnc_log;
}; };
// DEFINITIONS // DEFINITIONS
@@ -236,22 +240,19 @@ private _nonCompliantItemsCount = 0;
// PRIVATE FUNCTIONS // PRIVATE FUNCTIONS
private _logItem = { private _logItem = {
params ["_playerObj", "_categoryText", "_itemClassName"]; params ["_playerObj", "_categoryText", "_itemClassName"];
private _cfg = _itemClassName call CBA_fnc_getItemConfig; private _itemConfig = _itemClassName call CBA_fnc_getItemConfig;
_returnLines pushBack (format[ // Log to RPT
"[MILSIM] (logPlayerInventory): %1 :: className=""%2"" displayName=""%3"" %4", [
_categoryText, "logPlayerInventory",
_itemClassName, "NON-COMPLIANT ITEM",
[_cfg] call BIS_fnc_displayName, [_playerObj, [
[_playerObj] call _playerInfoString ["category", _categoryText],
]); ["className", _itemClassName],
["displayName", [_itemConfig] call BIS_fnc_displayName]
]] call milsim_fnc_addPlayerInfoToArray
] call milsim_fnc_log;
}; };
private _playerInfoString = {
params ["_playerObj"];
format["playerName=""%1"" playerUID=""%2"" playerGroup=""%3""", name _playerObj, getPlayerUID _playerObj, groupId (group _playerObj)];
};
// GATHER INVENTORY // GATHER INVENTORY
// _items = []; // _items = [];
// _items pushback headgear _player; // _items pushback headgear _player;
@@ -282,10 +283,11 @@ _items pushBack (headgear _player);
_items pushBack (uniform _player); _items pushBack (uniform _player);
// CHECK INVENTORY // CHECK INVENTORY
_returnLines pushBack (format[ [
"[MILSIM] (logPlayerInventory): CHECKING :: %1", "logPlayerInventory",
[_player] call _playerInfoString "CHECKING PLAYER INVENTORY",
]); [_player] call milsim_fnc_addPlayerInfoToArray
] call milsim_fnc_log;
{ {
_item = _x; _item = _x;
@@ -356,11 +358,9 @@ _returnLines pushBack (format[
} forEach _unlisted; } forEach _unlisted;
if (_nonCompliantItemsCount isEqualTo 0) then { if (_nonCompliantItemsCount isEqualTo 0) then {
_returnLines pushBack (format[ [
"[MILSIM] (logPlayerInventory): COMPLIANT :: %1", "logPlayerInventory",
[_player] call _playerInfoString "PLAYER INVENTORY IS COMPLIANT",
]); [_player] call milsim_fnc_addPlayerInfoToArray
] call milsim_fnc_log;
}; };
// returns array of strings
_returnLines;