diff --git a/addons/sys_core/XEH_PREP.hpp b/addons/sys_core/XEH_PREP.hpp index 26f65ae94..92d15fa99 100644 --- a/addons/sys_core/XEH_PREP.hpp +++ b/addons/sys_core/XEH_PREP.hpp @@ -42,5 +42,3 @@ PREP(utilityFunction); PREP(disableRevealAI); PREP(enableRevealAI); PREP(onRevealUnit); - -PREP(formatNumber); diff --git a/addons/sys_core/XEH_postInit.sqf b/addons/sys_core/XEH_postInit.sqf index fb70c8c72..637550c8c 100644 --- a/addons/sys_core/XEH_postInit.sqf +++ b/addons/sys_core/XEH_postInit.sqf @@ -143,7 +143,7 @@ if (getClientStateNumber < 10) then { // Check before game has started (in brief ["setSoundSystemMasterOverride", [0]] call EFUNC(sys_rpc,callRemoteProcedure); [(_this select 1)] call CBA_fnc_removePerFrameHandler; } else { - // Keep calling incase ACRE is not connected to teamspeak. + // Keep calling incase ACRE is not connected to TeamSpeak. ["setSoundSystemMasterOverride", [1]] call EFUNC(sys_rpc,callRemoteProcedure); }; }; diff --git a/addons/sys_core/XEH_preInit.sqf b/addons/sys_core/XEH_preInit.sqf index 2043c880f..14a9897af 100644 --- a/addons/sys_core/XEH_preInit.sqf +++ b/addons/sys_core/XEH_preInit.sqf @@ -111,14 +111,14 @@ private _monitorFnc = { ADDPFH(_monitorFnc, 0, []); ACRE_TESTANGLES = []; -_m = 8; -_spread = 75; +private _m = 8; +private _spread = 75; for "_i" from 1 to (_m/2) do { - _positive = (_spread/_m)*_i; - _negative = ((_spread/_m)*_i)*-1; - PUSH(ACRE_TESTANGLES, _positive); + private _positive = (_spread/_m)*_i; + private _negative = ((_spread/_m)*_i)*-1; + ACRE_TESTANGLES pushBack _positive; if (_positive != _negative) then { - PUSH(ACRE_TESTANGLES, _negative); + ACRE_TESTANGLES pushBack _negative; }; }; diff --git a/addons/sys_core/curve.txt b/addons/sys_core/curve.txt deleted file mode 100644 index 3f396a5ce..000000000 --- a/addons/sys_core/curve.txt +++ /dev/null @@ -1,9 +0,0 @@ -FMOD_VECTOR curve[6] = -{ - { 0.0f, 1.0f, 0.0f }, - { 10.0f, 1.0f, 0.0f }, - { 20.0f, 0.95f, 0.0f }, - { 30.0f, 0.9f, 0.0f }, - { 90.0f, 0.2f, 0.0f }, - { 100.0f, 0.0f, 0.0f } -}; diff --git a/addons/sys_core/fnc_addLanguageType.sqf b/addons/sys_core/fnc_addLanguageType.sqf index 08085f7a8..832f416ff 100644 --- a/addons/sys_core/fnc_addLanguageType.sqf +++ b/addons/sys_core/fnc_addLanguageType.sqf @@ -1,16 +1,16 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Babel add a new language. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Language key name + * 1: Language display name * * Return Value: - * RETURN VALUE + * None * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * ["en", "English"] call acre_sys_core_fnc_addLanguageType * * Public: No */ @@ -18,4 +18,4 @@ params ["_languageKey", "_languageName"]; -PUSH(GVAR(languages), [ARR_2(_languageKey,_languageName)]); +GVAR(languages) pushBack [_languageKey, _languageName]; diff --git a/addons/sys_core/fnc_aliveMonitor.sqf b/addons/sys_core/fnc_aliveMonitor.sqf index 0af7d7273..2eef2ae17 100644 --- a/addons/sys_core/fnc_aliveMonitor.sqf +++ b/addons/sys_core/fnc_aliveMonitor.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * This function is used to check the conditions to mute the local player to prevent the local player from chatting. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * None * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_aliveMonitor * * Public: No */ @@ -19,11 +18,8 @@ GVAR(oldMute) = 0; GVAR(_waitTime) = 0; DFUNC(utility_aliveStatus) = { - // diag_log text format["%1 alive: %2 muted: %3, bis: %4", diag_tickTime, [acre_player] call FUNC(getAlive), IS_MUTED(acre_player), alive acre_player]; - _isMutedBool = IS_MUTED(acre_player); - - _isMuted = 0; - if (_isMutedBool) then { + private _isMuted = 0; + if (IS_MUTED(acre_player)) then { _isMuted = 1; }; if ((_isMuted != GVAR(oldMute)) || (diag_tickTime > GVAR(_waitTime))) then { @@ -34,5 +30,5 @@ DFUNC(utility_aliveStatus) = { GVAR(oldMute) = _isMuted; }; GVAR(_waitTime) = diag_tickTime + 3; -ADDPFH(DFUNC(utility_aliveStatus), 0, []); +ADDPFH(FUNC(utility_aliveStatus), 0, []); true diff --git a/addons/sys_core/fnc_callExt.sqf b/addons/sys_core/fnc_callExt.sqf index 5dc7c82b6..0d3f440fb 100644 --- a/addons/sys_core/fnc_callExt.sqf +++ b/addons/sys_core/fnc_callExt.sqf @@ -1,23 +1,24 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * This function is used to make calls in acre.dll. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Command + * 1: Parameters + * 2: Threaded call if so uses the following arguments to handle the return (optional) + * 3: Callback code (optional) + * 4: Return arguments (optional) * * Return Value: - * RETURN VALUE + * Return from call extension * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * ["init",[]] call acre_sys_core_fnc_callExt * * Public: No */ #include "script_component.hpp" -#define FORMAT_NUMBER(num) (num call FUNC(formatNumber)) - params ["_command", "_params", ["_threaded", false], ["_callBack",{}], ["_callBackArgs",[]]]; private _paramsString = ""; @@ -29,6 +30,7 @@ if (IS_ARRAY(_params)) then { if (IS_ARRAY(_element)) then { { if (!IS_STRING(_x)) then { + // Convert boolean to number if (IS_BOOL(_x)) then { if (_x) then { _x = 1; @@ -36,18 +38,14 @@ if (IS_ARRAY(_params)) then { _x = 0; }; }; - // if (IS_NUMBER(_x)) then { - // _x = FORMAT_NUMBER(_x); - // _paramsString = _paramsString + _x + ","; - // } else { - _paramsString = _paramsString + (str _x) + ","; - // }; + _paramsString = _paramsString + (str _x) + ","; // Convert number to string } else { _paramsString = _paramsString + _x + ","; }; } forEach _element; } else { if (!IS_STRING(_element)) then { + // Convert boolean to number if (IS_BOOL(_element)) then { if (_element) then { _element = 1; @@ -56,12 +54,7 @@ if (IS_ARRAY(_params)) then { }; }; - // if (IS_NUMBER(_element)) then { - // _element = FORMAT_NUMBER(_element); - // _paramsString = _paramsString + _element + ","; - // } else { - _paramsString = _paramsString + (str _element) + ","; - // }; + _paramsString = _paramsString + (str _element) + ","; // Convert number to string } else { _paramsString = _paramsString + _element + ","; }; diff --git a/addons/sys_core/fnc_canUnderstand.sqf b/addons/sys_core/fnc_canUnderstand.sqf index 6ddb3947b..973e58d9b 100644 --- a/addons/sys_core/fnc_canUnderstand.sqf +++ b/addons/sys_core/fnc_canUnderstand.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Returns whether the local player's unit can understand the target unit. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Unit * * Return Value: - * RETURN VALUE + * Can understand * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [unit] call acre_sys_core_fnc_canUnderstand * * Public: No */ diff --git a/addons/sys_core/fnc_cycleLanguage.sqf b/addons/sys_core/fnc_cycleLanguage.sqf index 5ed785fbd..4e9ecebe9 100644 --- a/addons/sys_core/fnc_cycleLanguage.sqf +++ b/addons/sys_core/fnc_cycleLanguage.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Cycles the language that the local player is speaking. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * false * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_cycleLanguage * * Public: No */ diff --git a/addons/sys_core/fnc_disableRevealAI.sqf b/addons/sys_core/fnc_disableRevealAI.sqf index 80a47d284..559aa0fbb 100644 --- a/addons/sys_core/fnc_disableRevealAI.sqf +++ b/addons/sys_core/fnc_disableRevealAI.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * This function handles stopping the AI reveal check. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_disableRevealAI * * Public: No */ diff --git a/addons/sys_core/fnc_enableRevealAI.sqf b/addons/sys_core/fnc_enableRevealAI.sqf index 260ec030a..ab27afc60 100644 --- a/addons/sys_core/fnc_enableRevealAI.sqf +++ b/addons/sys_core/fnc_enableRevealAI.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Enables AI hearing of direct speech. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * None * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_enableRevealAI * * Public: No */ @@ -20,9 +19,8 @@ DFUNC(monitorAI_PFH) = { //if (time < 10) exitWith {}; - if (isNull acre_player) exitWith {}; + if (!alive acre_player) exitWith {}; // alive returns false for objNull if (ACRE_IS_SPECTATOR) exitWith {}; - if (!alive acre_player) exitWith {}; //if (! ACRE_LOCAL_SPEAKING ) exitWith {}; if (!(acre_player in GVAR(speakers))) exitWith {}; if (isNil "acre_api_selectableCurveScale" ) exitWith {}; diff --git a/addons/sys_core/fnc_findOcclusion.sqf b/addons/sys_core/fnc_findOcclusion.sqf index 3e13386e7..5967c7c3e 100644 --- a/addons/sys_core/fnc_findOcclusion.sqf +++ b/addons/sys_core/fnc_findOcclusion.sqf @@ -1,16 +1,17 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Calculates the direct speech occlusion between two positions. Intended to calculate attenuation between the local player and a target unit. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Start position + * 1: End position + * 2: Unit * * Return Value: - * RETURN VALUE + * Occlusion * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [[0,0,0],[11,23,100],unit] call acre_sys_core_fnc_findOcclusion * * Public: No */ diff --git a/addons/sys_core/fnc_formatNumber.sqf b/addons/sys_core/fnc_formatNumber.sqf deleted file mode 100644 index a22f8436f..000000000 --- a/addons/sys_core/fnc_formatNumber.sqf +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: ACRE2Team - * SHORT DESCRIPTION - * - * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO - * - * Return Value: - * RETURN VALUE - * - * Example: - * [ARGUMENTS] call acre_sys_core_fnc_formatNumber; - * - * Public: No - */ -#include "script_component.hpp" - -private _ext = abs _this - (floor abs _this); -private _str = ""; - -for "_i" from 1 to 24 do { - private _d = floor (_ext*10); - _str = _str + (str _d); - _ext = (_ext*10)-_d; -}; -format["%1%2.%3", ["","-"] select (_this < 0), (floor (abs _this)), _str]; diff --git a/addons/sys_core/fnc_getAlive.sqf b/addons/sys_core/fnc_getAlive.sqf index 3cb657e4b..8a125abd2 100644 --- a/addons/sys_core/fnc_getAlive.sqf +++ b/addons/sys_core/fnc_getAlive.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Determines whether the unit can be heard by the local player or not. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: unit * * Return Value: - * RETURN VALUE + * 0 for false, 1 for true * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [player] call acre_sys_core_fnc_getAlive * * Public: No */ @@ -19,14 +18,14 @@ params ["_unit"]; private _ret = 0; -if (_unit == acre_player) then { +if (_unit isEqualTo acre_player) then { if (ACRE_IS_SPECTATOR || alive acre_player) then { _ret = 1; }; } else { if (!isNull _unit) then { - _ts3id = GET_TS3ID(_unit); - if ((alive _unit && !(_ts3id in ACRE_SPECTATORS_LIST)) || (_ts3id in ACRE_SPECTATORS_LIST && ACRE_IS_SPECTATOR && !ACRE_MUTE_SPECTATORS)) then { + private _ts3id = GET_TS3ID(_unit); + if ((alive _unit && {!(_ts3id in ACRE_SPECTATORS_LIST)}) || (ACRE_IS_SPECTATOR && !ACRE_MUTE_SPECTATORS && {_ts3id in ACRE_SPECTATORS_LIST})) then { _ret = 1; }; }; diff --git a/addons/sys_core/fnc_getClientIdLoop.sqf b/addons/sys_core/fnc_getClientIdLoop.sqf index f2e6e35a8..27e5fcfd9 100644 --- a/addons/sys_core/fnc_getClientIdLoop.sqf +++ b/addons/sys_core/fnc_getClientIdLoop.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * This function exists to setup the process for sending our object and player ID to other clients to associate with our TeamSpeak ID. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_getClientIdLoop * * Public: No */ @@ -22,5 +21,8 @@ DFUNC(getClientIdLoopFunc) = { ["getClientID", [_netId, (getPlayerUID player)]] call EFUNC(sys_rpc,callRemoteProcedure); }; }; -ADDPFH(DFUNC(getClientIdLoopFunc), 3, []); +ADDPFH(FUNC(getClientIdLoopFunc), 3, []); // Send on regular interval for JIP etc. + +["unit", {[] call FUNC(getClientIdLoopFunc);}] call CBA_fnc_addPlayerEventHandler; // Use EH for immediate sending on unit transfer + true diff --git a/addons/sys_core/fnc_getHeadVector.sqf b/addons/sys_core/fnc_getHeadVector.sqf index b45fb6649..c3e532ece 100644 --- a/addons/sys_core/fnc_getHeadVector.sqf +++ b/addons/sys_core/fnc_getHeadVector.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * This function returns the direction the local player is facing. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * Vector * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_getHeadVector * * Public: No */ diff --git a/addons/sys_core/fnc_getLanguageId.sqf b/addons/sys_core/fnc_getLanguageId.sqf index cac687781..a6d9d361e 100644 --- a/addons/sys_core/fnc_getLanguageId.sqf +++ b/addons/sys_core/fnc_getLanguageId.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Returns the language index from a language Id. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Language Key * * Return Value: - * RETURN VALUE + * Language index * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * ["en"] call acre_sys_core_fnc_getLanguageId * * Public: No */ diff --git a/addons/sys_core/fnc_getLanguageName.sqf b/addons/sys_core/fnc_getLanguageName.sqf index 783c8febe..0b73ddef5 100644 --- a/addons/sys_core/fnc_getLanguageName.sqf +++ b/addons/sys_core/fnc_getLanguageName.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Get the language display name from the language key. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Language key * * Return Value: - * RETURN VALUE + * Language display name ("" if not found) * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * ["en"] call acre_sys_core_fnc_getLanguageName * * Public: No */ diff --git a/addons/sys_core/fnc_getSpeakingLanguageId.sqf b/addons/sys_core/fnc_getSpeakingLanguageId.sqf index 5af4d7f91..9416c7673 100644 --- a/addons/sys_core/fnc_getSpeakingLanguageId.sqf +++ b/addons/sys_core/fnc_getSpeakingLanguageId.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Returns the current speaking language. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * Language Index * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_getSpeakingLanguageId * * Public: No */ diff --git a/addons/sys_core/fnc_getSpokenLanguages.sqf b/addons/sys_core/fnc_getSpokenLanguages.sqf index e60fc1303..81d5f7357 100644 --- a/addons/sys_core/fnc_getSpokenLanguages.sqf +++ b/addons/sys_core/fnc_getSpokenLanguages.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Returns a list of language ids understood by the local player. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * Array of language Ids * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_getSpokenLanguages * * Public: No */ @@ -19,6 +18,6 @@ private _list = []; { - PUSH(_list, ((GVAR(languages) select _x) select 0)); + _list pushBack ((GVAR(languages) select _x) select 0); } forEach ACRE_SPOKEN_LANGUAGES; _list diff --git a/addons/sys_core/fnc_handleGetClientID.sqf b/addons/sys_core/fnc_handleGetClientID.sqf index 3072c13d2..ca74fbbf7 100644 --- a/addons/sys_core/fnc_handleGetClientID.sqf +++ b/addons/sys_core/fnc_handleGetClientID.sqf @@ -1,16 +1,16 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Handles receipt of TS client ID alongside its objects network ID. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: TS client ID + * 1: Net ID of object for TS client ID * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * ["2","2:3"] call acre_sys_core_fnc_handleGetClientID * * Public: No */ @@ -20,10 +20,10 @@ params ["_newTs3Id","_netId"]; _newTs3Id = parseNumber _newTs3Id; -_playerObject = objectFromNetId _netId; +private _playerObject = objectFromNetId _netId; TRACE_1("got client ID", _this); if (_playerObject == acre_player) then { - _resendSpectator = false; + private _resendSpectator = false; if (_newTs3Id != GVAR(ts3id)) then { if (ACRE_IS_SPECTATOR) then { [] call FUNC(spectatorOff); diff --git a/addons/sys_core/fnc_handleGetHeadVector.sqf b/addons/sys_core/fnc_handleGetHeadVector.sqf index 1a5f5e741..e28b6c00a 100644 --- a/addons/sys_core/fnc_handleGetHeadVector.sqf +++ b/addons/sys_core/fnc_handleGetHeadVector.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Sends the current head direction vector to the TeamSpeak plugin. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_handleGetHeadVector * * Public: No */ diff --git a/addons/sys_core/fnc_handleGetPluginVersion.sqf b/addons/sys_core/fnc_handleGetPluginVersion.sqf index 041f5d8d3..db93b5b52 100644 --- a/addons/sys_core/fnc_handleGetPluginVersion.sqf +++ b/addons/sys_core/fnc_handleGetPluginVersion.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Handles the return of the current plugin version from TeamSpeak. Displays messages to the player if any of the versions do not match. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: TeamSpeak plugin version * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * ["2.3.0.926"] call acre_sys_core_fnc_handleGetPluginVersion * * Public: No */ diff --git a/addons/sys_core/fnc_handleMultiPttKeyPress.sqf b/addons/sys_core/fnc_handleMultiPttKeyPress.sqf index 352e249d0..124480513 100644 --- a/addons/sys_core/fnc_handleMultiPttKeyPress.sqf +++ b/addons/sys_core/fnc_handleMultiPttKeyPress.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Used to handle a keypress of multiPttKeyPress. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Radio PTT index * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [1] call acre_sys_core_fnc_handleMultiPttKeyPress * * Public: No */ diff --git a/addons/sys_core/fnc_handleMultiPttKeyPressUp.sqf b/addons/sys_core/fnc_handleMultiPttKeyPressUp.sqf index 387c50d16..73e3e455f 100644 --- a/addons/sys_core/fnc_handleMultiPttKeyPressUp.sqf +++ b/addons/sys_core/fnc_handleMultiPttKeyPressUp.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Used to handle key up of multiPttKeyPress. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_handleMultiPttKeyPressUp * * Public: No */ diff --git a/addons/sys_core/fnc_isMuted.sqf b/addons/sys_core/fnc_isMuted.sqf index b62bb6395..55c41eddc 100644 --- a/addons/sys_core/fnc_isMuted.sqf +++ b/addons/sys_core/fnc_isMuted.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * This function determines is used to check if the unit should be muted on TeamSpeak or not. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: unit * * Return Value: - * RETURN VALUE + * should the unit be muted * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [acre_player] call acre_sys_core_fnc_isMuted * * Public: No */ diff --git a/addons/sys_core/fnc_localStartSpeaking.sqf b/addons/sys_core/fnc_localStartSpeaking.sqf index 31a40931c..eaf7f039a 100644 --- a/addons/sys_core/fnc_localStartSpeaking.sqf +++ b/addons/sys_core/fnc_localStartSpeaking.sqf @@ -1,16 +1,18 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Handles the local player start speaking event. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Speaking ID + * 1: Net id of local player object + * 2: On radio ("0" for false, "1" for true) + * 3: Radio ID if talking on radio * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [0,"0:2","1","ACRE_PRC343_ID_2"] call acre_sys_core_fnc_localStartSpeaking * * Public: No */ diff --git a/addons/sys_core/fnc_localStopSpeaking.sqf b/addons/sys_core/fnc_localStopSpeaking.sqf index db9a85fdb..6c8698162 100644 --- a/addons/sys_core/fnc_localStopSpeaking.sqf +++ b/addons/sys_core/fnc_localStopSpeaking.sqf @@ -1,16 +1,16 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Handles the local player stop speaking event. * * Arguments: * 0: ARGUMENT ONE * 1: ARGUMENT TWO * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_localStopSpeaking * * Public: No */ diff --git a/addons/sys_core/fnc_muting.sqf b/addons/sys_core/fnc_muting.sqf index 2dc376abe..8309254c4 100644 --- a/addons/sys_core/fnc_muting.sqf +++ b/addons/sys_core/fnc_muting.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Sets up the per frame event handler to mute and unmute clients on TeamSpeak. The muting occurs to optimize TeamSpeak bandwidth as voice data is not sent for muted clients. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * None * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_muting * * Public: No */ @@ -27,10 +26,6 @@ GVAR(_fullListTime) = true; GVAR(oldPlayerIdList) = []; DFUNC(mutingPFHLoop) = { - - if (time == 0) exitWith { - true; - }; if (diag_tickTime > GVAR(_waitFullSend)) then { GVAR(_fullListTime) = true; }; @@ -52,31 +47,29 @@ DFUNC(mutingPFHLoop) = { if (!(_remoteTs3Id in ACRE_SPECTATORS_LIST)) then { private _isRemotePlayerAlive = [_remoteUser] call FUNC(getAlive); if (_isRemotePlayerAlive == 1) then { - //PUSH(_playerIdList, _remoteTs3Id); + //_playerIdList pushBack _remoteTs3Id; // private _radioListRemote = [_remoteUser] call EFUNC(sys_data,getRemoteRadioList); // private _radioListLocal = [] call EFUNC(sys_data,getPlayerRadioList); // private _okRadios = [_radioListLocal, _radioListRemote, true] call EFUNC(sys_modes,checkAvailability); if (_remoteUser distance _dynamicPos > 300) then { - PUSH(_muting,_remoteUser); + _muting pushBack _remoteUser; _muted = 1; + if (_remoteUser in GVAR(speakers)) then { + _muted = 0; + }; }; - if (_remoteUser in GVAR(speakers)) then { - _muted = 0; - }; + if (GVAR(_fullListTime)) then { _mutingParams = _mutingParams + format["%1,%2,", _remoteTs3Id, _muted]; - _remoteUser setVariable [QGVAR(muted), _muted, false]; } else { - if (((_remoteUser in GVAR(muting)) && _muted == 0) || (!(_remoteUser in GVAR(muting)) && _muted == 1)) then { + if ((_muted == 0 && {_remoteUser in GVAR(muting)}) || (_muted == 1 && {!(_remoteUser in GVAR(muting))})) then { _mutingParams = _mutingParams + format["%1,%2,", _remoteTs3Id, _muted]; - _remoteUser setVariable [QGVAR(muted), _muted, false]; }; }; }; } else { - PUSH(_muting,_remoteUser); - _remoteUser setVariable [QGVAR(muted), 1, false]; + _muting pushBack _remoteUser; }; //}; }; @@ -90,7 +83,7 @@ DFUNC(mutingPFHLoop) = { if ((count _newSpectators) > 0) then { { if (_x != GVAR(ts3id)) then { - _mutingParams = _mutingParams + format["%1,%2,", _x, 1]; + _mutingParams = _mutingParams + format["%1,1,", _x]; }; } forEach _newSpectators; if (!GVAR(_fullListTime)) then { @@ -102,7 +95,7 @@ DFUNC(mutingPFHLoop) = { if (ACRE_IS_SPECTATOR) then { { if (_x != GVAR(ts3id)) then { - _mutingParams = _mutingParams + format["%1,%2,", _x, 0]; + _mutingParams = _mutingParams + format["%1,0,", _x]; }; } forEach ACRE_SPECTATORS_LIST; }; @@ -113,7 +106,7 @@ DFUNC(mutingPFHLoop) = { if (ACRE_IS_SPECTATOR && GVAR(_fullListTime)) then { { if (_x != GVAR(ts3id)) then { - _mutingParams = _mutingParams + format["%1,%2,", _x, 0]; + _mutingParams = _mutingParams + format["%1,0,", _x]; }; } forEach ACRE_SPECTATORS_LIST; }; @@ -128,4 +121,8 @@ DFUNC(mutingPFHLoop) = { }; true }; -ADDPFH(DFUNC(mutingPFHLoop), 0.25, []); + +// Wait until time > 0, to save check in PFH +[{time > 0},{ + ADDPFH(FUNC(mutingPFHLoop), 0.25, []); +},[]] call CBA_fnc_waitUntilAndExecute; \ No newline at end of file diff --git a/addons/sys_core/fnc_onPlayerKilled.sqf b/addons/sys_core/fnc_onPlayerKilled.sqf index 87f892ba6..05a380259 100644 --- a/addons/sys_core/fnc_onPlayerKilled.sqf +++ b/addons/sys_core/fnc_onPlayerKilled.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Handles death of unit, primarily for handling local player death. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Unit * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [player] call acre_sys_core_fnc_onPlayerKilled * * Public: No */ diff --git a/addons/sys_core/fnc_onRevealUnit.sqf b/addons/sys_core/fnc_onRevealUnit.sqf index 7afcf6ec1..653180f0a 100644 --- a/addons/sys_core/fnc_onRevealUnit.sqf +++ b/addons/sys_core/fnc_onRevealUnit.sqf @@ -1,16 +1,17 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Helper function for revealing units to AI for non-local AI. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Player to reveal + * 1: Unit to reveal to + * 2: Reveal amount * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [player,unit,4.0] call acre_sys_core_fnc_onRevealUnit * * Public: No */ diff --git a/addons/sys_core/fnc_pong.sqf b/addons/sys_core/fnc_pong.sqf index bbb75a2bb..61b86ad42 100644 --- a/addons/sys_core/fnc_pong.sqf +++ b/addons/sys_core/fnc_pong.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Handler for recieving pong messages from the TeamSpeak plugin. This is called periodically as it provides a simple check to make sure TeamSpeak isis still connected to the game. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * None * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_pong * * Public: No */ diff --git a/addons/sys_core/fnc_processDirectSpeaker.sqf b/addons/sys_core/fnc_processDirectSpeaker.sqf index 8780ed9d5..fd058964f 100644 --- a/addons/sys_core/fnc_processDirectSpeaker.sqf +++ b/addons/sys_core/fnc_processDirectSpeaker.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Calculates the information required by TeamSpeak for a direct speech speaker. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Unit * * Return Value: - * RETURN VALUE + * Parameters to send to TeamSpeak * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [unit] call acre_sys_core_fnc_processDirectSpeaker * * Public: No */ diff --git a/addons/sys_core/fnc_processRadioSpeaker.sqf b/addons/sys_core/fnc_processRadioSpeaker.sqf index d4d53b6c9..5399027e4 100644 --- a/addons/sys_core/fnc_processRadioSpeaker.sqf +++ b/addons/sys_core/fnc_processRadioSpeaker.sqf @@ -1,16 +1,16 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Calculates the information required by TeamSpeak for a radio speaker. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Unit to process + * 1: List of radio classnames * * Return Value: - * RETURN VALUE + * Parameters to send to TeamSpeak * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [unit,["ACRE_PRC343_ID_1"]] call acre_sys_core_fnc_processRadioSpeaker * * Public: No */ @@ -85,7 +85,7 @@ if ((count _okRadios) > 0) then { _params = _unit getVariable ["ACRE_%1CachedSampleParams"+_x, []]; }; if (!ACRE_FULL_DUPLEX || _x != _radioid) then { - PUSH(_returns, _params); + _returns pushBack _params; }; } forEach _okRadios; END_COUNTER(okradio_loop); diff --git a/addons/sys_core/fnc_remoteStartSpeaking.sqf b/addons/sys_core/fnc_remoteStartSpeaking.sqf index 2e2bd2206..02dcf7aaa 100644 --- a/addons/sys_core/fnc_remoteStartSpeaking.sqf +++ b/addons/sys_core/fnc_remoteStartSpeaking.sqf @@ -1,16 +1,19 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Handles the event of other (remote) players starting to speaking. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: TeamSpeak ID of talking player + * 1: Language ID + * 2: Net ID of player object + * 3: On radio + * 4: Radio ID (default: ',') * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_remoteStartSpeaking * * Public: No */ diff --git a/addons/sys_core/fnc_remoteStopSpeaking.sqf b/addons/sys_core/fnc_remoteStopSpeaking.sqf index 95339eb4f..11c0c5204 100644 --- a/addons/sys_core/fnc_remoteStopSpeaking.sqf +++ b/addons/sys_core/fnc_remoteStopSpeaking.sqf @@ -1,16 +1,16 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Handles the event of other (remote) players stopping speaking. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: TeamSpeak ID of talking player + * 1: Net ID of player object * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * ["0","0:2"] call acre_sys_core_fnc_remoteStopSpeaking * * Public: No */ diff --git a/addons/sys_core/fnc_setSpeakingLanguage.sqf b/addons/sys_core/fnc_setSpeakingLanguage.sqf index 7f409380b..7abcbb164 100644 --- a/addons/sys_core/fnc_setSpeakingLanguage.sqf +++ b/addons/sys_core/fnc_setSpeakingLanguage.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Sets the local player speaking language by language key. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Language key * * Return Value: - * RETURN VALUE + * Successful * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * ["en"] call acre_sys_core_fnc_setSpeakingLanguage * * Public: No */ diff --git a/addons/sys_core/fnc_setSpokenLanguages.sqf b/addons/sys_core/fnc_setSpokenLanguages.sqf index 98bcbd582..48e421f6d 100644 --- a/addons/sys_core/fnc_setSpokenLanguages.sqf +++ b/addons/sys_core/fnc_setSpokenLanguages.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Sets the spoken languages of the local player. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Languages by Id * * Return Value: - * RETURN VALUE + * Spoken Languages * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * ["en"] call acre_sys_core_fnc_setSpokenLanguages * * Public: No */ @@ -20,7 +19,7 @@ private _list = _this; private _languageIds = []; { - PUSH(_languageIds, ([_x] call FUNC(getLanguageId))); + _languageIds pushBack ([_x] call FUNC(getLanguageId)); } forEach _list; ACRE_SPOKEN_LANGUAGES = _languageIds; [_list select 0] call FUNC(setSpeakingLanguage); diff --git a/addons/sys_core/fnc_showBroadCastHint.sqf b/addons/sys_core/fnc_showBroadCastHint.sqf index 4cc4680ec..0c5de8bce 100644 --- a/addons/sys_core/fnc_showBroadCastHint.sqf +++ b/addons/sys_core/fnc_showBroadCastHint.sqf @@ -1,13 +1,12 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Shows the transmitting hint. Intended for use when transmitting. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * Handled * * Example: * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME @@ -22,4 +21,4 @@ if ((count ([] call EFUNC(sys_data,getPlayerRadioList))) > 0) then { private _line2 = [ACRE_ACTIVE_RADIO, "getChannelDescription"] call EFUNC(sys_data,dataEvent); ["TRANSMITTING",_name,_line2,1] call EFUNC(sys_list,displayHint); }; -false +true diff --git a/addons/sys_core/fnc_speaking.sqf b/addons/sys_core/fnc_speaking.sqf index 4b58602f8..7e5a310d1 100644 --- a/addons/sys_core/fnc_speaking.sqf +++ b/addons/sys_core/fnc_speaking.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Sets up the the per frame event handler for processing all the speaking data which in turn will send data to TeamSpeak. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * None * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_speaking * * Public: No */ @@ -74,7 +73,7 @@ DFUNC(speakingLoop) = { _sources set[_keyIndex, []]; }; _txRadios = _sources select _keyIndex; - PUSH(_txRadios, [ARR_4(_unit,_txId,_signalData,_params)]); + _txRadios pushBack [_unit,_txId,_signalData,_params]; if (acre_sys_signal_showSignalHint) then { _signalHint = _signalHint + format["%1->%2:\n%3dBm (%4%5)\n", name _unit, _rxId, _signalData select 1, round((_signalData select 0)*100), "%"]; }; @@ -185,7 +184,7 @@ DFUNC(speakingLoop) = { _params set[0, _radioVolume]; }; _params set[1, (_signalData select 0)]; - PUSH(_speakingRadios, _params); + _speakingRadios pushBack _params; }; } forEach _hearableRadios; END_COUNTER(hearableRadios); @@ -207,7 +206,7 @@ DFUNC(speakingLoop) = { { private _unit = objectFromNetId _x; if (!isNull _unit) then { - PUSH(_sentMicRadios, _unit); + _sentMicRadios pushBack _unit; private _params = HASH_GET(_compiledParams, _x); _count = (count _params); _canUnderstand = [_unit] call FUNC(canUnderstand); diff --git a/addons/sys_core/fnc_spectatorOff.sqf b/addons/sys_core/fnc_spectatorOff.sqf index ff8326b05..4564b9da7 100644 --- a/addons/sys_core/fnc_spectatorOff.sqf +++ b/addons/sys_core/fnc_spectatorOff.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Disables spectator mode on the local player. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_spectatorOff * * Public: No */ diff --git a/addons/sys_core/fnc_spectatorOn.sqf b/addons/sys_core/fnc_spectatorOn.sqf index 7f2b5efad..101170ac0 100644 --- a/addons/sys_core/fnc_spectatorOn.sqf +++ b/addons/sys_core/fnc_spectatorOn.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Enables spectator mode on the local player. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_spectatorOn * * Public: No */ diff --git a/addons/sys_core/fnc_switchChannelFast.sqf b/addons/sys_core/fnc_switchChannelFast.sqf index bcef738b3..3345d9987 100644 --- a/addons/sys_core/fnc_switchChannelFast.sqf +++ b/addons/sys_core/fnc_switchChannelFast.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Handles the channel switching keybind. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Channel change amount (expected -1 or 1) * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [1] call acre_sys_core_fnc_switchChannelFast * * Public: No */ diff --git a/addons/sys_core/fnc_switchRadioEar.sqf b/addons/sys_core/fnc_switchRadioEar.sqf index 057ac5bf3..01328e18b 100644 --- a/addons/sys_core/fnc_switchRadioEar.sqf +++ b/addons/sys_core/fnc_switchRadioEar.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Changes the spatial mode of the active radio. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: Spatial mode (-1 = left, 0 = center, 1 = right) * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [0] call acre_sys_core_fnc_switchRadioEar * * Public: No */ diff --git a/addons/sys_core/fnc_toggleHeadset.sqf b/addons/sys_core/fnc_toggleHeadset.sqf index 086ef36d3..6ba376252 100644 --- a/addons/sys_core/fnc_toggleHeadset.sqf +++ b/addons/sys_core/fnc_toggleHeadset.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Toggles the local player's headset mode (lowered or raised). In spectator this toggles the spectator mute. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * Handled * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_toggleHeadset * * Public: No */ diff --git a/addons/sys_core/fnc_ts3idToPlayer.sqf b/addons/sys_core/fnc_ts3idToPlayer.sqf index 51508d981..e457c2324 100644 --- a/addons/sys_core/fnc_ts3idToPlayer.sqf +++ b/addons/sys_core/fnc_ts3idToPlayer.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Retrieves the game object of a player from a TeamSpeak ID. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * 0: TeamSpeak ID * * Return Value: - * RETURN VALUE + * Player * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * ["1"] call acre_sys_core_fnc_ts3idToPlayer * * Public: No */ diff --git a/addons/sys_core/fnc_updateSelf.sqf b/addons/sys_core/fnc_updateSelf.sqf index e57110860..0a403dcbd 100644 --- a/addons/sys_core/fnc_updateSelf.sqf +++ b/addons/sys_core/fnc_updateSelf.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Updates the position and viewing direction of the local player. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * None * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_updateSelf * * Public: No */ diff --git a/addons/sys_core/fnc_utilityFunction.sqf b/addons/sys_core/fnc_utilityFunction.sqf index cfee0c689..0f1297c7c 100644 --- a/addons/sys_core/fnc_utilityFunction.sqf +++ b/addons/sys_core/fnc_utilityFunction.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Sets up some utility per frame event handlers. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * None * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_utilityFunction * * Public: No */ diff --git a/addons/sys_radio/fnc_monitorRadios.sqf b/addons/sys_radio/fnc_monitorRadios.sqf index c2b2f2ba2..b93f2be55 100644 --- a/addons/sys_radio/fnc_monitorRadios.sqf +++ b/addons/sys_radio/fnc_monitorRadios.sqf @@ -1,16 +1,15 @@ /* * Author: ACRE2Team - * SHORT DESCRIPTION + * Sets up the per frame event handler for monitoring the local player inventory for changes. * * Arguments: - * 0: ARGUMENT ONE - * 1: ARGUMENT TWO + * None * * Return Value: - * RETURN VALUE + * None * * Example: - * [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME + * [] call acre_sys_core_fnc_monitorRadios * * Public: No */ @@ -30,127 +29,111 @@ ACRE_SERVER_DESYNCED_PLAYERS = []; LOG("Monitor Inventory Starting"); DFUNC(monitorRadios_PFH) = { - if (!ACRE_DATA_SYNCED || {(isNil "ACRE_SERVER_INIT")}) exitWith { }; - if (time < 1) exitWith { }; + if (!alive acre_player) exitWith {}; if ((side group acre_player) == sideLogic) exitWith {}; - if (alive acre_player) then { - private _currentUniqueItems = []; - private _weapons = [acre_player] call EFUNC(lib,getGear); - - if (!("ItemRadio" in _weapons) && !("ItemRadioAcreFlagged" in _weapons) && !ACRE_HOLD_OFF_ITEMRADIO_CHECK) then { - acre_player linkItem "ItemRadioAcreFlagged"; // Only ItemRadio/ItemRadioAcreFlagged can be in the linked item slot for Radios. - // Check if the linkItem removes anything... Only ItemRadio - /*_newWeapons = [acre_player] call EFUNC(lib,getGear); - { - _radio = _x; - _hasUnique = getNumber (configFile >> "CfgWeapons" >> _radio >> "acre_hasUnique"); - if (_hasUnique == 1 || _radio == "ItemRadio") then { - if (!(_radio in _newWeapons)) then { - [acre_player, _radio] call EFUNC(lib,addGear); - }; - }; - } forEach _weapons; - _weapons = _newWeapons;*/ - } else { - if ("ItemRadioAcreFlagged" in _weapons && !("ItemRadioAcreFlagged" in (assignedItems acre_player)) && !ACRE_HOLD_OFF_ITEMRADIO_CHECK) then { - acre_player assignItem "ItemRadioAcreFlagged"; + private _weapons = [acre_player] call EFUNC(lib,getGear); + + // Handle ItemRadioAcreFlagged - This is a dummy ItemRadio that allows the player to continue using ingame text chat. + + if (!ACRE_HOLD_OFF_ITEMRADIO_CHECK && {!("ItemRadio" in _weapons)} && {!("ItemRadioAcreFlagged" in _weapons)}) then { + acre_player linkItem "ItemRadioAcreFlagged"; // Only ItemRadio/ItemRadioAcreFlagged can be in the linked item slot for Radios. + } else { + if (!ACRE_HOLD_OFF_ITEMRADIO_CHECK && {"ItemRadioAcreFlagged" in _weapons} && {!("ItemRadioAcreFlagged" in (assignedItems acre_player))}) then { + acre_player assignItem "ItemRadioAcreFlagged"; + }; + }; + + if ("ItemRadioAcreFlagged" in _weapons) then { + // Only allow 1 ItemRadioAcreFlagged + private _flaggedCount = {_x == "ItemRadioAcreFlagged"} count _weapons; + + if (_flaggedCount > 1) then { + for "_i" from 1 to (_flaggedCount - 1) do { + [acre_player, "ItemRadioAcreFlagged"] call EFUNC(lib,removeGear); }; + acre_player assignItem "ItemRadioAcreFlagged"; }; + }; - if ("ItemRadioAcreFlagged" in _weapons) then { - // Only allow 1 ItemRadioAcreFlagged - private _flaggedCount = 0; - { - if (_x == "ItemRadioAcreFlagged") then { - _flaggedCount = _flaggedCount + 1; - }; - } forEach _weapons; - if (_flaggedCount > 1) then { - private "_i"; - for [{_i=0}, {_i<_flaggedCount-1}, {_i=_i+1}] do { - [acre_player, "ItemRadioAcreFlagged"] call EFUNC(lib,removeGear); + private _currentUniqueItems = []; + { + if (GVAR(requestingNewId)) exitWith { }; + private _radio = _x; + private _hasUnique = getNumber (configFile >> "CfgWeapons" >> _radio >> "acre_hasUnique"); + if (_hasUnique == 1 || _radio == "ItemRadio") then { + + GVAR(requestingNewId) = true; + if (_radio == "ItemRadio") then { + _radio = GVAR(defaultItemRadioType); + [acre_player, "ItemRadio", _radio] call EFUNC(lib,replaceGear); + }; + TRACE_1("Getting ID for", _radio); + if (diag_tickTime-ACRE_SERVER_GEAR_DESYNC_TIME < 60) then { + ACRE_SERVER_GEAR_DESYNC_REQUESTCOUNT = ACRE_SERVER_GEAR_DESYNC_REQUESTCOUNT + 1; + if (ACRE_SERVER_GEAR_DESYNC_REQUESTCOUNT > 10 && !ACRE_SERVER_GEAR_DESYNC_CHECK) then { + ACRE_SERVER_GEAR_DESYNC_CHECK = true; }; - acre_player assignItem "ItemRadioAcreFlagged"; + } else { + ACRE_SERVER_GEAR_DESYNC_TIME = diag_tickTime; + ACRE_SERVER_GEAR_DESYNC_REQUESTCOUNT = 0; }; + + ["acre_getRadioId", [acre_player, _radio, QGVAR(returnRadioId)]] call CALLSTACK(CBA_fnc_globalEvent); }; + private _isUnique = getNumber (configFile >> "CfgWeapons" >> _radio >> "acre_isUnique"); + if (_isUnique == 1) then { + if (!([_radio] call EFUNC(sys_data,isRadioInitialized))) then { + WARNING_1("%1 was found in personal inventory but is uninitialized! Trying to collect new ID.",_radio); + _baseRadio = BASECLASS(_radio); + [acre_player, _radio, _baseRadio] call EFUNC(lib,replaceGear); + _radio = _baseRadio; + }; + _currentUniqueItems pushBack _radio; + }; + } forEach _weapons; + //_dif = (GVAR(oldUniqueItemList) + _currentUniqueItems) - (GVAR(oldUniqueItemList) arrayIntersect _currentUniqueItems); same speed.. + private _dif1 = GVAR(oldUniqueItemList) - _currentUniqueItems; + private _dif2 = _currentUniqueItems - GVAR(oldUniqueItemList); + private _dif = _dif1 + _dif2; + if ((count _dif) > 0) then { { - if (GVAR(requestingNewId)) exitWith { }; - _radio = _x; - _hasUnique = getNumber (configFile >> "CfgWeapons" >> _radio >> "acre_hasUnique"); - if (_hasUnique == 1 || _radio == "ItemRadio") then { - - GVAR(requestingNewId) = true; - if (_radio == "ItemRadio") then { - _radio = GVAR(defaultItemRadioType); - [acre_player, "ItemRadio", _radio] call EFUNC(lib,replaceGear); - }; - TRACE_1("Getting ID for", _radio); - if (diag_tickTime-ACRE_SERVER_GEAR_DESYNC_TIME < 60) then { - ACRE_SERVER_GEAR_DESYNC_REQUESTCOUNT = ACRE_SERVER_GEAR_DESYNC_REQUESTCOUNT + 1; - if (ACRE_SERVER_GEAR_DESYNC_REQUESTCOUNT > 10 && !ACRE_SERVER_GEAR_DESYNC_CHECK) then { - ACRE_SERVER_GEAR_DESYNC_CHECK = true; + if (_x in _currentUniqueItems) then { + [(_currentUniqueItems select 0)] call EFUNC(sys_radio,setActiveRadio); + } else { + if (_x == ACRE_ACTIVE_RADIO) then { + if (_x == ACRE_BROADCASTING_RADIOID) then { + // simulate a key up event to end the current transmission + [] call EFUNC(sys_core,handleMultiPttKeyPressUp); + }; + if ((count _currentUniqueItems) > 0) then { + [_currentUniqueItems select 0] call EFUNC(sys_radio,setActiveRadio); + } else { + [""] call EFUNC(sys_radio,setActiveRadio); }; - } else { - ACRE_SERVER_GEAR_DESYNC_TIME = diag_tickTime; - ACRE_SERVER_GEAR_DESYNC_REQUESTCOUNT = 0; }; - - - ["acre_getRadioId", [acre_player, _radio, QGVAR(returnRadioId)]] call CALLSTACK(CBA_fnc_globalEvent); - }; - _isUnique = getNumber (configFile >> "CfgWeapons" >> _radio >> "acre_isUnique"); - if (_isUnique == 1) then { - if (!([_radio] call EFUNC(sys_data,isRadioInitialized))) then { - WARNING_1("%1 was found in personal inventory but is uninitialized! Trying to collect new ID.",_radio); - _baseRadio = BASECLASS(_radio); - [acre_player, _radio, _baseRadio] call EFUNC(lib,replaceGear); - _radio = _baseRadio; - }; - _currentUniqueItems pushBack _radio; + if (ACRE_HOLD_OFF_ITEMRADIO_CHECK) then { + ACRE_HOLD_OFF_ITEMRADIO_CHECK = false; + acre_player assignItem "ItemRadioAcreFlagged"; }; - } forEach _weapons; - - //_dif = (GVAR(oldUniqueItemList) + _currentUniqueItems) - (GVAR(oldUniqueItemList) arrayIntersect _currentUniqueItems); same speed.. - _dif1 = GVAR(oldUniqueItemList) - _currentUniqueItems; - _dif2 = _currentUniqueItems - GVAR(oldUniqueItemList); - _dif = _dif1 + _dif2; - if ((count _dif) > 0) then { - { - acre_player unassignItem _x; - if (_x in _currentUniqueItems) then { - [(_currentUniqueItems select 0)] call EFUNC(sys_radio,setActiveRadio); - } else { - if (_x == ACRE_ACTIVE_RADIO) then { - if (_x == ACRE_BROADCASTING_RADIOID) then { - // simulate a key up event to end the current transmission - [] call EFUNC(sys_core,handleMultiPttKeyPressUp); - }; - if ((count _currentUniqueItems) > 0) then { - [_currentUniqueItems select 0] call EFUNC(sys_radio,setActiveRadio); - } else { - [""] call EFUNC(sys_radio,setActiveRadio); - }; - }; - }; - if (ACRE_HOLD_OFF_ITEMRADIO_CHECK) then { - ACRE_HOLD_OFF_ITEMRADIO_CHECK = false; - acre_player assignItem "ItemRadioAcreFlagged"; - }; - } forEach _dif; - }; - GVAR(oldUniqueItemList) = _currentUniqueItems; - // if (!("ItemRadioAcreFlagged" in (assignedItems acre_player))) then { acre_player assignItem "ItemRadioAcreFlagged" }; + } forEach _dif; }; + GVAR(oldUniqueItemList) = _currentUniqueItems; + // if (!("ItemRadioAcreFlagged" in (assignedItems acre_player))) then { acre_player assignItem "ItemRadioAcreFlagged" }; + }; -ADDPFH(DFUNC(monitorRadios_PFH), 0.25, []); + +[{ACRE_DATA_SYNCED && {(!isNil "ACRE_SERVER_INIT")} && {time >= 1}},{ + ADDPFH(FUNC(monitorRadios_PFH), 0.25, []); +},[]] call CBA_fnc_waitUntilAndExecute; + DFUNC(handleDesyncCheck) = { params ["_player", "_isDesynced"]; if (_player == acre_player) then { - if (_isDesynced && ("ACRE_TestGearDesyncItem" in (items acre_player))) then { + if (_isDesynced && {"ACRE_TestGearDesyncItem" in (items acre_player)}) then { acre_player removeItem "ACRE_TestGearDesyncItem"; ACRE_SERVER_GEAR_DESYNCED = true; ACRE_SERVER_DESYNCED_PLAYERS pushBack _player; @@ -187,7 +170,7 @@ DFUNC(checkServerDesyncBug) = { }; }; -ADDPFH(DFUNC(checkServerDesyncBug), 1, []); +ADDPFH(FUNC(checkServerDesyncBug), 1, []); DFUNC(hasGearDesync) = { if (ACRE_SERVER_GEAR_DESYNCED) then { @@ -202,4 +185,4 @@ DFUNC(hasGearDesync) = { }; }; -ADDPFH(DFUNC(hasGearDesync), 10, []); +ADDPFH(FUNC(hasGearDesync), 10, []);