From 6a2dddef0e2cf834c5f4548c28bfb5e2b0831dc2 Mon Sep 17 00:00:00 2001 From: cha0s Date: Fri, 18 Oct 2024 05:35:23 -0500 Subject: [PATCH] fix: given/qtyUpdated --- app/ecs/components/inventory.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/ecs/components/inventory.js b/app/ecs/components/inventory.js index 23d5811..476687f 100644 --- a/app/ecs/components/inventory.js +++ b/app/ecs/components/inventory.js @@ -264,7 +264,12 @@ export default class Inventory extends Component { for (let slot = 1; slot < 11; ++slot) { if (slots[slot]?.source === stack.source) { slots[slot].qty += stack.qty; - Component.markChange(this.entity, 'qtyUpdated', {[slot]: stack.qty}); + if (ecs.diff[this.entity]?.Inventory?.given?.[slot]) { + ecs.diff[this.entity].Inventory.given[slot].qty += stack.qty; + } + else { + Component.markChange(this.entity, 'qtyUpdated', {[slot]: stack.qty}); + } return; } }