From 3a445e021c05ffae8bbe567092a3b910a32b64c3 Mon Sep 17 00:00:00 2001 From: "Alivemonstor [Jayden]" <79489495+Alivemonstor@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:23:48 +0000 Subject: [PATCH] Fix overweight issue --- html/app.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/html/app.js b/html/app.js index 1b885987..ae83097e 100644 --- a/html/app.js +++ b/html/app.js @@ -240,6 +240,8 @@ const InventoryContainer = Vue.createApp({ moveItemBetweenInventories(item, sourceInventoryType) { const sourceInventory = sourceInventoryType === "player" ? this.playerInventory : this.otherInventory; const targetInventory = sourceInventoryType === "player" ? this.otherInventory : this.playerInventory; + const targetWeight = sourceInventoryType === "player" ? this.otherInventoryWeight : this.playerWeight ; + const maxTargetWeight = sourceInventoryType === "player" ? this.otherInventoryMaxWeight : this.maxWeight ; const amountToTransfer = this.transferAmount !== null ? this.transferAmount : 1; let targetSlot = null; @@ -248,9 +250,10 @@ const InventoryContainer = Vue.createApp({ this.inventoryError(item.slot); return; } + + const totalWeightAfterTransfer = targetWeight + sourceItem.weight * amountToTransfer; - const totalWeightAfterTransfer = this.otherInventoryWeight + sourceItem.weight * amountToTransfer; - if (totalWeightAfterTransfer > this.otherInventoryMaxWeight) { + if (totalWeightAfterTransfer > maxTargetWeight) { this.inventoryError(item.slot); return; }