Prevent duplicate entries when adding a recipe to a technology
This commit is contained in:
parent
75429369d1
commit
dca2bd9129
1 changed files with 5 additions and 0 deletions
|
@ -132,6 +132,11 @@ end
|
||||||
--- Adds a recipe unlock to the technology
|
--- Adds a recipe unlock to the technology
|
||||||
--- @param recipeName string The name of the recipe to unlock
|
--- @param recipeName string The name of the recipe to unlock
|
||||||
function Technology:addRecipe(recipeName)
|
function Technology:addRecipe(recipeName)
|
||||||
|
for _, effect in pairs(self.prototype.effects) do
|
||||||
|
if effect.type == "unlock-recipe" and effect.recipe == recipeName then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
table.insert(self.prototype.effects, { type = "unlock-recipe", recipe = recipeName })
|
table.insert(self.prototype.effects, { type = "unlock-recipe", recipe = recipeName })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue