fix: given/qtyUpdated

This commit is contained in:
cha0s 2024-10-18 05:35:23 -05:00
parent be1e162da5
commit 6a2dddef0e

View File

@ -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;
}
}