diff --git a/017_science/data-updates.lua b/017_science/data-updates.lua index cf9b853..6d5b9db 100644 --- a/017_science/data-updates.lua +++ b/017_science/data-updates.lua @@ -45,8 +45,6 @@ local function remove_science(technology, science_pack) end end -remove_science(data.raw["technology"]["rocket-silo"].unit.ingredients, "military-science-pack") - if settings.startup["017-recipes-changes"].value then 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") 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 +local r_effects = data.raw["technology"]["rocket-silo"].effects --remove the duplicate LDS effect in rocket-silo research +for _=1, #r_effects do + 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 + r_effects[_] = nil 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 --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", name = "belt-immunity-equipment", icon_size = 128, - icon = "__017_science__/graphics/belt-immunity-equipment.png", + icon = "__017_science__/graphics/technology/belt-immunity-equipment.png", prerequisites = {"modular-armor"}, effects = { diff --git a/017_science/data.lua b/017_science/data.lua index 883abf9..04a2d2d 100644 --- a/017_science/data.lua +++ b/017_science/data.lua @@ -1,9 +1,12 @@ 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"]["advanced-electronics"].effects, {type = "unlock-recipe",recipe = "17-chemical-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"}) +if not settings.startup["017-techtree"].value then + table.insert(data.raw["technology"]["advanced-electronics"].effects, {type = "unlock-recipe",recipe = "17-chemical-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"}) diff --git a/017_science/graphics/belt-immunity-equipment.png b/017_science/graphics/technology/belt-immunity-equipment.png similarity index 100% rename from 017_science/graphics/belt-immunity-equipment.png rename to 017_science/graphics/technology/belt-immunity-equipment.png diff --git a/017_science/graphics/technology/blue.png b/017_science/graphics/technology/blue.png new file mode 100644 index 0000000..adaa62b Binary files /dev/null and b/017_science/graphics/technology/blue.png differ diff --git a/017_science/graphics/technology/gray.png b/017_science/graphics/technology/gray.png new file mode 100644 index 0000000..3e15b95 Binary files /dev/null and b/017_science/graphics/technology/gray.png differ diff --git a/017_science/graphics/technology/green.png b/017_science/graphics/technology/green.png new file mode 100644 index 0000000..814d805 Binary files /dev/null and b/017_science/graphics/technology/green.png differ diff --git a/017_science/graphics/technology/purple.png b/017_science/graphics/technology/purple.png new file mode 100644 index 0000000..125d48a Binary files /dev/null and b/017_science/graphics/technology/purple.png differ diff --git a/017_science/graphics/technology/white.png b/017_science/graphics/technology/white.png new file mode 100644 index 0000000..668b362 Binary files /dev/null and b/017_science/graphics/technology/white.png differ diff --git a/017_science/graphics/technology/yellow.png b/017_science/graphics/technology/yellow.png new file mode 100644 index 0000000..1ccefd2 Binary files /dev/null and b/017_science/graphics/technology/yellow.png differ diff --git a/017_science/info.json b/017_science/info.json index ca54dd7..a3ce5a5 100644 --- a/017_science/info.json +++ b/017_science/info.json @@ -1,10 +1,10 @@ { "name": "017_science", - "version": "0.0.11", + "version": "0.0.12", "factorio_version": "0.16", "title": "0.17 science conversion", "author": "npc_strider(morley376)", - "contact": "", + "contact": "https://mods.factorio.com/mod/017_science/discussion", "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!" } \ No newline at end of file diff --git a/017_science/locale/en/base.cfg b/017_science/locale/en/base.cfg index e36735f..6831f3a 100644 --- a/017_science/locale/en/base.cfg +++ b/017_science/locale/en/base.cfg @@ -1,5 +1,9 @@ [technology-name] 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] science-pack-1=Automation science pack @@ -19,6 +23,17 @@ high-tech-science-pack=Utility science pack 017-equipment=Belt immunity equipment 017-lds=low-density-structure in recipes 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] 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-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-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) \ No newline at end of file +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. diff --git a/017_science/migrations/2019-01-13_017_science_0.0.12.lua b/017_science/migrations/2019-01-13_017_science_0.0.12.lua new file mode 100644 index 0000000..6c4c0fd --- /dev/null +++ b/017_science/migrations/2019-01-13_017_science_0.0.12.lua @@ -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 \ No newline at end of file diff --git a/017_science/settings.lua b/017_science/settings.lua index 19f8328..f2ccc6a 100644 --- a/017_science/settings.lua +++ b/017_science/settings.lua @@ -1,52 +1,48 @@ 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", name = "017-old-science", 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", name = "017-recipes-changes", setting_type = "startup", - default_value = true - }, - { - type = "bool-setting", - name = "017-axe", - setting_type = "startup", - default_value = true - }, - { - type = "bool-setting", - name = "017-durability", - setting_type = "startup", - default_value = true + default_value = true, + order = "npc-e" }, { type = "bool-setting", name = "017-lds", setting_type = "startup", - default_value = true + default_value = true, + order = "npc-f" }, { type = "int-setting", @@ -54,12 +50,113 @@ data:extend( setting_type = "startup", minimum_value = 1, 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", name = "017-equipment", 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" + } }) \ No newline at end of file diff --git a/017_science/technology.lua b/017_science/technology.lua new file mode 100644 index 0000000..e0c6f51 --- /dev/null +++ b/017_science/technology.lua @@ -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 \ No newline at end of file