Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys_core cleanup - document, cleanup #171

Merged
merged 3 commits into from
Jan 15, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions addons/sys_core/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,3 @@ PREP(utilityFunction);
PREP(disableRevealAI);
PREP(enableRevealAI);
PREP(onRevealUnit);

PREP(formatNumber);
12 changes: 6 additions & 6 deletions addons/sys_core/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};

Expand Down
9 changes: 0 additions & 9 deletions addons/sys_core/curve.txt

This file was deleted.

12 changes: 6 additions & 6 deletions addons/sys_core/fnc_addLanguageType.sqf
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* Author: ACRE2Team
* SHORT DESCRIPTION
* Babel add a new language.
*
* Arguments:
* 0: ARGUMENT ONE <TYPE>
* 1: ARGUMENT TWO <TYPE>
* 0: Language key name <STRING>
* 1: Language display name <STRING>
*
* Return Value:
* RETURN VALUE <TYPE>
* None
*
* Example:
* [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME
* ["en", "English"] call acre_sys_core_fnc_addLanguageType
*
* Public: No
*/
#include "script_component.hpp"

params ["_languageKey", "_languageName"];

PUSH(GVAR(languages), [ARR_2(_languageKey,_languageName)]);
GVAR(languages) pushBack [_languageKey, _languageName];
18 changes: 7 additions & 11 deletions addons/sys_core/fnc_aliveMonitor.sqf
Original file line number Diff line number Diff line change
@@ -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 <TYPE>
* 1: ARGUMENT TWO <TYPE>
* None
*
* Return Value:
* RETURN VALUE <TYPE>
* None
*
* Example:
* [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME
* [] call acre_sys_core_fnc_aliveMonitor
*
* Public: No
*/
Expand All @@ -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 {
Expand All @@ -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
31 changes: 12 additions & 19 deletions addons/sys_core/fnc_callExt.sqf
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
/*
* Author: ACRE2Team
* SHORT DESCRIPTION
* This function is used to make calls in acre.dll
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing final point.

*
* Arguments:
* 0: ARGUMENT ONE <TYPE>
* 1: ARGUMENT TWO <TYPE>
* 0: Command <STRING>
* 1: Parameters <ANY>
* 2: Threaded call if so uses the following arguments to handle the return <BOOLEAN> (optional)
* 3: Callback code <CODE> (optional)
* 4: Return arguments <ANY> (optional)
*
* Return Value:
* RETURN VALUE <TYPE>
* Return from call extension <ANY>
*
* 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 = "";
Expand All @@ -29,25 +30,22 @@ if (IS_ARRAY(_params)) then {
if (IS_ARRAY(_element)) then {
{
if (!IS_STRING(_x)) then {
// Convert boolean to number.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No final point.

if (IS_BOOL(_x)) then {
if (_x) then {
_x = 1;
} else {
_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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No final point.

if (IS_BOOL(_element)) then {
if (_element) then {
_element = 1;
Expand All @@ -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 + ",";
};
Expand Down
9 changes: 4 additions & 5 deletions addons/sys_core/fnc_canUnderstand.sqf
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/*
* Author: ACRE2Team
* SHORT DESCRIPTION
* Returns whether the local player's unit can understand the target unit.
*
* Arguments:
* 0: ARGUMENT ONE <TYPE>
* 1: ARGUMENT TWO <TYPE>
* 0: Unit <OBJECT>
*
* Return Value:
* RETURN VALUE <TYPE>
* Can understand <BOOLEAN>
*
* Example:
* [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME
* [unit] call acre_sys_core_fnc_canUnderstand
*
* Public: No
*/
Expand Down
9 changes: 4 additions & 5 deletions addons/sys_core/fnc_cycleLanguage.sqf
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/*
* Author: ACRE2Team
* SHORT DESCRIPTION
* This function is used to cycle the language that the local player is speaking.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cycles the language that the local player is speaking.

This function is used to ... seems very redundant to me.

*
* Arguments:
* 0: ARGUMENT ONE <TYPE>
* 1: ARGUMENT TWO <TYPE>
* None
*
* Return Value:
* RETURN VALUE <TYPE>
* false
*
* Example:
* [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME
* [] call acre_sys_core_fnc_cycleLanguage
*
* Public: No
*/
Expand Down
9 changes: 4 additions & 5 deletions addons/sys_core/fnc_disableRevealAI.sqf
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/*
* Author: ACRE2Team
* SHORT DESCRIPTION
* This function handles stopping the AI reveal check.
*
* Arguments:
* 0: ARGUMENT ONE <TYPE>
* 1: ARGUMENT TWO <TYPE>
* None
*
* Return Value:
* RETURN VALUE <TYPE>
* Handled <BOOLEAN>
*
* Example:
* [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME
* [] call acre_sys_core_fnc_disableRevealAI
*
* Public: No
*/
Expand Down
12 changes: 5 additions & 7 deletions addons/sys_core/fnc_enableRevealAI.sqf
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/*
* Author: ACRE2Team
* SHORT DESCRIPTION
* Enables AI hearing of direct speech.
*
* Arguments:
* 0: ARGUMENT ONE <TYPE>
* 1: ARGUMENT TWO <TYPE>
* None
*
* Return Value:
* RETURN VALUE <TYPE>
* None
*
* Example:
* [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME
* [] call acre_sys_core_fnc_enableRevealAI
*
* Public: No
*/
Expand All @@ -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 {};
Expand Down
11 changes: 6 additions & 5 deletions addons/sys_core/fnc_findOcclusion.sqf
Original file line number Diff line number Diff line change
@@ -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 <TYPE>
* 1: ARGUMENT TWO <TYPE>
* 0: Start position <ARRAY>
* 1: End position <ARRAY>
* 2: Unit <OBJECT>
*
* Return Value:
* RETURN VALUE <TYPE>
* Occlusion <NUMBER>
*
* Example:
* [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME
* [[0,0,0],[11,23,100],unit] call acre_sys_core_fnc_findOcclusion
*
* Public: No
*/
Expand Down
27 changes: 0 additions & 27 deletions addons/sys_core/fnc_formatNumber.sqf

This file was deleted.

15 changes: 7 additions & 8 deletions addons/sys_core/fnc_getAlive.sqf
Original file line number Diff line number Diff line change
@@ -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 <TYPE>
* 1: ARGUMENT TWO <TYPE>
* 0: unit <OBJECT>
*
* Return Value:
* RETURN VALUE <TYPE>
* 0 for false, 1 for true <NUMBER>
*
* Example:
* [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME
* [player] call acre_sys_core_fnc_getAlive
*
* Public: No
*/
Expand All @@ -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;
};
};
Expand Down
14 changes: 8 additions & 6 deletions addons/sys_core/fnc_getClientIdLoop.sqf
Original file line number Diff line number Diff line change
@@ -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 <TYPE>
* 1: ARGUMENT TWO <TYPE>
* None
*
* Return Value:
* RETURN VALUE <TYPE>
* Handled <Boolean>
*
* Example:
* [ARGUMENTS] call acre_COMPONENT_fnc_FUNCTIONNAME
* [] call acre_sys_core_fnc_getClientIdLoop
*
* Public: No
*/
Expand All @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No final point.


true
Loading