diff --git a/app/ecs/components/inventory.js b/app/ecs/components/inventory.js index 633efb1..4694787 100644 --- a/app/ecs/components/inventory.js +++ b/app/ecs/components/inventory.js @@ -194,6 +194,12 @@ export default class Inventory extends Component { const tmp = [$$items[l], slots[l]]; [$$items[l], slots[l]] = [$$items[r], slots[r]]; [$$items[r], slots[r]] = tmp; + if (undefined === slots[l]) { + delete slots[l]; + } + if (undefined === slots[r]) { + delete slots[r]; + } Component.markChange(this.entity, 'swapped', [[l, r]]); } }