Skip to content

Commit

Permalink
- Handle an edge case where after removing attachments, we could end …
Browse files Browse the repository at this point in the history
…up with an orphaned attachment in the gun hierarchy
  • Loading branch information
DrakiaXYZ committed Dec 23, 2024
1 parent ad155c7 commit a04028e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion project/src/controllers/InsuranceController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class InsuranceController {
// Create a new root parent ID for the message we'll be sending the player
const rootItemParentID = this.hashUtil.generate();

// Update the insured items to have the new root parent ID for root items
// Update the insured items to have the new root parent ID for root/orphaned items
insured.items = this.itemHelper.adoptOrphanedItems(rootItemParentID, insured.items);

const simulateItemsBeingTaken = this.insuranceConfig.simulateItemsBeingTaken;
Expand All @@ -138,6 +138,9 @@ export class InsuranceController {

// Actually remove them.
this.removeItemsFromInsurance(insured, itemsToDelete);

// There's a chance we've orphaned weapon attachments, so adopt any orphaned items again
insured.items = this.itemHelper.adoptOrphanedItems(rootItemParentID, insured.items);
}

// Send the mail to the player.
Expand Down

0 comments on commit a04028e

Please sign in to comment.