huge commit, see changelog 0.0.12

This commit is contained in:
Peter 2019-01-13 23:32:46 +08:00
parent 3692b6750f
commit 7a1ab68d68
14 changed files with 427 additions and 51 deletions

View File

@ -45,8 +45,6 @@ local function remove_science(technology, science_pack)
end end
end end
remove_science(data.raw["technology"]["rocket-silo"].unit.ingredients, "military-science-pack")
if settings.startup["017-recipes-changes"].value then 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"]["atomic-bomb"].ingredients, "processing-unit", {"rocket-control-unit", 15})
@ -58,14 +56,122 @@ if settings.startup["017-recipes-changes"].value then
table.insert(power_armor, "advanced-electronics-2") table.insert(power_armor, "advanced-electronics-2")
end end
local effects = data.raw["technology"]["rocket-silo"].effects --remove the duplicate LDS effect in rocket-silo research local r_effects = data.raw["technology"]["rocket-silo"].effects --remove the duplicate LDS effect in rocket-silo research
for _=1, #effects do for _=1, #r_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 if r_effects[_].type == "unlock-recipe" and (r_effects[_].recipe == "low-density-structure" or r_effects[_].recipe == "rocket-fuel" or r_effects[_].recipe == "rocket-control-unit") then
effects[_] = nil r_effects[_] = nil
end end
end end
prerequisites(data.raw["technology"]["rocket-silo"].prerequisites, "rocket-speed-5", nil) data.raw["technology"]["nuclear-fuel-reprocessing"].unit.count = (1500-settings.startup["017-nuclear-reprocessing-discount"].value)
if settings.startup["017-pack-type-rebalancing"].value then
remove_science(data.raw["technology"]["rocket-silo"].unit.ingredients, "military-science-pack")
remove_science(data.raw["technology"]["kovarex-enrichment-process"].unit.ingredients, "high-tech-science-pack")
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})
remove_science(data.raw["technology"]["logistic-system"].unit.ingredients, "production-science-pack")
end
if settings.startup["017-techtree"].value then
prerequisites(data.raw["technology"]["rocket-silo"].prerequisites, "rocket-speed-5", nil)
data.raw["recipe"]["science-pack-2"].enabled = false
if settings.startup["017-old-science"].value and settings.startup["017-techtree"].value then
remove_effect_table = {
{"advanced-electronics", "science-pack-3"},
{"advanced-material-processing-2", "production-science-pack"},
{"advanced-electronics-2", "high-tech-science-pack"}
}
data.raw["technology"]["science-pack-3"].effects = {
{type = "unlock-recipe", recipe = "science-pack-3"},
{type = "unlock-recipe", recipe = "17-chemical-science-pack"}
}
data.raw["technology"]["production-science-pack"].effects = {
{type = "unlock-recipe", recipe = "production-science-pack"},
{type = "unlock-recipe", recipe = "17-production-science-pack"}
}
data.raw["technology"]["high-tech-science-pack"].effects = {
{type = "unlock-recipe", recipe = "high-tech-science-pack"},
{type = "unlock-recipe", recipe = "17-utility-science-pack"}
}
for i=1, #remove_effect_table do
local effects = data.raw["technology"][remove_effect_table[i][1]].effects
for _=1, #effects do
if effects[_] then
if effects[_].type == "unlock-recipe" and effects[_].recipe == remove_effect_table[i][2] then
table.remove(effects, _)
end
end
end
end
end
local function compare(technology, science_pack, pre_tier)
valid = true
for l, j in pairs(technology.unit.ingredients) do
if j[1] == pre_tier then
valid = true
break
else
valid = false
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
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
end
end
end
if valid == true and technology.prerequisites 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.effects then
for i=1, #tech.effects do
if tech.effects[i].type == "unlock-recipe" then
whitelisted = true
break
else
whitelisted = false
end
end
if whitelisted == true then
local valid = compare(tech, "science-pack-2", "science-pack-2")
if valid == false then
local valid = compare(tech, "science-pack-3", "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
end
end
end
end
--player equipment changes --player equipment changes
--https://forums.factorio.com/viewtopic.php?t=6059 --https://forums.factorio.com/viewtopic.php?t=6059
@ -96,7 +202,7 @@ if settings.startup["017-equipment"].value and data.raw["recipe"]["belt-immunity
type = "technology", type = "technology",
name = "belt-immunity-equipment", name = "belt-immunity-equipment",
icon_size = 128, icon_size = 128,
icon = "__017_science__/graphics/belt-immunity-equipment.png", icon = "__017_science__/graphics/technology/belt-immunity-equipment.png",
prerequisites = {"modular-armor"}, prerequisites = {"modular-armor"},
effects = effects =
{ {

View File

@ -1,9 +1,12 @@
require("recipe") require("recipe")
require("technology")
table.insert(data.raw["technology"]["military-2"].effects, {type = "unlock-recipe",recipe = "17-military-science-pack"}) table.insert(data.raw["technology"]["military-2"].effects, {type = "unlock-recipe",recipe = "17-military-science-pack"})
table.insert(data.raw["technology"]["advanced-electronics"].effects, {type = "unlock-recipe",recipe = "17-chemical-science-pack"}) if not settings.startup["017-techtree"].value then
table.insert(data.raw["technology"]["advanced-material-processing-2"].effects, {type = "unlock-recipe",recipe = "17-production-science-pack"}) table.insert(data.raw["technology"]["advanced-electronics"].effects, {type = "unlock-recipe",recipe = "17-chemical-science-pack"})
table.insert(data.raw["technology"]["advanced-electronics-2"].effects, {type = "unlock-recipe",recipe = "17-utility-science-pack"}) table.insert(data.raw["technology"]["advanced-material-processing-2"].effects, {type = "unlock-recipe",recipe = "17-production-science-pack"})
table.insert(data.raw["technology"]["advanced-electronics-2"].effects, {type = "unlock-recipe",recipe = "17-utility-science-pack"})
end
table.insert(data.raw["technology"]["advanced-electronics-2"].effects, {type = "unlock-recipe",recipe = "rocket-control-unit"}) table.insert(data.raw["technology"]["advanced-electronics-2"].effects, {type = "unlock-recipe",recipe = "rocket-control-unit"})

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,10 +1,10 @@
{ {
"name": "017_science", "name": "017_science",
"version": "0.0.11", "version": "0.0.12",
"factorio_version": "0.16", "factorio_version": "0.16",
"title": "0.17 science conversion", "title": "0.17 science conversion",
"author": "npc_strider(morley376)", "author": "npc_strider(morley376)",
"contact": "", "contact": "https://mods.factorio.com/mod/017_science/discussion",
"homepage": "http://steamcommunity.com/id/morley376", "homepage": "http://steamcommunity.com/id/morley376",
"description": "Adds in the new science pack recipes, while keeping 0.16 recipes intact so that the player may update their base at their own pace. Also implements the 0.17 LDS recipe change, science pack names and icons. Does not revamp the tech tree." "description": "Adds in the new science pack recipes, while keeping 0.16 recipes intact so that the player may update their base at their own pace. Implements other 0.17 balance changes: LDS change, transport-belt, mining & smelting speed changes, removal of durability and pickaxe research unlock, and more! Compatible with other big overhaul mods and will support 0.17 on release!"
} }

View File

@ -1,5 +1,9 @@
[technology-name] [technology-name]
belt-immunity-equipment=Belt immunity equipment belt-immunity-equipment=Belt immunity equipment
science-pack-2=Logistics science pack
science-pack-3=Chemical science pack
production-science-pack=Production science pack
high-tech-science-pack=Utility science pack
[item-name] [item-name]
science-pack-1=Automation science pack science-pack-1=Automation science pack
@ -19,6 +23,17 @@ high-tech-science-pack=Utility science pack
017-equipment=Belt immunity equipment 017-equipment=Belt immunity equipment
017-lds=low-density-structure in recipes 017-lds=low-density-structure in recipes
017-lds-num=low-density-structure factor 017-lds-num=low-density-structure factor
017-pack-type-rebalancing=Science pack type rebalancing
017-techtree=Science-pack technologies and techtree
017-nuclear-reprocessing-discount=nuclear-fuel-reprocessing technology discount
017-green-cost=Logistics science pack technology cost
017-chem-cost=Chemical science pack technology cost
017-purple-cost=Production science pack technology cost
017-gold-cost=Utility science pack technology cost
017-green-energy=Logistics science pack technology time-per-unit
017-chem-energy=Chemical science pack technology time-per-unit
017-purple-energy=Production science pack technology time-per-unit
017-gold-energy=Utility science pack technology time-per-unit
[mod-setting-description] [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-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.
@ -30,4 +45,15 @@ high-tech-science-pack=Utility science pack
017-axe=(Default enabled) IMPORTANT NOTE: It is highly recomended that infinite durability is enabled when using this option to prevent duplicate items. Implements the FFF-266 changes as best as possible. Instead of mining-tools being crafted, they are inserted and locked to the player's tool slot when they're researched. The best mining-tool is used over lower speed ones. 017-axe=(Default enabled) IMPORTANT NOTE: It is highly recomended that infinite durability is enabled when using this option to prevent duplicate items. Implements the FFF-266 changes as best as possible. Instead of mining-tools being crafted, they are inserted and locked to the player's tool slot when they're researched. The best mining-tool is used over lower speed ones.
017-equipment=(Default enabled) Adds belt-immunity-equipment tech and recipe (FFF-256). Note that if another mod that adds belt-immunity-equipment recipe is present, this mod's unlock will be disabled. Disabling this option in an existing game will NOT remove the item - only the recipe & tech. 017-equipment=(Default enabled) Adds belt-immunity-equipment tech and recipe (FFF-256). Note that if another mod that adds belt-immunity-equipment recipe is present, this mod's unlock will be disabled. Disabling this option in an existing game will NOT remove the item - only the recipe & tech.
017-lds=(Default enabled) low-density-structure is also used in multiple advanced personal equipment recipes (mk2 items, fusion reactor, laser defense) instead of steel (FFF-257). NOTE: the cost values in this mod are NOT official, and won't affect other mods (contact me if you want your modded recipe added.). Where possible the cost = math.ceil(n("steel-plate")/2) 017-lds=(Default enabled) low-density-structure is also used in multiple advanced personal equipment recipes (mk2 items, fusion reactor, laser defense) instead of steel (FFF-257). NOTE: the cost values in this mod are NOT official, and won't affect other mods (contact me if you want your modded recipe added.). Where possible the cost = math.ceil(n("steel-plate")/2)
017-lds-num=(Default 5) When steel-plate is not present in vanilla 'high tech' equipment recipes, the cost is determined by the number of "processing-unit"s. math.ceil(n("processing-unit")/thissetting) 017-lds-num=(Default 5, Min 1, Max 32) When steel-plate is not present in vanilla 'high tech' equipment recipes, the cost is determined by the number of "processing-unit"s. math.ceil(n("processing-unit")/thissetting)
017-pack-type-rebalancing=(Default enabled) Enable the rebalancing of high-end technologies into production/utility 'categories' (FFF-275). For example, level-3 modules no longer use utility science and will use production science instead as they increase production.
017-techtree=(Default enabled) Enable the 0.17 techtree. Science packs are now unlocked by dedicated technologies and the rocket-silo no longer requires rocket-speed-5 as a prerequisite (FFF-275 & FFF-245). NOTE: Technologies are dynamically assigned a 'science pack technology' as a prerequisite through script (to work with mods). This may not reflect release tech paths.
017-nuclear-reprocessing-discount=(Default 1000, Min 0, Max 1400) This number is subtracted from the current cost of nuclear-fuel-reprocessing technology (1500). FFF-275 hints at a major discount to this technology ("The Nuclear fuel cell reprocessing is also drastically cheaper") but does not specify an amount.
017-green-cost=(Default 50, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies.
017-chem-cost=(Default 200, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies.
017-purple-cost=(Default 250, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies.
017-gold-cost=(Default 250, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies.
017-green-energy=(Default 5, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology.
017-chem-energy=(Default 15, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology.
017-purple-energy=(Default 30, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology.
017-gold-energy=(Default 30, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology.

View File

@ -0,0 +1,26 @@
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
-- 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
-- game.print(force.name .. " | " .. "science-pack-3" .. " | " .. get_input_count("science-pack-3"))
end
if get_input_count("production-science-pack") > 0 then
force.recipes["production-science-pack"].enabled = true
force.recipes["17-production-science-pack"].enabled = true
force.technologies["production-science-pack"].researched = true
-- game.print(force.name .. " | " .. "production-science-pack" .. " | " .. get_input_count("production-science-pack"))
end
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
-- game.print(force.name .. " | " .. "high-tech-science-pack" .. " | " .. get_input_count("high-tech-science-pack"))
end
end

View File

@ -1,52 +1,48 @@
data:extend( data:extend(
{ {
{
type = "bool-setting",
name = "017-drill",
setting_type = "startup",
default_value = true
},
{
type = "bool-setting",
name = "017-smelting",
setting_type = "startup",
default_value = true
},
{
type = "bool-setting",
name = "017-assem-lim",
setting_type = "startup",
default_value = true
},
{ {
type = "bool-setting", type = "bool-setting",
name = "017-old-science", name = "017-old-science",
setting_type = "startup", setting_type = "startup",
default_value = false default_value = false,
order = "npc-a"
},
{
type = "bool-setting",
name = "017-pack-type-rebalancing",
setting_type = "startup",
default_value = true,
order = "npc-b"
},
{
type = "bool-setting",
name = "017-techtree",
setting_type = "startup",
default_value = true,
order = "npc-c"
},
{
type = "int-setting",
name = "017-nuclear-reprocessing-discount",
setting_type = "startup",
minimum_value = 0,
maximum_value = 1400,
default_value = 1000,
order = "npc-d"
}, },
{ {
type = "bool-setting", type = "bool-setting",
name = "017-recipes-changes", name = "017-recipes-changes",
setting_type = "startup", setting_type = "startup",
default_value = true default_value = true,
}, order = "npc-e"
{
type = "bool-setting",
name = "017-axe",
setting_type = "startup",
default_value = true
},
{
type = "bool-setting",
name = "017-durability",
setting_type = "startup",
default_value = true
}, },
{ {
type = "bool-setting", type = "bool-setting",
name = "017-lds", name = "017-lds",
setting_type = "startup", setting_type = "startup",
default_value = true default_value = true,
order = "npc-f"
}, },
{ {
type = "int-setting", type = "int-setting",
@ -54,12 +50,113 @@ data:extend(
setting_type = "startup", setting_type = "startup",
minimum_value = 1, minimum_value = 1,
maximum_value = 32, maximum_value = 32,
default_value = 5 default_value = 5,
order = "npc-g"
},
{
type = "bool-setting",
name = "017-drill",
setting_type = "startup",
default_value = true,
order = "npc-h"
},
{
type = "bool-setting",
name = "017-smelting",
setting_type = "startup",
default_value = true,
order = "npc-i"
},
{
type = "bool-setting",
name = "017-assem-lim",
setting_type = "startup",
default_value = true,
order = "npc-j"
},
{
type = "bool-setting",
name = "017-durability",
setting_type = "startup",
default_value = true,
order = "npc-k"
},
{
type = "bool-setting",
name = "017-axe",
setting_type = "startup",
default_value = true,
order = "npc-l"
}, },
{ {
type = "bool-setting", type = "bool-setting",
name = "017-equipment", name = "017-equipment",
setting_type = "startup", setting_type = "startup",
default_value = true default_value = true,
order = "npc-m"
},
{
type = "int-setting",
name = "017-green-cost",
setting_type = "startup",
minimum_value = 0,
default_value = 50,
order = "npc-na"
},
{
type = "int-setting",
name = "017-chem-cost",
setting_type = "startup",
minimum_value = 0,
default_value = 200,
order = "npc-nb"
},
{
type = "int-setting",
name = "017-purple-cost",
setting_type = "startup",
minimum_value = 0,
default_value = 250,
order = "npc-nc"
},
{
type = "int-setting",
name = "017-gold-cost",
setting_type = "startup",
minimum_value = 0,
default_value = 250,
order = "npc-nd"
},
{
type = "int-setting",
name = "017-green-energy",
setting_type = "startup",
minimum_value = 0,
default_value = 5,
order = "npc-oa"
},
{
type = "int-setting",
name = "017-chem-energy",
setting_type = "startup",
minimum_value = 0,
default_value = 15,
order = "npc-ob"
},
{
type = "int-setting",
name = "017-purple-energy",
setting_type = "startup",
minimum_value = 0,
default_value = 30,
order = "npc-oc"
},
{
type = "int-setting",
name = "017-gold-energy",
setting_type = "startup",
minimum_value = 0,
default_value = 30,
order = "npc-oe"
} }
}) })

118
017_science/technology.lua Normal file
View File

@ -0,0 +1,118 @@
if settings.startup["017-techtree"].value then
data:extend(
{
{
type = "technology",
name = "science-pack-2",
icon_size = 128,
icon = "__017_science__/graphics/technology/green.png",
effects =
{
{
type = "unlock-recipe",
recipe = "science-pack-2"
}
},
unit =
{
count = settings.startup["017-green-cost"].value,
ingredients =
{
{"science-pack-1", 1},
},
time = settings.startup["017-green-energy"].value
},
order = "d-a-a-a"
},
{
type = "technology",
name = "science-pack-3",
icon_size = 128,
icon = "__017_science__/graphics/technology/blue.png",
effects =
{
{type = "unlock-recipe", recipe = "17-chemical-science-pack"}
},
prerequisites = {"oil-processing", "advanced-electronics", "engine"},
unit =
{
count = settings.startup["017-chem-cost"].value,
ingredients =
{
{"science-pack-1", 1},
{"science-pack-2", 1},
},
time = settings.startup["017-chem-energy"].value
},
order = "a-d-b-a"
},
{
type = "technology",
name = "production-science-pack",
icon_size = 128,
icon = "__017_science__/graphics/technology/purple.png",
effects =
{
{type = "unlock-recipe", recipe = "17-production-science-pack"}
},
prerequisites = {"advanced-material-processing-2", "productivity-module", "railway"},
unit =
{
count = settings.startup["017-purple-cost"].value,
ingredients =
{
{"science-pack-1", 1},
{"science-pack-2", 1},
{"science-pack-3", 1},
},
time = settings.startup["017-purple-energy"].value
},
order = "c-c-b"
},
{
type = "technology",
name = "high-tech-science-pack",
icon_size = 128,
icon = "__017_science__/graphics/technology/yellow.png",
effects =
{
{type = "unlock-recipe", recipe = "17-utility-science-pack"}
},
prerequisites = {"advanced-electronics-2", "robotics"},
unit =
{
count = settings.startup["017-gold-cost"].value,
ingredients =
{
{"science-pack-1", 1},
{"science-pack-2", 1},
{"science-pack-3", 1},
},
time = settings.startup["017-gold-energy"].value
},
order = "e-e-e"
}--, (NEXT UPDATE! SPACE SCIENCE + SATELLITE REBALANCING)
-- {
-- type = "technology",
-- name = "space-science-pack",
-- icon_size = 128,
-- icon = "__017_science__/graphics/technology/white.png",
-- effects =
-- {
-- {type = "unlock-recipe", recipe = "17-utility-science-pack"}
-- },
-- unit =
-- {
-- count = 250,
-- ingredients =
-- {
-- {"science-pack-1", 1},
-- {"science-pack-2", 1},
-- {"science-pack-3", 1},
-- },
-- time = 15
-- },
-- order = "a-d-b-a"
-- }
})
end