Explorar el Código

fixes edge case for #1367 and provides better fix for #790

tags/v0.5
Big Bad Waffle hace 4 años
padre
commit
529ff4ab15
Se han modificado 2 ficheros con 2 adiciones y 2 borrados
  1. +0
    -1
      src/client/js/components/inventory.js
  2. +2
    -1
      src/server/components/inventory.js

+ 0
- 1
src/client/js/components/inventory.js Ver fichero

@@ -22,7 +22,6 @@ define([
if (blueprint.getItems) {
let items = this.items;
let newItems = blueprint.getItems || [];
newItems.spliceWhere(n => (blueprint.destroyItems || []).includes(n.id));
let nLen = newItems.length;

for (let i = 0; i < nLen; i++) {


+ 2
- 1
src/server/components/inventory.js Ver fichero

@@ -389,7 +389,7 @@ module.exports = {

destroyItem: function (id, amount, force) {
let item = this.findItem(id);
if ((!item) || ((item.noDestroy) && (!force)))
if (!item || (item.noDestroy && !force))
return;

amount = amount || item.quantity;
@@ -407,6 +407,7 @@ module.exports = {
} else {
this.items.spliceWhere(i => i.id === id);
this.obj.syncer.setArray(true, 'inventory', 'destroyItems', id);
this.obj.syncer.deleteFromArray(true, 'inventory', 'getItems', i => i.id === id);
}

this.obj.fireEvent('afterDestroyItem', item, amount);


Cargando…
Cancelar
Guardar