fix: consumption
This commit is contained in:
parent
b630221f1f
commit
f1b6a8b0d8
|
@ -2,7 +2,6 @@ import Schema from '@/ecs/schema.js';
|
|||
|
||||
export default function(Component) {
|
||||
return class Inventory extends Component {
|
||||
|
||||
insertMany(entities) {
|
||||
for (const [id, {slotChange}] of entities) {
|
||||
if (slotChange) {
|
||||
|
@ -22,7 +21,6 @@ export default function(Component) {
|
|||
}
|
||||
return super.insertMany(entities);
|
||||
}
|
||||
|
||||
mergeDiff(original, update) {
|
||||
if (!update.slotChange) {
|
||||
return super.mergeDiff(original, update);
|
||||
|
@ -57,6 +55,7 @@ export default function(Component) {
|
|||
target[property] = value;
|
||||
if ('qty' === property && value <= 0) {
|
||||
Component.markChange(instance.entity, 'slotChange', {[slot]: false});
|
||||
delete slots[slot];
|
||||
}
|
||||
else {
|
||||
Component.markChange(instance.entity, 'slotChange', {[slot]: {[property]: value}});
|
||||
|
|
Loading…
Reference in New Issue
Block a user