2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2018-06-09 17:43:53 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_stat", "_config", "_args"];
|
|
|
|
_args params ["_statMinMax", "_barLimits"];
|
|
|
|
|
|
|
|
private _fireModes = getArray (_config >> "modes");
|
|
|
|
private _fireRate = [];
|
|
|
|
|
|
|
|
{
|
2019-01-26 20:13:19 +00:00
|
|
|
private _n = log (getNumber (_config >> _x >> "reloadTime"));
|
|
|
|
if (!finite _n) then {_n = 0;};
|
|
|
|
_fireRate pushBackUnique _n;
|
2018-06-09 17:43:53 +00:00
|
|
|
} foreach _fireModes;
|
|
|
|
|
|
|
|
_fireRate sort true;
|
|
|
|
|
2018-06-10 05:14:14 +00:00
|
|
|
linearConversion [_statMinMax select 0, _statMinMax select 1, _fireRate param [0, 0], _barLimits select 0, _barLimits select 1]
|