cleanup
This commit is contained in:
@@ -39,7 +39,7 @@ function ChestAdapter:getCachedItemDetails(item, k)
|
|||||||
|
|
||||||
local s, detail = pcall(self.getItemMeta, k)
|
local s, detail = pcall(self.getItemMeta, k)
|
||||||
if not s or not detail or detail.name ~= item.name then
|
if not s or not detail or detail.name ~= item.name then
|
||||||
debug({ s, detail })
|
-- debug({ s, detail })
|
||||||
-- error('Inventory has changed')
|
-- error('Inventory has changed')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -126,9 +126,6 @@ function ChestAdapter:provide(item, qty, slot, direction)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
if not s then
|
|
||||||
debug(m)
|
|
||||||
end
|
|
||||||
return s, m
|
return s, m
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -141,8 +138,6 @@ function ChestAdapter:eject(item, qty, direction)
|
|||||||
(not item.damage or stack.damage == item.damage) and
|
(not item.damage or stack.damage == item.damage) and
|
||||||
(not item.nbtHash or stack.nbtHash == item.nbtHash) then
|
(not item.nbtHash or stack.nbtHash == item.nbtHash) then
|
||||||
local amount = math.min(maxStack, math.min(qty, stack.count))
|
local amount = math.min(maxStack, math.min(qty, stack.count))
|
||||||
debug({ key, amount })
|
|
||||||
debug(stack)
|
|
||||||
if amount > 0 then
|
if amount > 0 then
|
||||||
self.drop(key, amount, direction)
|
self.drop(key, amount, direction)
|
||||||
end
|
end
|
||||||
@@ -153,9 +148,6 @@ debug(stack)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
if not s then
|
|
||||||
debug(m)
|
|
||||||
end
|
|
||||||
return s, m
|
return s, m
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -98,8 +98,6 @@ function itemDB:add(baseItem)
|
|||||||
-- if detail.maxDamage > 0 then
|
-- if detail.maxDamage > 0 then
|
||||||
-- nItem.damage = '*'
|
-- nItem.damage = '*'
|
||||||
-- end
|
-- end
|
||||||
debug('--')
|
|
||||||
debug('adding ' .. makeKey(nItem))
|
|
||||||
|
|
||||||
nItem.displayName = safeString(baseItem.displayName)
|
nItem.displayName = safeString(baseItem.displayName)
|
||||||
nItem.maxCount = baseItem.maxCount
|
nItem.maxCount = baseItem.maxCount
|
||||||
@@ -108,31 +106,26 @@ debug('adding ' .. makeKey(nItem))
|
|||||||
for k,item in pairs(self.data) do
|
for k,item in pairs(self.data) do
|
||||||
if nItem.name == item.name and
|
if nItem.name == item.name and
|
||||||
nItem.displayName == item.displayName then
|
nItem.displayName == item.displayName then
|
||||||
debug('found: ' .. makeKey(item))
|
|
||||||
if nItem.nbtHash ~= item.nbtHash and nItem.damage ~= item.damage then
|
if nItem.nbtHash ~= item.nbtHash and nItem.damage ~= item.damage then
|
||||||
nItem.damage = '*'
|
nItem.damage = '*'
|
||||||
nItem.nbtHash = nil
|
nItem.nbtHash = nil
|
||||||
nItem.ignoreNBT = true
|
nItem.ignoreNBT = true
|
||||||
self.data[k] = nil
|
self.data[k] = nil
|
||||||
debug('removing all ' .. makeKey(nItem))
|
|
||||||
break
|
break
|
||||||
elseif nItem.damage ~= item.damage then
|
elseif nItem.damage ~= item.damage then
|
||||||
nItem.damage = '*'
|
nItem.damage = '*'
|
||||||
self.data[k] = nil
|
self.data[k] = nil
|
||||||
debug('removing damage ' .. makeKey(nItem))
|
|
||||||
break
|
break
|
||||||
elseif nItem.nbtHash ~= item.nbtHash then
|
elseif nItem.nbtHash ~= item.nbtHash then
|
||||||
nItem.nbtHash = nil
|
nItem.nbtHash = nil
|
||||||
nItem.ignoreNBT = true
|
nItem.ignoreNBT = true
|
||||||
debug('removing nbt ' .. makeKey(nItem))
|
|
||||||
self.data[k] = nil
|
self.data[k] = nil
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
debug('final ' .. makeKey(nItem))
|
|
||||||
|
|
||||||
TableDB.add(self, makeKey(nItem), nItem)
|
TableDB.add(self, makeKey(nItem), nItem)
|
||||||
nItem = Util.shallowCopy(nItem)
|
nItem = Util.shallowCopy(nItem)
|
||||||
nItem.damage = baseItem.damage
|
nItem.damage = baseItem.damage
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ function page:runFunction(id, script)
|
|||||||
local fn, msg = loadstring(script, 'script')
|
local fn, msg = loadstring(script, 'script')
|
||||||
if not fn then
|
if not fn then
|
||||||
self.notification:error('Error in script')
|
self.notification:error('Error in script')
|
||||||
debug(msg)
|
--debug(msg)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user