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

Arsenal - Fix Rate Of Fire stat #6385

Merged
merged 2 commits into from
Jun 9, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion addons/arsenal/ACE_Arsenal_Stats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GVAR(stats) {
displayName= "$STR_a3_rscdisplayarsenal_stat_rof";
showBar = 1;
showText = 1;
barStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_2([ARR_2(-1.4, 0.31)], [ARR_2(1, 0.01)])])] call FUNC(statBarStatement_default));
barStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_2([ARR_2(-1.4, 0.31)], [ARR_2(1, 0.01)])])] call FUNC(statBarStatement_rateOfFIre));
textStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_2([ARR_2(-1.4, 0.31)], false)])] call FUNC(statTextStatement_rateOfFire));
tabs[] = {{0,1}, {}};
};
Expand Down
1 change: 1 addition & 0 deletions addons/arsenal/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ PREP(sortPanel);
PREP(statBarStatement_accuracy);
PREP(statBarStatement_default);
PREP(statBarStatement_impact);
PREP(statBarStatement_rateOfFIre);
PREP(statTextStatement_accuracy);
PREP(statTextStatement_mass);
PREP(statTextStatement_rateOfFire);
Expand Down
31 changes: 31 additions & 0 deletions addons/arsenal/functions/fnc_statBarStatement_rateOfFIre.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Author: Alganthe
* Rate of fire bar statement.
*
* Arguments:
* 0: stats array (ARRAY)
* 1: item config path (CONFIG)
* 2: Args
* 2.1: Stat limits (ARRAY of BOOL)
* 2.2: Bar limits (ARRAY of SCALAR)
*
* Return Value:
* Number
*
* Public: No
*/
#include "script_component.hpp"

params ["_stat", "_config", "_args"];
_args params ["_statMinMax", "_barLimits"];

private _fireModes = getArray (_config >> "modes");
private _fireRate = [];

{
_fireRate pushBackUnique log (getNumber (_config >> _x >> "reloadTime"));
} foreach _fireModes;

_fireRate sort true;

linearConversion [_statMinMax select 0, _statMinMax select 1, _fireRate select 0, _barLimits select 0, _barLimits select 1]
19 changes: 11 additions & 8 deletions addons/arsenal/functions/fnc_statTextStatement_rateOfFire.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Author: Alganthe
* ROF text statement.
* Rate of fire text statement.
*
* Arguments:
* 0: stat (STRING)
Expand All @@ -19,11 +19,14 @@
params ["_stat", "_config", "_args"];
_args params ["_statMinMax", "_configExtremeBool"];

private _statValues = [
[_config],
[_stat],
[_configExtremeBool],
[_statMinMax select 0]
] call BIS_fnc_configExtremes;
private _fireModes = getArray (_config >> "modes");
private _fireRate = [];

format ["%1 rpm", round (60 / ((_statValues select 1) select 0))]
{
_fireRate pushBackUnique (getNumber (_config >> _x >> "reloadTime"));
} foreach _fireModes;

_fireRate sort true;
_fireRate = _fireRate select 0;

format ["%1 rpm", round (60 / _fireRate)]