cleanup code + add power-armor-2 changes + option

This commit is contained in:
Peter 2019-01-10 12:54:43 +08:00
parent 2111f6f388
commit efaf4543dc
6 changed files with 67 additions and 48 deletions

View File

@ -17,22 +17,47 @@ for _, mod in pairs(data.raw.module) do
end
end
data.raw["technology"]["rocket-silo"].unit.ingredients =
{
{"science-pack-1", 1},
{"science-pack-2", 1},
{"science-pack-3", 1},
--{"military-science-pack", 1},
{"production-science-pack", 1},
{"high-tech-science-pack", 1}
}
local function replace_table(table, condition, replace)
for _=1, #table do
if table[_][1] == condition then
table[_] = replace
end
end
end
local function prerequisites(technology, condition, replace)
for _=1, #technology do
if technology[_] == condition then
table.remove(technology, _)
if replace ~= nil then
table.insert(technology, replace)
end
end
end
end
replace_table(data.raw["technology"]["rocket-silo"].unit.ingredients, "military-science-pack", nil)
if settings.startup["017-recipes-changes"].value then
replace_table(data.raw["recipe"]["atomic-bomb"].ingredients, "processing-unit", {"rocket-control-unit", 15})
replace_table(data.raw["recipe"]["power-armor-mk2"].ingredients, "speed-module-3", {"speed-module-2", 5})
replace_table(data.raw["recipe"]["power-armor-mk2"].ingredients, "effectivity-module-3", {"effectivity-module-2", 5})
local power_armor = data.raw["technology"]["power-armor-2"].prerequisites
prerequisites(power_armor, "speed-module-3", "speed-module-2")
prerequisites(power_armor, "effectivity-module-3", "effectivity-module-2")
table.insert(power_armor, "advanced-electronics-2")
end
local effects = data.raw["technology"]["rocket-silo"].effects --remove the duplicate LDS effect in rocket-silo research
for _=1, #effects do
if effects[_].type == "unlock-recipe" and (effects[_].recipe == "low-density-structure" or effects[_].recipe == "rocket-fuel" or effects[_].recipe == "rocket-control-unit") then
effects[_] = nil
end
end
prerequisites(data.raw["technology"]["rocket-silo"].prerequisites, "rocket-speed-5", nil)
data.raw["recipe"]["atomic-bomb"].ingredients =
{
{"rocket-control-unit", 15}, --{"processing-unit", 20},
{"explosives", 10},
{"uranium-235", 30}
}
--HUGE THANKS to Dimava for the following changes
--Added options for some changes (for modded users)

View File

@ -11,37 +11,22 @@ table.insert(data.raw["technology"]["advanced-electronics-2"].effects, {type = "
table.insert(data.raw["technology"]["advanced-material-processing-2"].effects, {type = "unlock-recipe",recipe = "rocket-fuel"})
local effects = data.raw["technology"]["rocket-silo"].effects --remove the duplicate LDS effect in rocket-silo research
for _=1, #effects do
if effects[_].type == "unlock-recipe" and (effects[_].recipe == "low-density-structure" or effects[_].recipe == "rocket-fuel" or effects[_].recipe == "rocket-control-unit") then
effects[_] = nil
end
end
local technology = data.raw["technology"]["rocket-silo"].prerequisites
for _=1, #technology do
if technology[_] == "rocket-speed-5" then
table.remove(technology, _)
end
end
if not settings.startup["017-old-science"].value then
data.raw["recipe"]["science-pack-3"].hidden = true
local effects = data.raw["technology"]["advanced-electronics"].effects
for _=1, #effects do if effects[_].type == "unlock-recipe" and effects[_].recipe == "science-pack-3" then effects[_] = nil end end
data.raw["recipe"]["military-science-pack"].hidden = true
local effects = data.raw["technology"]["military-2"].effects
for _=1, #effects do if effects[_].type == "unlock-recipe" and effects[_].recipe == "military-science-pack" then effects[_] = nil end end
data.raw["recipe"]["production-science-pack"].hidden = true
local effects = data.raw["technology"]["advanced-material-processing-2"].effects
for _=1, #effects do if effects[_].type == "unlock-recipe" and effects[_].recipe == "production-science-pack" then effects[_] = nil end end
data.raw["recipe"]["high-tech-science-pack"].hidden = true
local effects = data.raw["technology"]["advanced-electronics-2"].effects
for _=1, #effects do if effects[_].type == "unlock-recipe" and effects[_].recipe == "high-tech-science-pack" then effects[_] = nil end end
local function hide(name, technology)
data.raw["recipe"][name].hidden = true
local effects = data.raw["technology"][technology].effects
for _=1, #effects do
if effects[_].type == "unlock-recipe" and effects[_].recipe == name then
effects[_] = nil
end
end
end
hide("science-pack-3", "advanced-electronics")
hide("military-science-pack", "military-2")
hide("production-science-pack", "advanced-material-processing-2")
hide("high-tech-science-pack", "advanced-electronics-2")
data.raw["recipe"]["low-density-structure"].normal.hidden = true
data.raw["recipe"]["low-density-structure"].expensive.hidden = true
elseif settings.startup["017-old-science"].value then

View File

@ -1,6 +1,6 @@
{
"name": "017_science",
"version": "0.0.8",
"version": "0.0.9",
"factorio_version": "0.16",
"title": "0.17 science conversion",
"author": "npc_strider(morley376)",

View File

@ -9,9 +9,11 @@ high-tech-science-pack=Utility science pack
017-smelting=Reduce smelting time
017-assem-lim=Remove assembler item limit
017-old-science=Enable old science recipes
017-recipes-changes=Misc. recipe changes in 0.17
[mod-setting-description]
017-drill=(Default enabled) Toggle FFF-266 mining changes (removed hardness). This mod makes all vanilla ore hardness = 1 and makes the burner-mining-drill mining_power = 3, which may break modded ore gating.
017-smelting=(Default enabled) Toggle V's smelting changes (https://forums.factorio.com/viewtopic.php?t=64219#p392508). This mod may break ratios for modded recipes using vanilla and modded items.
017-assem-lim=(Default enabled) Toggle the assembly limit removal. This mod affects all assembling-machines and may affect modded crafting stations based on this entity, which may use the limit as a form of gating.
017-old-science=(Default disabled) Toggle the old science recipes (0.16). Disables the ability to use the vanilla recipes (except SP 1 & 2) but allows existing crafting machines to continue using the recipe until changed.
017-old-science=(Default disabled) Toggle the old science recipes (0.16), including LDS. When disabled it removes the ability to use the vanilla science and LDS recipes (except SP 1 & 2) but allows existing crafting machines to continue using the recipe until manually changed.
017-recipes-changes=(Default enabled) atomic-bomb and power-armor-mk2 recipe changes

View File

@ -23,5 +23,11 @@ data:extend(
name = "017-old-science",
setting_type = "startup",
default_value = false
}
},
{
type = "bool-setting",
name = "017-recipes-changes",
setting_type = "startup",
default_value = true
}
})

View File

@ -2,3 +2,4 @@
Mod source
Link: https://mods.factorio.com/mod/017_science
Mod spotlight by Xterminator: https://youtu.be/HZfD01IjGQk