Files
MissionTemplate/framework/reinsert/server/fn_addToQueue.sqf
2024-02-06 01:52:25 -08:00

61 lines
1.4 KiB
Plaintext

#include "..\script_component.hpp"
params [
["_player", objNull, [objNull]],
["_base", objNull, [objNull]],
["_timeFiled", diag_tickTime, [25]]
];
if (!isServer) exitWith {
[
LEVEL_ERROR,
QUOTE(COMPONENT),
"ATTEMPTED RUN ON CLIENT",
[
["player", _player],
["base", _base]
]
] call EFUNC(common,log);
["ATTEMPTED RUN ON CLIENT"] call BIS_fnc_error;
};
if (
isNull _player ||
isNull _base
) exitWith {
[
LEVEL_ERROR,
QUOTE(COMPONENT),
"NULL PARAMETERS",
[
["player", _player],
["base", _base]
]
] call EFUNC(common,log);
["NULL PARAMETERS"] call BIS_fnc_error;
};
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
// nearest base here is the same as the base sent
private _nearestBase = _base;
GVAR(reinsertionQueue) pushBackUnique [
_player, _base, _timeFiled
];
// broadcast new list to all machines
publicVariable QGVAR(reinsertionQueue);
// log to rpt
[
LEVEL_INFO,
QUOTE(COMPONENT),
"PLAYER FILED REQUEST",
[_player, [
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled]
]] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);