crafter bug fixes
This commit is contained in:
@@ -243,7 +243,7 @@ function Craft.getResourceList4(inRecipe, items, count)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- given a certain quantity, return how many of those can be crafted
|
-- given a certain quantity, return how many of those can be crafted
|
||||||
function Craft.getCraftableAmount(recipe, count, items, missing)
|
function Craft.getCraftableAmount(inRecipe, count, items, missing)
|
||||||
local function sumItems(recipe, summedItems, count)
|
local function sumItems(recipe, summedItems, count)
|
||||||
local canCraft = 0
|
local canCraft = 0
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ function Craft.getCraftableAmount(recipe, count, items, missing)
|
|||||||
summedItem = summedItem + sumItems(irecipe, summedItems, 1)
|
summedItem = summedItem + sumItems(irecipe, summedItems, 1)
|
||||||
end
|
end
|
||||||
if summedItem <= 0 then
|
if summedItem <= 0 then
|
||||||
if missing then
|
if missing and not irecipe then
|
||||||
missing.name = item
|
missing.name = item
|
||||||
end
|
end
|
||||||
return canCraft
|
return canCraft
|
||||||
@@ -271,7 +271,7 @@ function Craft.getCraftableAmount(recipe, count, items, missing)
|
|||||||
return canCraft
|
return canCraft
|
||||||
end
|
end
|
||||||
|
|
||||||
return sumItems(recipe, { }, math.ceil(count / recipe.count))
|
return sumItems(inRecipe, { }, math.ceil(count / inRecipe.count))
|
||||||
end
|
end
|
||||||
|
|
||||||
function Craft.canCraft(item, count, items)
|
function Craft.canCraft(item, count, items)
|
||||||
|
|||||||
@@ -72,14 +72,12 @@ local machines = { }
|
|||||||
local jobListGrid
|
local jobListGrid
|
||||||
local listing, docked = false, false
|
local listing, docked = false, false
|
||||||
|
|
||||||
local function getItem(items, inItem, ignoreDamage)
|
local function getItem(items, inItem, ignoreDamage, ignoreNbtHash)
|
||||||
for _,item in pairs(items) do
|
for _,item in pairs(items) do
|
||||||
if item.name == inItem.name then
|
if item.name == inItem.name and
|
||||||
if ignoreDamage then
|
(ignoreDamage or item.damage == inItem.damage) and
|
||||||
return item
|
(ignoreNbtHash or item.nbtHash == inItem.nbtHash) then
|
||||||
elseif item.damage == inItem.damage and item.nbtHash == inItem.nbtHash then
|
return item
|
||||||
return item
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user