mirror of
https://github.com/peter-tanner/017-science-transition-mod.git
synced 2024-12-02 20:10:19 +08:00
fixed some tech tree bugs with some overhaul mods
This commit is contained in:
parent
0d8f3485d3
commit
379e0c976a
|
@ -158,7 +158,7 @@ end
|
|||
|
||||
if settings.startup["017-rocket-victory"].value then
|
||||
script.on_event(defines.events.on_rocket_launched, function(event)
|
||||
if game.active_mods["SpaceMod"] then
|
||||
if game.active_game.active_mods["SpaceMod"] then
|
||||
-- game.print("SpaceMod installed: not enabling victory")
|
||||
else
|
||||
game.set_game_state{game_finished = true, player_won = true, can_continue = true}
|
||||
|
@ -237,7 +237,9 @@ script.on_configuration_changed(function()
|
|||
f_recipes["17-low-density-structure"].enabled = true
|
||||
f_recipes["17-utility-science-pack"].enabled = true
|
||||
if old_science then
|
||||
if not game.active_mods["bobrevamp"] then
|
||||
f_recipes["low-density-structure"].enabled = true
|
||||
end
|
||||
f_recipes["high-tech-science-pack"].enabled = true
|
||||
end
|
||||
f_print("advanced-electronics-2 researched for this force: utility-science-pack & low-density-structure & rocket-control-unit recipes auto-unlocked")
|
||||
|
@ -246,7 +248,9 @@ script.on_configuration_changed(function()
|
|||
end
|
||||
|
||||
if f_technologies["advanced-material-processing-2"].researched == true then
|
||||
if not game.active_mods["angelspetrochem"] then
|
||||
f_recipes["rocket-fuel"].enabled = true
|
||||
end
|
||||
f_recipes["17-production-science-pack"].enabled = true
|
||||
if old_science then
|
||||
f_recipes["production-science-pack"].enabled = true
|
||||
|
@ -363,7 +367,7 @@ script.on_configuration_changed(function()
|
|||
end
|
||||
end
|
||||
|
||||
if not f_technologies["rocket-fuel"].researched == true then
|
||||
if not f_technologies["rocket-fuel"].researched == true and not game.active_mods["angelspetrochem"] then
|
||||
if get_input_count("rocket-fuel") > 0 then
|
||||
f_recipes["rocket-fuel"].enabled = true
|
||||
f_technologies["rocket-fuel"].researched = true
|
||||
|
@ -373,9 +377,23 @@ script.on_configuration_changed(function()
|
|||
f_technologies["rocket-fuel"].researched = false
|
||||
f_print("No rocket-fuel produced by this force: technology won't be auto-researched.")
|
||||
end
|
||||
elseif game.active_mods["angelspetrochem"] then
|
||||
if get_input_count("rocket-fuel") > 0 then
|
||||
f_technologies["angels-rocket-fuel"].researched = true
|
||||
f_recipes["rocket-oxidizer-capsule"].enabled = true
|
||||
f_recipes["rocket-fuel-capsule"].enabled = true
|
||||
f_recipes["rocket-fuel"].enabled = true
|
||||
f_print("force: " .. force.name .. " | rocket-fuel recipe unlocked | total produced by force: " .. get_input_count("rocket-fuel"))
|
||||
else
|
||||
f_technologies["angels-rocket-fuel"].researched = false
|
||||
f_recipes["rocket-oxidizer-capsule"].enabled = false
|
||||
f_recipes["rocket-fuel-capsule"].enabled = false
|
||||
f_recipes["rocket-fuel"].enabled = false
|
||||
f_print("No rocket-fuel produced by this force: technology won't be auto-researched.")
|
||||
end
|
||||
end
|
||||
|
||||
if not f_technologies["low-density-structure"].researched == true then
|
||||
if not f_technologies["low-density-structure"].researched == true and not game.active_mods["bobrevamp"] then
|
||||
if get_input_count("low-density-structure") > 0 then
|
||||
f_recipes["low-density-structure"].enabled = true
|
||||
f_recipes["17-low-density-structure"].enabled = true
|
||||
|
@ -387,6 +405,16 @@ script.on_configuration_changed(function()
|
|||
f_technologies["low-density-structure"].researched = false
|
||||
f_print("No low-density-structure produced by this force: technology won't be auto-researched.")
|
||||
end
|
||||
elseif game.active_mods["bobrevamp"] then
|
||||
if get_input_count("low-density-structure") > 0 then
|
||||
f_recipes["low-density-structure"].enabled = true
|
||||
f_technologies["low-density-structure"].researched = true
|
||||
f_print("force: " .. force.name .. " | low-density-structure recipe unlocked | total produced by force: " .. get_input_count("low-density-structure"))
|
||||
else
|
||||
f_recipes["low-density-structure"].enabled = false
|
||||
f_technologies["low-density-structure"].researched = false
|
||||
f_print("No low-density-structure produced by this force: technology won't be auto-researched.")
|
||||
end
|
||||
end
|
||||
|
||||
if not f_technologies["rocket-control-unit"].researched == true then
|
||||
|
|
93
017_science/data-final-fixes.lua
Normal file
93
017_science/data-final-fixes.lua
Normal file
|
@ -0,0 +1,93 @@
|
|||
local function compare(technology, science_pack, pre_tier)
|
||||
valid = true
|
||||
if technology and technology.unit then
|
||||
for l, j in pairs(technology.unit.ingredients) do
|
||||
if j[1] == pre_tier then
|
||||
valid = true
|
||||
break
|
||||
else
|
||||
valid = false
|
||||
end
|
||||
end
|
||||
end
|
||||
if valid == true then
|
||||
if technology.prerequisites then
|
||||
for _=1, #technology.prerequisites do
|
||||
local tech = data.raw["technology"][technology.prerequisites[_]]
|
||||
if valid == true then
|
||||
if tech then
|
||||
if tech.unit then
|
||||
for i, ingredients in pairs(tech.unit.ingredients) do
|
||||
if ingredients[1] == pre_tier then
|
||||
valid = false
|
||||
break
|
||||
else
|
||||
valid = true
|
||||
end
|
||||
end
|
||||
elseif valid == false then
|
||||
break
|
||||
end
|
||||
elseif valid == false then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if technology.prerequisites and valid == true then
|
||||
technology.prerequisites[#technology.prerequisites+1] = science_pack
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
for _, tech in pairs(data.raw["technology"]) do
|
||||
if tech.name ~= ("logistics-science-pack" or "chemical-science-pack" or "production-science-pack" or "utility-science-pack" or "space-science-pack") then
|
||||
if tech.effects then
|
||||
if #tech.effects ~= 0 then
|
||||
for i, effect in pairs(tech.effects) do
|
||||
if effect then
|
||||
if effect.type then
|
||||
if effect.type == "unlock-recipe" then
|
||||
whitelisted = true
|
||||
break
|
||||
else
|
||||
whitelisted = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if settings.startup["017-rocket-victory"].value then
|
||||
if whitelisted == false then
|
||||
if tech.unit then
|
||||
if tech.unit.ingredients then
|
||||
for j, nasa in pairs(tech.unit.ingredients) do
|
||||
if nasa[1] == "space-science-pack" then
|
||||
compare(tech, "space-science-pack", "space-science-pack")
|
||||
break
|
||||
else
|
||||
whitelisted = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if whitelisted == true then
|
||||
local valid = compare(tech, "logistics-science-pack", "science-pack-2")
|
||||
if valid == false then
|
||||
local valid = compare(tech, "chemical-science-pack", "science-pack-3") end
|
||||
if valid == false then
|
||||
local valid = compare(tech, "production-science-pack", "production-science-pack") end
|
||||
if valid == false then
|
||||
local valid = compare(tech, "military-science-pack", "military-science-pack") end
|
||||
if valid == false then
|
||||
compare(tech, "utility-science-pack", "high-tech-science-pack")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -47,7 +47,6 @@ end
|
|||
|
||||
if settings.startup["017-recipes-changes"].value then
|
||||
recipe_change(data.raw["recipe"]["atomic-bomb"].ingredients, "processing-unit", {"rocket-control-unit", 15})
|
||||
|
||||
recipe_change(data.raw["recipe"]["power-armor-mk2"].ingredients, "speed-module-3", {"speed-module-2", 5})
|
||||
recipe_change(data.raw["recipe"]["power-armor-mk2"].ingredients, "effectivity-module-3", {"effectivity-module-2", 5})
|
||||
local power_armor = data.raw["technology"]["power-armor-2"].prerequisites
|
||||
|
@ -73,15 +72,21 @@ data.raw["technology"]["nuclear-fuel-reprocessing"].unit.count = (1500-settings.
|
|||
|
||||
if settings.startup["017-pack-type-rebalancing"].value then
|
||||
remove_science(data.raw["technology"]["rocket-silo"].unit.ingredients, "military-science-pack")
|
||||
if not mods["Nuclear Fuel"] then
|
||||
remove_science(data.raw["technology"]["kovarex-enrichment-process"].unit.ingredients, "high-tech-science-pack")
|
||||
end
|
||||
if not mods["bobmodules"] then
|
||||
remove_science(data.raw["technology"]["speed-module-3"].unit.ingredients, "high-tech-science-pack")
|
||||
table.insert(data.raw["technology"]["speed-module-3"].unit.ingredients, {"production-science-pack", 1})
|
||||
remove_science(data.raw["technology"]["effectivity-module-3"].unit.ingredients, "high-tech-science-pack")
|
||||
table.insert(data.raw["technology"]["effectivity-module-3"].unit.ingredients, {"production-science-pack", 1})
|
||||
remove_science(data.raw["technology"]["effect-transmission"].unit.ingredients, "high-tech-science-pack")
|
||||
table.insert(data.raw["technology"]["effect-transmission"].unit.ingredients, {"production-science-pack", 1})
|
||||
end
|
||||
if not mods["bobslogistics"] then
|
||||
remove_science(data.raw["technology"]["logistic-system"].unit.ingredients, "production-science-pack")
|
||||
end
|
||||
end
|
||||
|
||||
if settings.startup["017-techtree"].value then
|
||||
local data_technology = data.raw["technology"]
|
||||
|
@ -149,10 +154,12 @@ if settings.startup["017-techtree"].value then
|
|||
{type = "unlock-recipe", recipe = "high-tech-science-pack"},
|
||||
{type = "unlock-recipe", recipe = "17-utility-science-pack"}
|
||||
}
|
||||
if not mods["bobrevamp"] then
|
||||
data_technology["low-density-structure"].effects = {
|
||||
{type = "unlock-recipe", recipe = "low-density-structure"},
|
||||
{type = "unlock-recipe", recipe = "17-low-density-structure"}
|
||||
}
|
||||
end
|
||||
|
||||
for i=1, #remove_effect_table do
|
||||
local effects = data_technology[remove_effect_table[i][1]].effects
|
||||
|
@ -165,99 +172,11 @@ if settings.startup["017-techtree"].value then
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function compare(technology, science_pack, pre_tier)
|
||||
valid = true
|
||||
if technology and technology.unit then
|
||||
for l, j in pairs(technology.unit.ingredients) do
|
||||
if j[1] == pre_tier then
|
||||
valid = true
|
||||
break
|
||||
else
|
||||
valid = false
|
||||
end
|
||||
end
|
||||
end
|
||||
if valid == true then
|
||||
if technology.prerequisites then
|
||||
for _=1, #technology.prerequisites do
|
||||
local tech = data.raw["technology"][technology.prerequisites[_]]
|
||||
if valid == true then
|
||||
if tech then
|
||||
if tech.unit then
|
||||
for i, ingredients in pairs(tech.unit.ingredients) do
|
||||
if ingredients[1] == pre_tier then
|
||||
valid = false
|
||||
break
|
||||
else
|
||||
valid = true
|
||||
end
|
||||
end
|
||||
elseif valid == false then
|
||||
break
|
||||
end
|
||||
elseif valid == false then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if technology.prerequisites and valid == true then
|
||||
technology.prerequisites[#technology.prerequisites+1] = science_pack
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
for _, tech in pairs(data.raw["technology"]) do
|
||||
if tech.name ~= ("logistics-science-pack" or "chemical-science-pack" or "production-science-pack" or "utility-science-pack" or "space-science-pack") then
|
||||
if tech.effects then
|
||||
if #tech.effects ~= 0 then
|
||||
for i, effect in pairs(tech.effects) do
|
||||
if effect then
|
||||
if effect.type then
|
||||
if effect.type == "unlock-recipe" then
|
||||
whitelisted = true
|
||||
break
|
||||
else
|
||||
whitelisted = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if settings.startup["017-rocket-victory"].value then
|
||||
if whitelisted == false then
|
||||
if tech.unit then
|
||||
if tech.unit.ingredients then
|
||||
for j, nasa in pairs(tech.unit.ingredients) do
|
||||
if nasa[1] == "space-science-pack" then
|
||||
compare(tech, "space-science-pack", "space-science-pack")
|
||||
break
|
||||
else
|
||||
whitelisted = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if whitelisted == true then
|
||||
local valid = compare(tech, "logistics-science-pack", "science-pack-2")
|
||||
if valid == false then
|
||||
local valid = compare(tech, "chemical-science-pack", "science-pack-3") end
|
||||
if valid == false then
|
||||
local valid = compare(tech, "production-science-pack", "production-science-pack") end
|
||||
if valid == false then
|
||||
local valid = compare(tech, "military-science-pack", "military-science-pack") end
|
||||
if valid == false then
|
||||
compare(tech, "utility-science-pack", "high-tech-science-pack")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if mods["bobrevamp"] then
|
||||
data_technology["low-density-structure"].effects = {
|
||||
{type = "unlock-recipe", recipe = "low-density-structure"},
|
||||
-- {type = "unlock-recipe", recipe = "17-low-density-structure"}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -32,8 +32,10 @@ if not settings.startup["017-old-science"].value then
|
|||
hide("production-science-pack", "advanced-material-processing-2")
|
||||
hide("high-tech-science-pack", "advanced-electronics-2")
|
||||
|
||||
if not mods["bobrevamp"] then
|
||||
data.raw["recipe"]["low-density-structure"].normal.hidden = true
|
||||
data.raw["recipe"]["low-density-structure"].expensive.hidden = true
|
||||
end
|
||||
elseif settings.startup["017-old-science"].value then
|
||||
data.raw["recipe"]["science-pack-3"].hidden = false
|
||||
data.raw["recipe"]["military-science-pack"].hidden = false
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "017_science",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"factorio_version": "0.16",
|
||||
"title": "0.17 science conversion",
|
||||
"author": "npc_strider(morley376)",
|
||||
|
|
|
@ -139,51 +139,6 @@ data:extend(
|
|||
},
|
||||
order = "d-a-a"
|
||||
},
|
||||
{
|
||||
type = "technology",
|
||||
name = "rocket-fuel",
|
||||
icon_size = 128,
|
||||
icon = "__017_science__/graphics/technology/rocketfuel.png",
|
||||
effects =
|
||||
{
|
||||
{type = "unlock-recipe", recipe = "rocket-fuel"}
|
||||
},
|
||||
prerequisites = {"engine", "flammables"},
|
||||
unit =
|
||||
{
|
||||
count = settings.startup["017-rocket-fuel-cost"].value,
|
||||
ingredients =
|
||||
{
|
||||
{"science-pack-1", 1},
|
||||
{"science-pack-2", 1},
|
||||
},
|
||||
time = settings.startup["017-rocket-fuel-energy"].value
|
||||
},
|
||||
order = "d-a-b"
|
||||
},
|
||||
{
|
||||
type = "technology",
|
||||
name = "low-density-structure",
|
||||
icon_size = 128,
|
||||
icon = "__017_science__/graphics/technology/rocketstructure.png",
|
||||
effects =
|
||||
{
|
||||
{type = "unlock-recipe", recipe = "17-low-density-structure"}
|
||||
},
|
||||
prerequisites = {"advanced-material-processing"},
|
||||
unit =
|
||||
{
|
||||
count = settings.startup["017-rocket-structure-cost"].value,
|
||||
ingredients =
|
||||
{
|
||||
{"science-pack-1", 1},
|
||||
{"science-pack-2", 1},
|
||||
{"science-pack-3", 1},
|
||||
},
|
||||
time = settings.startup["017-rocket-structure-energy"].value
|
||||
},
|
||||
order = "e-e-e"
|
||||
},
|
||||
{
|
||||
type = "technology",
|
||||
name = "rocket-control-unit",
|
||||
|
@ -235,6 +190,63 @@ data:extend(
|
|||
})
|
||||
end
|
||||
|
||||
if not mods["angelspetrochem"] and settings.startup["017-techtree"].value then
|
||||
data:extend(
|
||||
{
|
||||
{
|
||||
type = "technology",
|
||||
name = "rocket-fuel",
|
||||
icon_size = 128,
|
||||
icon = "__017_science__/graphics/technology/rocketfuel.png",
|
||||
effects =
|
||||
{
|
||||
{type = "unlock-recipe", recipe = "rocket-fuel"}
|
||||
},
|
||||
prerequisites = {"engine", "flammables"},
|
||||
unit =
|
||||
{
|
||||
count = settings.startup["017-rocket-fuel-cost"].value,
|
||||
ingredients =
|
||||
{
|
||||
{"science-pack-1", 1},
|
||||
{"science-pack-2", 1},
|
||||
},
|
||||
time = settings.startup["017-rocket-fuel-energy"].value
|
||||
},
|
||||
order = "d-a-b"
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
if not mods["bobrevamp"] and settings.startup["017-techtree"].value then
|
||||
data:extend(
|
||||
{
|
||||
{
|
||||
type = "technology",
|
||||
name = "low-density-structure",
|
||||
icon_size = 128,
|
||||
icon = "__017_science__/graphics/technology/rocketstructure.png",
|
||||
effects =
|
||||
{
|
||||
{type = "unlock-recipe", recipe = "17-low-density-structure"}
|
||||
},
|
||||
prerequisites = {"advanced-material-processing"},
|
||||
unit =
|
||||
{
|
||||
count = settings.startup["017-rocket-structure-cost"].value,
|
||||
ingredients =
|
||||
{
|
||||
{"science-pack-1", 1},
|
||||
{"science-pack-2", 1},
|
||||
{"science-pack-3", 1},
|
||||
},
|
||||
time = settings.startup["017-rocket-structure-energy"].value
|
||||
},
|
||||
order = "e-e-e"
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
if settings.startup["017-techtree"].value and settings.startup["017-rocket-victory"].value then
|
||||
data:extend(
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user