Skip to content

Commit

Permalink
Updated static loot generation to better handle malformed modded items
Browse files Browse the repository at this point in the history
  • Loading branch information
Chomp committed Jan 11, 2025
1 parent 0b287a8 commit 6081a19
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions project/src/generators/LocationLootGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }];
Expand Down

0 comments on commit 6081a19

Please sign in to comment.