fix: clear undefined slots
This commit is contained in:
parent
a0943c8bbb
commit
49f46b4b00
|
@ -194,6 +194,12 @@ export default class Inventory extends Component {
|
||||||
const tmp = [$$items[l], slots[l]];
|
const tmp = [$$items[l], slots[l]];
|
||||||
[$$items[l], slots[l]] = [$$items[r], slots[r]];
|
[$$items[l], slots[l]] = [$$items[r], slots[r]];
|
||||||
[$$items[r], slots[r]] = tmp;
|
[$$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]]);
|
Component.markChange(this.entity, 'swapped', [[l, r]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user