diff --git a/changelog.txt b/changelog.txt index 014fc35..e72693a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 0.9.0 +Date: 2022-01-08 + Features: + - Added a new optional gyroscope intermediate +--------------------------------------------------------------------------------------------------- Version: 0.8.3 Date: 2022-01-06 Changes: diff --git a/data-util.lua b/data-util.lua index 9920d9e..63c9719 100644 --- a/data-util.lua +++ b/data-util.lua @@ -77,14 +77,33 @@ function util.remove_prerequisite(technology_name, prerequisite) end end + -- Add an effect to a given technology function util.add_effect(technology_name, effect) local technology = data.raw.technology[technology_name] if technology then + if not technology.effects then technology.effects = {} end table.insert(technology.effects, effect) end end +-- remove recipe unlock effect from a given technology +function util.remove_recipe_effect(technology_name, recipe_name) + local technology = data.raw.technology[technology_name] + local index = -1 + if technology then + for i, effect in pairs(technology.effects) do + if effect.type == "unlock-recipe" and effect.recipe == recipe_name then + index = i + break + end + end + if index > -1 then + table.remove(technology.effects, index) + end + end +end + -- Set technology ingredients function util.set_tech_recipe(technology_name, ingredients) local technology = data.raw.technology[technology_name] @@ -93,6 +112,14 @@ function util.set_tech_recipe(technology_name, ingredients) end end +function util.set_enabled(recipe_name, enabled) + if data.raw.recipe[recipe_name] then + if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.enabled = enabled end + if data.raw.recipe[recipe_name].expensive then data.raw.recipe[recipe_name].expensive.enabled = enabled end + if not data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].enabled = enabled end + end +end + -- Add a given quantity of ingredient to a given recipe function util.add_ingredient(recipe_name, ingredient, quantity) if me.bypass[recipe_name] then return end diff --git a/data.lua b/data.lua index 11f4914..c7a44f7 100644 --- a/data.lua +++ b/data.lua @@ -1,5 +1,6 @@ require("prototypes/silica-recipe") require("prototypes/silicon-recipe") require("prototypes/optical-fiber") +require("prototypes/gyro") require("recipes/silica-matter") diff --git a/deadlock-stacking.lua b/deadlock-stacking.lua index 7060949..3debaf0 100644 --- a/deadlock-stacking.lua +++ b/deadlock-stacking.lua @@ -11,6 +11,9 @@ if deadlock then deadlock.add_stack("silicon-wafer", "__bzsilicon__/graphics/icons/stacked/silicon-wafer-stacked.png" , "deadlock-stacking-2", 64) deadlock.add_stack("solar-cell", "__bzsilicon__/graphics/icons/stacked/solar-cell-stacked.png" , "deadlock-stacking-2", 64) end + if util.me.use_gyros() then + deadlock.add_stack("gyro", "__bzsilicon__/graphics/icons/stacked/gyro-stacked.png", "deadlock-stacking-3", 128) + end end -- Deadlock crating recipes @@ -21,8 +24,11 @@ if deadlock_crating then deadlock_crating.add_crate("silicon", "deadlock-crating-2") end if util.me.more_intermediates() then - deadlock_crating.add_crate("silicon-wafer", "deadlock-crating-2", 64) - deadlock_crating.add_crate("solar-cell", "deadlock-crating-2", 64) + deadlock_crating.add_crate("silicon-wafer", "deadlock-crating-2") + deadlock_crating.add_crate("solar-cell", "deadlock-crating-2") + end + if util.me.use_gyros() then + deadlock_crating.add_crate("gyro", "deadlock-crating-3") end end diff --git a/info.json b/info.json index 9a198fa..f798061 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzsilicon", - "version": "0.8.3", + "version": "0.9.0", "factorio_version": "1.1", "title": "Silica & Silicon", "author": "Brevven", diff --git a/locale/en/silicon.cfg b/locale/en/silicon.cfg index d23948a..392e28f 100644 --- a/locale/en/silicon.cfg +++ b/locale/en/silicon.cfg @@ -11,6 +11,7 @@ silicon=Silicon silicon-wafer=Silicon wafer solar-cell=Solar cell optical-fiber=Optical Fiber +gyro=MEMS gyroscope [item-description] silica=Can be used directly or processed further. @@ -23,11 +24,13 @@ optical-fiber=Cable used for fiber optics, including circuit network. silica-processing=Silica processing silicon-processing=Silicon processing fiber-optics=Fiber optics +gyro=Microelectromechanical systems [technology-description] silica-processing=Process stone brick into silica. silicon-processing=Process silica insto silcon. fiber-optics=Optical fiber for circuit network +gyro=Learn to handle tiny moving electronics [recipe-name] silica=__ITEM__silica__ @@ -46,3 +49,8 @@ bzsilicon-bio-crushed-stone=When using Bio Industries, use crushed stone to make bzsilicon-recipe-bypass=Skip modifying these recipes (comma-separated list). bzsilicon-more-intermediates=More complex production chains. Optional in vanilla, Krastorio 2, etc. [color=red]Required for Bio Industries.[/color] bzsilicon-bio-crushed-stone=This setting is experimental, and may be removed in a future update. It's strongly recommended to keep it enabled. Only disable if your UPS is dropping due to inserter count. Added per user request. + +[string-mod-setting] +bzsilicon-more-intermediates-no=no +bzsilicon-more-intermediates-yes=Yes: wafer, solar cell +bzsilicon-more-intermediates-more=More (Experimental): wafer, solar cell, MEMS gyroscope diff --git a/me.lua b/me.lua index 8b6151b..7c6ead5 100644 --- a/me.lua +++ b/me.lua @@ -1,10 +1,13 @@ -local me = {} - +local me = {} me.name = "bzsilicon" me.silicon_processing = mods["Krastorio2"] and "kr-silicon-processing" or "silicon-processing" +function me.use_gyros() + return me.get_setting("bzsilicon-more-intermediates") == "more" +end + function me.more_intermediates() - return mods["Bio_Industries"] or me.get_setting("bzsilicon-more-intermediates") == "yes" + return mods["Bio_Industries"] or me.get_setting("bzsilicon-more-intermediates") == "yes" or me.use_gyros() end function me.use_bio_crushed_stone() diff --git a/modules.lua b/modules.lua index a848cec..644a1e7 100644 --- a/modules.lua +++ b/modules.lua @@ -5,6 +5,9 @@ if util.me.more_intermediates() then table.insert(recipes, "silicon-wafer") table.insert(recipes, "solar-cell") end +if util.me.use_gyros() then + table.insert(recipes, "gyro") +end if mods["space-exploration"] then table.insert(recipes, "silicon-smelting-vulcanite") diff --git a/recipe-updates.lua b/recipe-updates.lua index c4a43ba..176e24b 100644 --- a/recipe-updates.lua +++ b/recipe-updates.lua @@ -1,5 +1,42 @@ local util = require("__bzsilicon__.data-util"); +if util.me.use_gyros() then + util.add_ingredient("flying-robot-frame", "gyro", 1) + util.add_prerequisite("robotics", "gyro") + + util.add_ingredient("distractor-capsule", "gyro", 3) + util.add_prerequisite("distractor", "gyro") + + util.add_ingredient("laser-turret", "gyro", 1) + util.add_prerequisite("laser-turret", "gyro") + + util.add_ingredient("artillery-shell", "gyro", 1) + util.add_ingredient("rocket-control-unit", "gyro", 1) + + util.add_ingredient("gunship", "gyro", 1) + util.add_prerequisite("gunships", "gyro") + util.add_ingredient("flying-fortress", "gyro", 4) + util.add_ingredient("jet", "gyro", 4) + + util.add_ingredient("jetpack-2", "gyro", 2) + util.add_prerequisite("jetpack-2", "gyro") + + --K2 + util.add_ingredient("advanced-exoskeleton-equipment", "gyro", 4) + util.add_ingredient("kr-laser-artillery-turret", "gyro", 4) + util.add_ingredient("kr-railgun-turret", "gyro", 4) + util.add_ingredient("kr-advanced-tank", "gyro", 4) + util.add_ingredient("kr-rocket-turret", "gyro", 1) + util.add_ingredient("kr-nuclear-locomotive", "gyro", 1) + + --SE + util.add_ingredient("se-spaceship-console", "gyro", 4) + util.add_ingredient("se-space-mechanical-laboratory", "gyro", 14) + util.add_ingredient("se-space-gravimetrics-laboratory", "gyro", 8) + util.add_ingredient("se-delivery-cannon", "gyro", 2) + util.add_ingredient("se-thruster-suit-2", "gyro", 2) +end + if not mods["Krastorio2"] then util.remove_ingredient("concrete", "stone-brick"); diff --git a/settings.lua b/settings.lua index 2796577..2ace187 100644 --- a/settings.lua +++ b/settings.lua @@ -11,7 +11,7 @@ data:extend( { name = "bzsilicon-more-intermediates", setting_type = "startup", default_value = "no", - allowed_values = {"yes", "no"}, + allowed_values = {"more", "yes", "no"}, }, { type = "bool-setting",