fixed en locale and tech generate error

This commit is contained in:
Peter 2019-01-14 10:44:06 +08:00
parent 7a1ab68d68
commit 53020fe27c
6 changed files with 42 additions and 28 deletions

View File

@ -115,6 +115,7 @@ if settings.startup["017-techtree"].value then
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
@ -123,11 +124,14 @@ if settings.startup["017-techtree"].value then
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 tech.unit and valid == true then
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
@ -142,7 +146,9 @@ if settings.startup["017-techtree"].value then
end
end
end
if valid == true and technology.prerequisites then
end
end
if technology.prerequisites and valid == true then
technology.prerequisites[#technology.prerequisites+1] = science_pack
return true
else
@ -161,13 +167,13 @@ if settings.startup["017-techtree"].value then
end
end
if whitelisted == true then
local valid = compare(tech, "science-pack-2", "science-pack-2")
local valid = compare(tech, "logistics-science-pack", "science-pack-2")
if valid == false then
local valid = compare(tech, "science-pack-3", "science-pack-3") end
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, "high-tech-science-pack", "high-tech-science-pack") end
local valid = compare(tech, "utility-science-pack", "high-tech-science-pack") end
end
end
end

View File

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

View File

@ -1,9 +1,9 @@
[technology-name]
belt-immunity-equipment=Belt immunity equipment
science-pack-2=Logistics science pack
science-pack-3=Chemical science pack
logistics-science-pack=Logistics science pack
chemical-science-pack=Chemical science pack
production-science-pack=Production science pack
high-tech-science-pack=Utility science pack
utility-science-pack=Utility science pack
[item-name]
science-pack-1=Automation science pack

View File

@ -2,13 +2,13 @@ for i, force in pairs(game.forces) do
local get_input_count = force.item_production_statistics.get_input_count
if get_input_count("science-pack-2") > 0 then
force.recipes["science-pack-2"].enabled = true
force.technologies["science-pack-2"].researched = true
force.technologies["logistics-science-pack"].researched = true
-- game.print(force.name .. " | " .. "science-pack-2" .. " | " .. get_input_count("science-pack-2"))
end
if get_input_count("science-pack-3") > 0 then
force.recipes["science-pack-3"].enabled = true
force.recipes["17-chemical-science-pack"].enabled = true
force.technologies["science-pack-3"].researched = true
force.technologies["chemical-science-pack"].researched = true
-- game.print(force.name .. " | " .. "science-pack-3" .. " | " .. get_input_count("science-pack-3"))
end
if get_input_count("production-science-pack") > 0 then
@ -20,7 +20,7 @@ for i, force in pairs(game.forces) do
if get_input_count("high-tech-science-pack") > 0 then
force.recipes["high-tech-science-pack"].enabled = true
force.recipes["17-utility-science-pack"].enabled = true
force.technologies["high-tech-science-pack"].researched = true
force.technologies["utility-science-pack"].researched = true
-- game.print(force.name .. " | " .. "high-tech-science-pack" .. " | " .. get_input_count("high-tech-science-pack"))
end
end

View File

@ -0,0 +1,8 @@
{
"technology":
[
["science-pack-2", "logistics-science-pack"],
["science-pack-3", "chemical-science-pack"],
["high-tech-science-pack", "utility-science-pack"]
]
}

View File

@ -3,7 +3,7 @@ data:extend(
{
{
type = "technology",
name = "science-pack-2",
name = "logistics-science-pack",
icon_size = 128,
icon = "__017_science__/graphics/technology/green.png",
effects =
@ -26,7 +26,7 @@ data:extend(
},
{
type = "technology",
name = "science-pack-3",
name = "chemical-science-pack",
icon_size = 128,
icon = "__017_science__/graphics/technology/blue.png",
effects =
@ -71,7 +71,7 @@ data:extend(
},
{
type = "technology",
name = "high-tech-science-pack",
name = "utility-science-pack",
icon_size = 128,
icon = "__017_science__/graphics/technology/yellow.png",
effects =