fix k2 realistic weapons off

This commit is contained in:
Brevven 2021-06-14 23:50:06 -07:00
parent 1663a51e7d
commit 2cd53c60d8
3 changed files with 24 additions and 1 deletions

View file

@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 0.1.5
Date: 2021-06-15
Fixes:
- Fix K2 Issue when more realistic weapons is off, and more general duplicate fix.
---------------------------------------------------------------------------------------------------
Version: 0.1.4
Date: 2021-06-15
Features:

View file

@ -1,6 +1,6 @@
{
"name": "bztungsten",
"version": "0.1.4",
"version": "0.1.5",
"factorio_version": "1.1",
"title": "Tungsten",
"author": "Brevven",

View file

@ -96,6 +96,12 @@ end
function add_ingredient(recipe, ingredient, quantity)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing[1] == ingredient or existing.name == ingredient then
log("Not adding "..ingredient.." -- duplicate")
return
end
end
table.insert(recipe.ingredients, {ingredient, quantity})
end
end
@ -127,6 +133,12 @@ end
function replace_ingredient(recipe, old, new)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing[1] == new or existing.name == new then
log("Not adding "..new.." -- duplicate")
return
end
end
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == old then ingredient.name = new end
if ingredient[1] == old then ingredient[1] = new end
@ -170,6 +182,12 @@ end
function replace_some_ingredient(recipe, old, old_amount, new, new_amount)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing[1] == new or existing.name == new then
log("Not adding "..new.." -- duplicate")
return
end
end
for i, ingredient in pairs(recipe.ingredients) do
-- For final fixes
if ingredient.name == old then