fix: inventory self-swapping

This commit is contained in:
cha0s 2024-09-29 02:19:37 -05:00
parent 0cb5cdbe1f
commit 997ef691ca

View File

@ -215,7 +215,9 @@ export default class Inventory extends Component {
delete otherSlots[r]; delete otherSlots[r];
} }
Component.markChange(this.entity, 'swapped', [[l, OtherInventory.entity, 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) { toNet(recipient, data) {
if (recipient.id !== this.entity && this !== recipient.Player.openInventory) { if (recipient.id !== this.entity && this !== recipient.Player.openInventory) {