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
|
||||
function Recipe:removeIngredient(ingredientName)
|
||||
if self.prototype.ingredients then
|
||||
for i, result in pairs(self.prototype.ingredients) do
|
||||
if result.name == ingredientName then
|
||||
self.prototype.ingredients[i] = nil
|
||||
for i, ingredient in pairs(self.prototype.ingredients) do
|
||||
if ingredient.name == ingredientName then
|
||||
table.remove(self.prototype.ingredients, i)
|
||||
return self
|
||||
end
|
||||
end
|
||||
|
|
@ -137,6 +137,20 @@ function Recipe:replaceResult(old, new, amount, expensiveAmount)
|
|||
return self
|
||||
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
|
||||
--- @param technology string|table The name of the technology or the technology table
|
||||
function Recipe:unlockedByTechnology(technology)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue