From 0d8f3485d3c6e00a0edf8c3ca6a969ee49e3cd6d Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 17 Jan 2019 15:29:50 +0800 Subject: [PATCH] military-science-pack technology unlock --- 017_science/control.lua | 42 ++++++++++++++++++++++++++-------- 017_science/data-updates.lua | 8 +++++++ 017_science/data.lua | 3 +-- 017_science/info.json | 4 ++-- 017_science/locale/en/base.cfg | 5 ++++ 017_science/settings.lua | 16 +++++++++++++ 017_science/technology.lua | 25 ++++++++++++++++++++ 7 files changed, 90 insertions(+), 13 deletions(-) diff --git a/017_science/control.lua b/017_science/control.lua index 3b686fc..a1d8e74 100644 --- a/017_science/control.lua +++ b/017_science/control.lua @@ -204,6 +204,16 @@ script.on_configuration_changed(function() f_print("oil-processing not researched: lubricant recipe not auto-unlocking") end + if f_technologies["military-2"].researched == true then + f_recipes["17-military-science-pack"].enabled = true + if old_science then + f_recipes["military-science-pack"].enabled = true + end + f_print("military-2 researched for this force: military-science-pack recipe auto-unlocked") + else + f_print("military-2 not researched: military-science-pack recipe not auto-unlocking") + end + if f_technologies["advanced-electronics"].researched == true then f_recipes["17-chemical-science-pack"].enabled = true if old_science then @@ -254,7 +264,7 @@ script.on_configuration_changed(function() if (get_input_count("satellite") > 0) or (get_input_count("space-science-pack") > 0) then force.recipes["satellite"].enabled = true force.technologies["space-science-pack"].researched = true - force.print("force: " .. force.name .. " | satellite recipe unlocked | total produced for force: " .. get_input_count("satellite")) + force.print("force: " .. force.name .. " | satellite recipe unlocked | total produced by force: " .. get_input_count("satellite")) else force.recipes["satellite"].enabled = false force.technologies["space-science-pack"].researched = false @@ -277,12 +287,26 @@ script.on_configuration_changed(function() if get_input_count("science-pack-2") > 0 then f_recipes["science-pack-2"].enabled = true f_technologies["logistics-science-pack"].researched = true - f_print("force: " .. force.name .. " | logistics-science-pack recipe unlocked | total produced for force: " .. get_input_count("science-pack-2")) + f_print("force: " .. force.name .. " | logistics-science-pack recipe unlocked | total produced by force: " .. get_input_count("science-pack-2")) else f_recipes["science-pack-2"].enabled = false f_technologies["logistics-science-pack"].researched = false f_print("No logistics science produced by this force: technology won't be auto-researched.") end + end + + if not f_technologies["military-science-pack"].researched == true then + if get_input_count("military-science-pack") > 0 then + f_recipes["military-science-pack"].enabled = true + f_recipes["17-military-science-pack"].enabled = true + f_technologies["military-science-pack"].researched = true + f_print("force: " .. force.name .. " | military-science-pack recipe unlocked | total produced by force: " .. get_input_count("military-science-pack")) + else + f_recipes["military-science-pack"].enabled = false + f_recipes["17-military-science-pack"].enabled = false + f_technologies["military-science-pack"].researched = false + f_print("No military science produced by this force: technology won't be auto-researched.") + end end if not f_technologies["chemical-science-pack"].researched == true then @@ -290,7 +314,7 @@ script.on_configuration_changed(function() f_recipes["science-pack-3"].enabled = true f_recipes["17-chemical-science-pack"].enabled = true f_technologies["chemical-science-pack"].researched = true - f_print("force: " .. force.name .. " | chemical-science-pack recipe unlocked | total produced for force: " .. get_input_count("science-pack-3")) + f_print("force: " .. force.name .. " | chemical-science-pack recipe unlocked | total produced by force: " .. get_input_count("science-pack-3")) else f_recipes["science-pack-3"].enabled = false f_recipes["17-chemical-science-pack"].enabled = false @@ -304,7 +328,7 @@ script.on_configuration_changed(function() f_recipes["production-science-pack"].enabled = true f_recipes["17-production-science-pack"].enabled = true f_technologies["production-science-pack"].researched = true - f_print("force: " .. force.name .. " | production-science-pack recipe unlocked | total produced for force: " .. get_input_count("production-science-pack")) + f_print("force: " .. force.name .. " | production-science-pack recipe unlocked | total produced by force: " .. get_input_count("production-science-pack")) else f_recipes["production-science-pack"].enabled = false f_recipes["17-production-science-pack"].enabled = false @@ -318,7 +342,7 @@ script.on_configuration_changed(function() f_recipes["high-tech-science-pack"].enabled = true f_recipes["17-utility-science-pack"].enabled = true f_technologies["utility-science-pack"].researched = true - f_print("force: " .. force.name .. " | high-tech-science-pack recipe unlocked | total produced for force: " .. get_input_count("high-tech-science-pack")) + f_print("force: " .. force.name .. " | high-tech-science-pack recipe unlocked | total produced by force: " .. get_input_count("high-tech-science-pack")) else f_recipes["high-tech-science-pack"].enabled = false f_recipes["17-utility-science-pack"].enabled = false @@ -331,7 +355,7 @@ script.on_configuration_changed(function() if get_fluid_input_count("lubricant") > 0 then f_recipes["lubricant"].enabled = true f_technologies["lubricant"].researched = true - f_print("force: " .. force.name .. " | lubricant recipe unlocked | total produced for force: " .. get_fluid_input_count("lubricant")) + f_print("force: " .. force.name .. " | lubricant recipe unlocked | total produced by force: " .. get_fluid_input_count("lubricant")) else f_recipes["lubricant"].enabled = false f_technologies["lubricant"].researched = false @@ -343,7 +367,7 @@ script.on_configuration_changed(function() if get_input_count("rocket-fuel") > 0 then f_recipes["rocket-fuel"].enabled = true f_technologies["rocket-fuel"].researched = true - f_print("force: " .. force.name .. " | rocket-fuel recipe unlocked | total produced for force: " .. get_input_count("rocket-fuel")) + f_print("force: " .. force.name .. " | rocket-fuel recipe unlocked | total produced by force: " .. get_input_count("rocket-fuel")) else f_recipes["rocket-fuel"].enabled = false f_technologies["rocket-fuel"].researched = false @@ -356,7 +380,7 @@ script.on_configuration_changed(function() f_recipes["low-density-structure"].enabled = true f_recipes["17-low-density-structure"].enabled = true f_technologies["low-density-structure"].researched = true - f_print("force: " .. force.name .. " | low-density-structure recipe unlocked | total produced for force: " .. get_input_count("low-density-structure")) + 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_recipes["17-low-density-structure"].enabled = false @@ -369,7 +393,7 @@ script.on_configuration_changed(function() if get_input_count("rocket-control-unit") > 0 then f_recipes["rocket-control-unit"].enabled = true f_technologies["rocket-control-unit"].researched = true - f_print("force: " .. force.name .. " | rocket-control-unit recipe unlocked | total produced for force: " .. get_input_count("rocket-control-unit")) + f_print("force: " .. force.name .. " | rocket-control-unit recipe unlocked | total produced by force: " .. get_input_count("rocket-control-unit")) else f_recipes["rocket-control-unit"].enabled = false f_technologies["rocket-control-unit"].researched = false diff --git a/017_science/data-updates.lua b/017_science/data-updates.lua index 0bbcd8f..84e3992 100644 --- a/017_science/data-updates.lua +++ b/017_science/data-updates.lua @@ -127,10 +127,16 @@ if settings.startup["017-techtree"].value then if settings.startup["017-old-science"].value and settings.startup["017-techtree"].value then remove_effect_table = { + {"military-2", "military-science-pack "}, {"advanced-electronics", "science-pack-3"}, {"advanced-material-processing-2", "production-science-pack"}, {"advanced-electronics-2", "high-tech-science-pack"} } + + data_technology["military-science-pack"].effects = { + {type = "unlock-recipe", recipe = "military-science-pack"}, + {type = "unlock-recipe", recipe = "17-military-science-pack"} + } data_technology["chemical-science-pack"].effects = { {type = "unlock-recipe", recipe = "science-pack-3"}, {type = "unlock-recipe", recipe = "17-chemical-science-pack"} @@ -244,6 +250,8 @@ if settings.startup["017-techtree"].value 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 diff --git a/017_science/data.lua b/017_science/data.lua index 45184b9..6812ad2 100644 --- a/017_science/data.lua +++ b/017_science/data.lua @@ -1,9 +1,8 @@ require("recipe") require("technology") -table.insert(data.raw["technology"]["military-2"].effects, {type = "unlock-recipe",recipe = "17-military-science-pack"}) - if not settings.startup["017-techtree"].value then + 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"}) diff --git a/017_science/info.json b/017_science/info.json index c1d40bb..b289f99 100644 --- a/017_science/info.json +++ b/017_science/info.json @@ -1,10 +1,10 @@ { "name": "017_science", - "version": "0.1.0", + "version": "0.1.1", "factorio_version": "0.16", "title": "0.17 science conversion", "author": "npc_strider(morley376)", "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. 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!" + "description": "Read the modpage for more information: https://mods.factorio.com/mod/017_science. Adds in the new science pack recipes and known tech tree, while keeping 0.16 recipes intact so that the player may update their base at their own pace. Implements almost all 0.17 balance changes: transport-belt, mining, smelting changes, and more (see page for full list). Compatible with existing saves, most big mods and will support release 0.17!" } \ No newline at end of file diff --git a/017_science/locale/en/base.cfg b/017_science/locale/en/base.cfg index c45e59d..d4d62aa 100644 --- a/017_science/locale/en/base.cfg +++ b/017_science/locale/en/base.cfg @@ -1,6 +1,7 @@ [technology-name] belt-immunity-equipment=Belt immunity equipment logistics-science-pack=Logistics science pack +military-science-pack=Military science pack chemical-science-pack=Chemical science pack production-science-pack=Production science pack utility-science-pack=Utility science pack @@ -35,6 +36,7 @@ high-tech-science-pack=Utility science pack 017-rocket-victory=No-rocket victory 017-tank-gun-nerf=Tank machinegun nerf 017-green-cost=Logistics science pack technology cost +017-military-cost=Military 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 @@ -46,6 +48,7 @@ high-tech-science-pack=Utility science pack 017-uranium-enrichment-cost=Uranium enrichment technology cost 017-nuclear-power-cost=Nuclear power technology cost 017-green-energy=Logistics science pack technology time-per-unit +017-military-energy=Military 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 @@ -74,6 +77,7 @@ high-tech-science-pack=Utility science pack 017-rocket-victory=(Default enabled) The victory condition for the game no longer requires a payload (satellite) (FFF-275). 017-tank-gun-nerf=(Default enabled) FFF-275 states that the 100% damage bonus the tank machinegun provides will be removed. 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. Default based off steel-processing difficulty +017-military-cost=(Default 100, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Default based off gates difficulty 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. Default based off advanced-electronics difficulty 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. Default based off advanced-material-processing-2 difficulty. 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. Default based off advanced-electronics-2 difficulty. @@ -85,6 +89,7 @@ high-tech-science-pack=Utility science pack 017-uranium-enrichment-cost=(Default 500, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Default based off nuclear-power cost (halved). 017-nuclear-power-cost=(Default 500, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Default based off nuclear-power cost (halved). 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-military-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-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/settings.lua b/017_science/settings.lua index db783e2..08cb7bf 100644 --- a/017_science/settings.lua +++ b/017_science/settings.lua @@ -117,6 +117,14 @@ data:extend( minimum_value = 0, default_value = 50, order = "npc-na" + }, + { + type = "int-setting", + name = "017-military-cost", + setting_type = "startup", + minimum_value = 0, + default_value = 100, + order = "npc-nab" }, { type = "int-setting", @@ -206,6 +214,14 @@ data:extend( minimum_value = 0, default_value = 5, order = "npc-oa" + }, + { + type = "int-setting", + name = "017-military-energy", + setting_type = "startup", + minimum_value = 0, + default_value = 15, + order = "npc-oab" }, { type = "int-setting", diff --git a/017_science/technology.lua b/017_science/technology.lua index d8bbb6d..8f5e0e3 100644 --- a/017_science/technology.lua +++ b/017_science/technology.lua @@ -24,6 +24,31 @@ data:extend( }, order = "d-a-a-a" }, + { + type = "technology", + name = "military-science-pack", + icon_size = 128, + icon = "__017_science__/graphics/technology/gray.png", + effects = + { + { + type = "unlock-recipe", + recipe = "17-military-science-pack" + } + }, + prerequisites = {"military-2", "stone-walls"}, + unit = + { + count = settings.startup["017-military-cost"].value, + ingredients = + { + {"science-pack-1", 1}, + {"science-pack-2", 1}, + }, + time = settings.startup["017-military-energy"].value + }, + order = "e-a-b-a" + }, { type = "technology", name = "chemical-science-pack",