Created
May 7, 2023 03:18
Star
You must be signed in to star a gist
Arma3. '["Preload"] call BIS_fnc_arsenal' wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Wrapper over '["Preload"] call BIS_fnc_arsenal' | |
//To be spawned once on mission start AFTER arsenal list is composed and fed | |
//by Asmo | |
#define STATS_WEAPONS\ | |
["reloadtime","dispersion","maxzeroing","hit","mass","initSpeed"],\ | |
[true,true,false,true,false,false] | |
#define STATS_EQUIPMENT\ | |
["passthrough","armor","maximumLoad","mass"],\ | |
[false,false,false,false] | |
//Preloads the arsenal with all the configse | |
//Usage example: [] spawn NWG_fnc_arsenalPreload | |
NWG_fnc_arsenalPreload = { | |
//Preload most of the arsenal | |
["Preload"] call BIS_fnc_arsenal; | |
//Preload weapon stats | |
if (isnil {uinamespace getvariable "BIS_fnc_arsenal_weaponStats"}) then { | |
uinamespace setvariable [ | |
"BIS_fnc_arsenal_weaponStats", | |
[ | |
("getnumber (_x >> 'scope') == 2 && {getnumber (_x >> 'type') < 5}") configclasses (configfile >> "cfgweapons"), | |
STATS_WEAPONS | |
] call bis_fnc_configExtremes | |
]; | |
}; | |
//Preload equipment stats | |
if (isnil {uinamespace getvariable "BIS_fnc_arsenal_equipmentStats"}) then { | |
private _statsEquipment = [ | |
("getnumber (_x >> 'scope') == 2 && {(getnumber (_x >> 'itemInfo' >> 'type')) in [605,701,801]}") configclasses (configfile >> "cfgweapons"), | |
STATS_EQUIPMENT | |
] call bis_fnc_configExtremes; | |
private _statsBackpacks = [ | |
("getnumber (_x >> 'scope') == 2 && {(getnumber (_x >> 'isBackpack')) == 1}") configclasses (configfile >> "cfgvehicles"), | |
STATS_EQUIPMENT | |
] call bis_fnc_configExtremes; | |
private _statsEquipmentMin = _statsEquipment#0; | |
private _statsEquipmentMax = _statsEquipment#1; | |
private _statsBackpacksMin = _statsBackpacks#0; | |
private _statsBackpacksMax = _statsBackpacks#1; | |
for "_i" from 2 to 3 do { //--- Ignore backpack armor and passThrough, has no effect | |
_statsEquipmentMin set [_i,((_statsEquipmentMin#_i) min (_statsBackpacksMin#_i))]; | |
_statsEquipmentMax set [_i,((_statsEquipmentMax#_i) max (_statsBackpacksMax#_i))]; | |
}; | |
uinamespace setvariable ["BIS_fnc_arsenal_equipmentStats",[_statsEquipmentMin,_statsEquipmentMax]]; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment