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

Stats - Only show Encryption code stat for radios #1572

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
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
3 changes: 3 additions & 0 deletions addons/core/XEH_PREP.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ PREP_SUB2(ACEInteraction,getStereoChildren);
PREP_SUB2(ACEInteraction,getTakeChildren);
PREP_SUB2(ACEInteraction,takeRadio);

PREP_SUB(stats,statCondition_encryptionCode);
PREP_SUB(stats,statCondition_isRadio);

// /Events
PREP_SUB(events\handler,addEventHandler);
PREP_SUB(events\handler,fireEventHandlers);
Expand Down
2 changes: 1 addition & 1 deletion addons/core/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class ace_arsenal_stats {
displayName = "Encryption Code";//#Todo Translate
showText= 1;
textStatement = QUOTE(params [ARR_2('_stat', '_config')]; private _enc = getText (_config >> _stat select 0); _enc);
condition = QUOTE(params [ARR_2('_stat', '_config')]; isText (_config >> _stat select 0) && (getText (_config >> _stat select 0) != ''));
condition = QUOTE(call TFAR_fnc_statCondition_encryptionCode);
tabs[] = {{12, 5}, {}};
};
};
Expand Down
24 changes: 24 additions & 0 deletions addons/core/functions/stats/fnc_statCondition_encryptionCode.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "script_component.hpp"

/*
Name: TFAR_fnc_statCondition_encryptionCode

Author: DartRuffian
Checks if an item is a radio and has an encyrption code

Arguments:
Stats - Stats to use <ARRAY>
Config - Config path to item <CONFIG>

Return Value:
True if item has an encryption code and is a radio, otherwise false <BOOL>

Example:
[["tf_encryptionCode"], _config] call TFAR_fnc_statCondition_encryptionCode

Public: No
*/

params ["_stats", "_config"];

[["tf_hasLRradio", "tf_radio"], _config] call TFAR_fnc_statCondition_isRadio && {getNumber (_config >> _stats select 0) != ""}
24 changes: 24 additions & 0 deletions addons/core/functions/stats/fnc_statCondition_isRadio.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "script_component.hpp"

/*
Name: TFAR_fnc_statCondition_isRadio

Author: DartRuffian
Checks if a given item is a SR or LR radio

Arguments:
Stats - Stats to use <ARRAY>
Config - Config path to item <CONFIG>

Return Value:
True if given item is a radio, otherwise. <BOOL>

Example:
[["tf_hasLRradio", "tf_radio"], _config] call TFAR_fnc_statCondition_isRadio

Public: No
*/

params ["_stats", "_config"];

getNumber (_config >> _stats select 0) == 1 || {getNumber (_config >> _stats select 1) == 1}