0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:50:43 -05:00

Optimisation: addAmmoIntoEquipmentSlots(), if it fails because of lack of space, break out of loop and skip trying to add remaining ammo

This commit is contained in:
Dev 2023-11-24 15:35:19 +00:00
parent a0016ae2fa
commit 5a2f6b7581

View File

@ -132,9 +132,15 @@ export class BotWeaponGeneratorHelper
ammoItem,
], inventory);
if (result === ItemAddedResult.NO_SPACE)
if (result !== ItemAddedResult.SUCCESS)
{
this.logger.debug(`Unable to add ammo: ${ammoItem._tpl} to bot equipment`);
this.logger.debug(`Unable to add ammo: ${ammoItem._tpl} to bot equipment, ${ItemAddedResult[result]}`);
if (result === ItemAddedResult.NO_SPACE)
{
// If there's no space for 1 stack, there's no space for the others
break;
}
}
}
}