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

Enable rebel AI to use rifle+muzzle combo grenade launchers #2899

Merged
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
17 changes: 17 additions & 0 deletions A3A/addons/core/functions/Ammunition/fn_categoryOverrides.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -442,3 +442,20 @@ A3A_categoryOverrides = false call A3A_fnc_createNamespace;
{
A3A_categoryOverrides setVariable [_x select 0, _x select 1];
} forEach _categoryOverrideTable;


A3A_specialGrenadeLaunchers = createHashMap;
{
private _class = _x#0;
private _config = configFile >> "CfgWeapons" >> _class;
if !(isClass _config) then { continue };

private _baseWeapon = getText (_config >> "baseWeapon");
if (_baseWeapon == "") then { continue };

private _muzzle = getText (_config >> "LinkedItems" >> "LinkedItemsMuzzle" >> "item");
if (_muzzle == "") then { continue };

A3A_specialGrenadeLaunchers set [_class, [_baseWeapon, _muzzle]];

} forEach (_categoryOverrideTable select { "GrenadeLaunchers" in _x#1 });
11 changes: 11 additions & 0 deletions A3A/addons/core/functions/Ammunition/fn_generateRebelGear.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ private _gl = [];
};
} forEach (jna_dataList select IDC_RSCDISPLAYARSENAL_TAB_PRIMARYWEAPON);

if (count A3A_specialGrenadeLaunchers > 0) then {
// muzzle + base grenade launchers, broken down in the arsenal
private _rifleHM = createHashMapFromArray (jna_dataList select IDC_RSCDISPLAYARSENAL_TAB_PRIMARYWEAPON);
private _muzzleHM = createHashMapFromArray (jna_dataList select IDC_RSCDISPLAYARSENAL_TAB_ITEMMUZZLE);
{
private _weapCount = _rifleHM getOrDefault [_y#0, 0];
if (_weapCount >= 0 and _weapCount < 2*ITEM_MIN) then { continue }; // slightly hacky but whatever
[_gl, _x, _muzzleHM getOrDefault [_y#1, 0]] call _fnc_addItem;
} forEach A3A_specialGrenadeLaunchers;
};

_rebelGear set ["Rifles", _rifle];
_rebelGear set ["SMGs", _smg];
_rebelGear set ["Shotguns", _shotgun];
Expand Down