remove rare_to_titanium

This commit is contained in:
Brevven 2021-07-27 23:07:22 -07:00
parent 1a34ed2dcf
commit 9d2bb61d29
3 changed files with 11 additions and 32 deletions

View file

@ -1,4 +1,10 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 0.12.5
Date: 2021-07-28
Fixes:
- Fix major recipe bug introduced in 0.12.4 (thanks GeneralTank for report).
- Completed refactor to remove legacy helper functions.
---------------------------------------------------------------------------------------------------
Version: 0.12.4 Version: 0.12.4
Date: 2021-07-26 Date: 2021-07-26
Changes: Changes:

27
me.lua
View file

@ -20,10 +20,6 @@ function me.add_titanium_ingredient(amount, name)
add_ingredient(name, me.titanium_plate, amount) add_ingredient(name, me.titanium_plate, amount)
end end
function me.rare_to_titanium(name)
replace_ingredient(name, "rare-metals", me.titanium_plate)
end
function me.add_titanium_prerequisite(name) function me.add_titanium_prerequisite(name)
add_prerequisite(name, me.titanium_processing) add_prerequisite(name, me.titanium_processing)
end end
@ -51,29 +47,6 @@ end
-- --
-- TODO These helpers are all duplicates, remove them -- TODO These helpers are all duplicates, remove them
-- --
function replace_ingredient(recipe_name, old, new)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] and data.raw.item[new] then
xreplace_ingredient(data.raw.recipe[recipe_name], old, new)
xreplace_ingredient(data.raw.recipe[recipe_name].normal, old, new)
xreplace_ingredient(data.raw.recipe[recipe_name].expensive, old, new)
end
end
function xreplace_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
end
end
end
function add_prerequisite(technology_name, prerequisite) function add_prerequisite(technology_name, prerequisite)
technology = data.raw.technology[technology_name] technology = data.raw.technology[technology_name]

View file

@ -7,12 +7,12 @@ if mods["Krastorio2"] then
util.replace_ingredient("advanced-tech-card", "electric-engine-unit", "flying-robot-frame") util.replace_ingredient("advanced-tech-card", "electric-engine-unit", "flying-robot-frame")
-- Flavor changes -- Flavor changes
util.me.rare_to_titanium("kr-electric-mining-drill-mk2") util.replace_ingredient("kr-electric-mining-drill-mk2", "rare-metals", "titanium-plate")
util.me.rare_to_titanium("kr-advanced-transport-belt") util.replace_ingredient("kr-advanced-transport-belt", "rare-metals", "titanium-plate")
util.me.rare_to_titanium("kr-advanced-loader") util.replace_ingredient("kr-advanced-loader", "rare-metals", "titanium-plate")
if mods["deadlock-beltboxes-loaders"] then if mods["deadlock-beltboxes-loaders"] then
util.me.rare_to_titanium("kr-advanced-transport-belt-beltbox") util.replace_ingredient("kr-advanced-transport-belt-beltbox", "rare-metals", "titanium-plate")
util.me.rare_to_titanium("kr-advanced-transport-belt-loader") util.replace_ingredient("kr-advanced-transport-belt-loader", "rare-metals", "titanium-plate")
end end
util.replace_ingredient("kr-quarry-drill", "steel-plate", "titanium-plate") util.replace_ingredient("kr-quarry-drill", "steel-plate", "titanium-plate")