From 997ef691caaf4102a7dbf893be8cdc7851b8ee72 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 29 Sep 2024 02:19:37 -0500 Subject: [PATCH] fix: inventory self-swapping --- app/ecs/components/inventory.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/ecs/components/inventory.js b/app/ecs/components/inventory.js index 948e27a..8a2ff44 100644 --- a/app/ecs/components/inventory.js +++ b/app/ecs/components/inventory.js @@ -215,7 +215,9 @@ export default class Inventory extends Component { delete otherSlots[r]; } Component.markChange(this.entity, 'swapped', [[l, OtherInventory.entity, r]]); - Component.markChange(OtherInventory.entity, 'swapped', [[r, this.entity, l]]); + if (this.entity !== OtherInventory.entity) { + Component.markChange(OtherInventory.entity, 'swapped', [[r, this.entity, l]]); + } } toNet(recipient, data) { if (recipient.id !== this.entity && this !== recipient.Player.openInventory) {