Add Recipe:removeResult
This commit is contained in:
parent
c2392a687c
commit
7a18ca0c3b
1 changed files with 17 additions and 3 deletions
|
|
@ -102,9 +102,9 @@ end
|
||||||
--- @param ingredientName string The name of the ingredient
|
--- @param ingredientName string The name of the ingredient
|
||||||
function Recipe:removeIngredient(ingredientName)
|
function Recipe:removeIngredient(ingredientName)
|
||||||
if self.prototype.ingredients then
|
if self.prototype.ingredients then
|
||||||
for i, result in pairs(self.prototype.ingredients) do
|
for i, ingredient in pairs(self.prototype.ingredients) do
|
||||||
if result.name == ingredientName then
|
if ingredient.name == ingredientName then
|
||||||
self.prototype.ingredients[i] = nil
|
table.remove(self.prototype.ingredients, i)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -137,6 +137,20 @@ function Recipe:replaceResult(old, new, amount, expensiveAmount)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Removes an existing result by name
|
||||||
|
--- @param resultName string The name of the result
|
||||||
|
function Recipe:removeResult(resultName)
|
||||||
|
if self.prototype.results then
|
||||||
|
for i, result in pairs(self.prototype.results) do
|
||||||
|
if result.name == resultName then
|
||||||
|
table.remove(self.prototype.results, i)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Adds the recipe to a technology
|
--- Adds the recipe to a technology
|
||||||
--- @param technology string|table The name of the technology or the technology table
|
--- @param technology string|table The name of the technology or the technology table
|
||||||
function Recipe:unlockedByTechnology(technology)
|
function Recipe:unlockedByTechnology(technology)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue