mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
Duping of bipods pt1 #411
see notes: https://github.com/EpochModTeam/Epoch/issues/411
This commit is contained in:
parent
9694b3dfb1
commit
3d13a2216c
@ -35,13 +35,14 @@ if (!isNull _vehicle) then {
|
||||
if (isNil "_magsAmmoCargo") then {
|
||||
_magsAmmoCargo = [];
|
||||
};
|
||||
|
||||
|
||||
{
|
||||
_cargo = _x select 1;
|
||||
_magsAmmoCargox = magazinesAmmoCargo _cargo;
|
||||
{
|
||||
_magsAmmoCargo pushback _x;
|
||||
} foreach _magsAmmoCargox;
|
||||
|
||||
_wepsItemsCargox = weaponsItemsCargo _cargo;
|
||||
{
|
||||
_wepsItemsCargo pushback _x;
|
||||
@ -62,8 +63,30 @@ if (!isNull _vehicle) then {
|
||||
};
|
||||
} forEach _magsAmmoCargo;
|
||||
|
||||
// convert and normalize
|
||||
_wepsItemsCargoNormalized = [];
|
||||
{
|
||||
_selectedWeaponComponents = _x;
|
||||
_selectedWeapon = _selectedWeaponComponents deleteAt 0;
|
||||
// find actual weapon components - todo this BIS call maybe slow
|
||||
_weaponComponents = _selectedWeapon call BIS_fnc_weaponComponents;
|
||||
// base weapon (without attachments)
|
||||
_weapon = _weaponComponents deleteAt 0;
|
||||
_newComponents = [];
|
||||
{
|
||||
// remove attachments that are already linked via config
|
||||
if (_x isEqualType "" && {(tolower _x) in _weaponComponents}) then {
|
||||
_newComponents pushBack "";
|
||||
//diag_log format ["DEBUG: suppressed saving of %1 for weapon %2 config %3", _x, [_selectedWeapon,_selectedWeaponComponents],[_weapon,_weaponComponents]];
|
||||
} else {
|
||||
_newComponents pushBack _x;
|
||||
};
|
||||
} forEach _selectedWeaponComponents;
|
||||
_wepsItemsCargoNormalized pushBack ([_selectedWeapon] + _newComponents);
|
||||
} forEach _wepsItemsCargo;
|
||||
|
||||
_inventory = [
|
||||
_wepsItemsCargo,
|
||||
_wepsItemsCargoNormalized,
|
||||
_magsAmmoCargoMinimized,
|
||||
getBackpackCargo _vehicle,
|
||||
getItemCargo _vehicle
|
||||
|
@ -34,7 +34,7 @@ if (!isNull _vehicle) then {
|
||||
if (isNil "_magsAmmoCargo") then {
|
||||
_magsAmmoCargo = [];
|
||||
};
|
||||
|
||||
|
||||
{
|
||||
_cargo = _x select 1;
|
||||
_magsAmmoCargox = magazinesAmmoCargo _cargo;
|
||||
@ -61,8 +61,34 @@ if (!isNull _vehicle) then {
|
||||
};
|
||||
} forEach _magsAmmoCargo;
|
||||
|
||||
// convert and normalize
|
||||
_startTime = diag_tickTime;
|
||||
//diag_log format ["DEBUG: BIS_fnc_weaponComponents start %1", _startTime];
|
||||
_wepsItemsCargoNormalized = [];
|
||||
{
|
||||
_selectedWeaponComponents = _x;
|
||||
_selectedWeapon = _selectedWeaponComponents deleteAt 0;
|
||||
// find actual weapon components - todo this BIS call maybe slow
|
||||
_weaponComponents = _selectedWeapon call BIS_fnc_weaponComponents;
|
||||
//diag_log format ["DEBUG: BIS_fnc_weaponComponents end %1", diag_tickTime - _startTime];
|
||||
// base weapon (without attachments)
|
||||
_weapon = _weaponComponents deleteAt 0;
|
||||
_newComponents = [];
|
||||
{
|
||||
// remove attachments that are already linked via config
|
||||
if (_x isEqualType "" && {(tolower _x) in _weaponComponents}) then {
|
||||
_newComponents pushBack "";
|
||||
//diag_log format ["DEBUG: suppressed saving of %1 for weapon %2 config %3", _x, [_selectedWeapon,_selectedWeaponComponents],[_weapon,_weaponComponents]];
|
||||
} else {
|
||||
_newComponents pushBack _x;
|
||||
};
|
||||
} forEach _selectedWeaponComponents;
|
||||
_wepsItemsCargoNormalized pushBack ([_selectedWeapon] + _newComponents);
|
||||
} forEach _wepsItemsCargo;
|
||||
// diag_log format ["DEBUG: convert and normalize end %1", diag_tickTime - _startTime];
|
||||
|
||||
_inventory = [
|
||||
_wepsItemsCargo,
|
||||
_wepsItemsCargoNormalized,
|
||||
_magsAmmoCargoMinimized,
|
||||
getBackpackCargo _vehicle,
|
||||
getItemCargo _vehicle
|
||||
|
Loading…
Reference in New Issue
Block a user