mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
1d6e07d18f
* Add test class * Add stats mockup * Merge branch 'master' of https://github.com/acemod/ACE3 into arsenalStats * Finish mockup, add basic hide/show logic * Add base for stats * Use CBA EHs for stats to allow 3rd party mods of it * Add handleStats and most of the UI behaviors for stats * Continue work on stats * Add container stats * Add page support for stats * Add text for the ROF stat * Add accuracy in MOA for the accuracy stat * Change accuracy shown number to 1 decimal instead of 2 * Add MIL in the dispersion stat text * Change stats layout, remove dummy text strings * Add some AB stats * Remove last test string * Replace configExtremes by normal lookup where it's relevant * Add "undefined value" string when AB stat isn't present Mostly for laucnhers * Fix typo in preInit * Change drag model stat to ballistic coef * Fix issue with unused stats, change text to white when bar is present * Rewrite some part of handleStats Reason: add support for conditions, less redundant code, less reasons for dedmen to emasculate me * Re-add _hideUnusedFnc, handle empty stats arrays * Pass args to stat conditions, add test condition stat * Add hearing related stats * Remove the padding between stats and the stat bar / text * Add strings for stats * Change stats window to fit baer's suggestion * Algin the close stats button, add missing strings * Finish code review * Add missing newline * Remove duplicate strings * Add explosive range stat * Use proper string for the explo range stat * Fix capitalization for ctrlParent * Fix conditional stats blocking other stats * Add better integration for ballistics, hearing and explosive stats * Replace the private array in handleStat by params * Add backblast stats * Add backblast stat strings * Add flashlight map color and g-force reduction stats * Shorten preInit * Change stats close button to fit arsenal design * Improve stats page indicator look * Rework how stats are stored and retrieved * Remove args config entry, add priority entry, add vanilla weapon stats * Add vanilla container stats * Remove some lines in preInit * Add ballistics stats * Add hearing stats * Remove uneeded config entries * Add explosive range stat * Add backblast stats * Add spaces after semicolons in statements To make JJ happy because I don't care. * Add flashlights map color stat * Add gforce reduction stat FINALLY FUCKING DONE * Fix headers for the new stats funcs * Add add / remove stat API * Fix typo in removeStat header * Remove uneeded inline func * Clean up add / remove stat * Move all CfgACEArsenalStats entries to their own file * Replace STR_ACE_Ballistics_statAmmo by a BI string * Add script profiler related macro and code * Use the highest ballistic coef instead of first one defined * Add support for future ammo displayname * Add ACE_standardAtmosphere for ballistic coef * Add mag muzzle velocity stat * Add weapon muzzle velocity stat * Add comment explaining the ENABLE_PERF_PROFILING macro * Change cfgACEArsenalStats to ACE_Arsenal_Stats * Make JJ less pissy about spaces around = * Fix indentation in weaponMuzzleVelocity, use param * Use GVAR and EGVAR when appropriate * Prefix all stats except the base class * Fix Merge * Fix aspect ratio scaling of stats panel * Minor fixes
134 lines
3.6 KiB
Plaintext
134 lines
3.6 KiB
Plaintext
/*
|
|
* Author: Alganthe
|
|
* Create the internal stats arrays on preStart
|
|
*
|
|
* Arguments:
|
|
* None
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Public: No
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
private _fnc_addToTabs = {
|
|
params ["_tabsList", "_tabsToAddTo", "_sideString"];
|
|
{
|
|
private _currentTab = _tabsList select _x;
|
|
private _availablePagesCount = {count _x < 5} count _currentTab;
|
|
|
|
private _arrayToSave = +_finalArray;
|
|
_arrayToSave set [0, ([_class, _sideString, [str _x, format ["0%1", _x]] select (_x < 10)] joinString "")];
|
|
|
|
if (_availablePagesCount > 0) then {
|
|
|
|
{
|
|
if (count _x < 5) exitWith {
|
|
(_currentTab select _forEachIndex) append [_arrayToSave];
|
|
};
|
|
} foreach _currentTab;
|
|
} else {
|
|
_currentTab pushBack [_arrayToSave];
|
|
};
|
|
} foreach _tabsToAddTo;
|
|
};
|
|
|
|
private _fnc_sortLists = {
|
|
params ["_tabsList"];
|
|
|
|
{
|
|
private _page = _x;
|
|
{
|
|
{
|
|
reverse _x;
|
|
} foreach _x;
|
|
|
|
_x sort false;
|
|
|
|
{
|
|
reverse _x;
|
|
} foreach _x;
|
|
} foreach _page;
|
|
} foreach _tabsList;
|
|
};
|
|
|
|
private _statsListLeftPanel = uiNamespace getVariable [QGVAR(statsListLeftPanel), [
|
|
[[]], // Primary 0
|
|
[[]], // Handgun 1
|
|
[[]], // Launcher 2
|
|
[[]], // Uniform 3
|
|
[[]], // Vests 4
|
|
[[]], // Backpacks 5
|
|
[[]], // Headgear 6
|
|
[[]], // Goggles 7
|
|
[[]], // NVGs 8
|
|
[[]], // Binoculars 9
|
|
[[]], // Map 10
|
|
[[]], // GPS 11
|
|
[[]], // Radio 12
|
|
[[]], // Compass 13
|
|
[[]] // Watch 14
|
|
]];
|
|
|
|
private _statsListRightPanel = uiNamespace getVariable [QGVAR(statsListRightPanel), [
|
|
[[]], // Optics 0
|
|
[[]], // Side accs 1
|
|
[[]], // Muzzle 2
|
|
[[]], // Bipod 3
|
|
[[]], // Mag 4
|
|
[[]], // Throw 5
|
|
[[]], // Put 6
|
|
[[]] // Misc 7
|
|
]];
|
|
|
|
//------------------------- Config handling
|
|
private _configEntries = "(getNumber (_x >> 'scope')) == 2" configClasses (configFile >> QGVAR(stats));
|
|
|
|
{
|
|
private _finalArray = [];
|
|
|
|
private _class = configName _x;
|
|
private _stats = getArray (_x >> "stats");
|
|
private _displayName = getText (_x >> "displayName");
|
|
private _showBar = getNumber (_x >> "showBar") == 1;
|
|
private _showText = getNumber (_x >> "showText") == 1;
|
|
private _condition = getText (_x >> "condition");
|
|
private _priority = getNumber (_x >> "priority");
|
|
(getArray (_x >> "tabs")) params ["_leftTabsList", "_rightTabsList"];
|
|
|
|
if (_condition != "") then {
|
|
_condition = compile _condition;
|
|
};
|
|
|
|
_finalArray = ["", _stats, _displayName, [_showBar, _showText], [{}, {}, _condition], _priority];
|
|
|
|
if (_showBar) then {
|
|
private _barStatement = compile (getText (_x >> "barStatement"));
|
|
(_finalArray select 4) set [0, _barStatement];
|
|
};
|
|
|
|
if (_showText) then {
|
|
private _textStatement = compile (getText (_x >> "textStatement"));
|
|
(_finalArray select 4) set [1, _textStatement];
|
|
};
|
|
|
|
TRACE_3("stats array", _finalArray, _leftTabsList, _rightTabsList);
|
|
|
|
if (count _leftTabsList > 0) then {
|
|
[_statsListLeftPanel, _leftTabsList, "L"] call _fnc_addToTabs;
|
|
};
|
|
|
|
if (count _rightTabsList > 0) then {
|
|
[_statsListRightPanel, _rightTabsList, "R"] call _fnc_addToTabs;
|
|
};
|
|
} foreach _configEntries;
|
|
|
|
[_statsListLeftPanel] call _fnc_sortLists;
|
|
[_statsListRightPanel] call _fnc_sortLists;
|
|
|
|
//------------------------- Config Handling
|
|
|
|
uiNamespace setVariable [QGVAR(statsListLeftPanel), _statsListLeftPanel];
|
|
uiNamespace setVariable [QGVAR(statsListRightPanel), _statsListRightPanel];
|