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

Updated static loot generation to better handle malformed modded items

This commit is contained in:
Chomp 2025-01-11 09:08:51 +00:00
parent 0b287a831a
commit 6081a19cab

View File

@ -429,6 +429,9 @@ export class LocationLootGenerator {
const tplsToAddToContainer = tplsForced.concat(chosenTpls);
for (const tplToAdd of tplsToAddToContainer) {
const chosenItemWithChildren = this.createStaticLootItem(tplToAdd, staticAmmoDist, parentId);
if (!chosenItemWithChildren) {
continue;
}
const items = this.locationConfig.tplsToStripChildItemsFrom.includes(tplToAdd)
? [chosenItemWithChildren.items[0]] // Strip children from parent
@ -956,6 +959,11 @@ export class LocationLootGenerator {
parentId?: string,
): IContainerItem {
const itemTemplate = this.itemHelper.getItem(chosenTpl)[1];
if (!itemTemplate._props) {
this.logger.error(`Unable to process item: ${chosenTpl}. it lacks _props`);
return undefined;
}
let width = itemTemplate._props.Width;
let height = itemTemplate._props.Height;
let items: IItem[] = [{ _id: this.hashUtil.generate(), _tpl: chosenTpl }];