more compat
This commit is contained in:
parent
6687687178
commit
c8f05d5e5e
3 changed files with 32 additions and 13 deletions
|
|
@ -93,6 +93,7 @@ util.add_prerequisite("heavy-armor", "copper-processing")
|
||||||
util.set_enabled("deadlock-copper-lamp", false)
|
util.set_enabled("deadlock-copper-lamp", false)
|
||||||
util.add_effect("copper-processing", { type = "unlock-recipe", recipe = "deadlock-copper-lamp" })
|
util.add_effect("copper-processing", { type = "unlock-recipe", recipe = "deadlock-copper-lamp" })
|
||||||
|
|
||||||
|
util.add_unlock_force("electronics", "electronic-circuit")
|
||||||
util.replace_ingredients_prior_to("electronics", "electronic-circuit", "aluminum-cable")
|
util.replace_ingredients_prior_to("electronics", "electronic-circuit", "aluminum-cable")
|
||||||
util.replace_ingredients_prior_to("copper-processing", "copper-cable", "aluminum-cable")
|
util.replace_ingredients_prior_to("copper-processing", "copper-cable", "aluminum-cable")
|
||||||
util.replace_ingredients_prior_to("copper-processing", "copper-plate", "aluminum-plate")
|
util.replace_ingredients_prior_to("copper-processing", "copper-plate", "aluminum-plate")
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@ Version: 0.4.3
|
||||||
Date: 2022-08-10
|
Date: 2022-08-10
|
||||||
Changes:
|
Changes:
|
||||||
- Lamp only requires 1 aluminum cable now.
|
- Lamp only requires 1 aluminum cable now.
|
||||||
|
Fixes:
|
||||||
|
- Some more general compatibility fixes, thanks to U.N.Owen, including improved compatibility
|
||||||
|
with their fork of Research Desk.
|
||||||
---------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------
|
||||||
Version: 0.4.2
|
Version: 0.4.2
|
||||||
Date: 2022-08-08
|
Date: 2022-08-08
|
||||||
|
|
|
||||||
|
|
@ -137,21 +137,25 @@ function util.add_unlock(technology_name, recipe)
|
||||||
util.add_effect(technology_name, {type="unlock-recipe", recipe=recipe})
|
util.add_effect(technology_name, {type="unlock-recipe", recipe=recipe})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- remove recipe unlock effect from a given technology
|
-- remove recipe unlock effect from a given technology, multiple times if necessary
|
||||||
function util.remove_recipe_effect(technology_name, recipe_name)
|
function util.remove_recipe_effect(technology_name, recipe_name)
|
||||||
local technology = data.raw.technology[technology_name]
|
local technology = data.raw.technology[technology_name]
|
||||||
local index = -1
|
local index = -1
|
||||||
if technology and technology.effects then
|
local cnt = 0
|
||||||
for i, effect in pairs(technology.effects) do
|
if technology and technology.effects then
|
||||||
if effect.type == "unlock-recipe" and effect.recipe == recipe_name then
|
for i, effect in pairs(technology.effects) do
|
||||||
index = i
|
if effect.type == "unlock-recipe" and effect.recipe == recipe_name then
|
||||||
break
|
index = i
|
||||||
end
|
cnt = cnt + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if index > -1 then
|
||||||
|
table.remove(technology.effects, index)
|
||||||
|
if cnt > 1 then -- not over yet, do it again
|
||||||
|
util.remove_recipe_effect(technology_name, recipe_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if index > -1 then
|
|
||||||
table.remove(technology.effects, index)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set technology ingredients
|
-- Set technology ingredients
|
||||||
|
|
@ -964,5 +968,16 @@ function replace_ingredients_prior_to(tech, old, new, multiplier)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function util.remove_all_recipe_effects(recipe_name)
|
||||||
|
for name, _ in pairs(data.raw.technology) do
|
||||||
|
util.remove_recipe_effect(name, recipe_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function util.add_unlock_force(technology_name, recipe)
|
||||||
|
util.set_enabled(recipe, false)
|
||||||
|
util.remove_all_recipe_effects(recipe)
|
||||||
|
util.add_unlock(technology_name, recipe)
|
||||||
|
end
|
||||||
|
|
||||||
return util
|
return util
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue