diff --git a/changelog.txt b/changelog.txt index 2a92844..d2c98cc 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,16 @@ --------------------------------------------------------------------------------------------------- +Version: 2.0.22 +Date: 2025-03-10 + Changes: + - Set custom inventory sounds for some items + Fixes: + - Loads with Crafting Efficiency +--------------------------------------------------------------------------------------------------- +Version: 2.0.21 +Date: 2025-03-10 + Changes: + - Minor icon tweak +--------------------------------------------------------------------------------------------------- Version: 2.0.20 Date: 2025-02-01 Changes: diff --git a/compatibility/crafting-efficiency.lua b/compatibility/crafting-efficiency.lua deleted file mode 100644 index ea5a48c..0000000 --- a/compatibility/crafting-efficiency.lua +++ /dev/null @@ -1,35 +0,0 @@ -local util = require("data-util"); - -if mods["crafting-efficiency-2"] then - - local eff_data = { - } - - for i, recipe in pairs(util.me.recipes) do - -- add remaining recipes with direct items to find the icons - if data.raw.recipe[recipe] and (data.raw.item[recipe] or data.raw.fluid[recipe]) - and not eff_data[recipe] then - local research_level = 1 - if not data.raw.recipe[recipe].enabled then - for tech, tbl in pairs(data.raw.technology) do - for _, effect in pairs(tbl.effects or {}) do - if effect.type == "unlock-recipe" and effect.recipe == recipe then - research_level = math.min(#tbl.unit.ingredients, 6) - end - end - end - end - eff_data[recipe] = { - max = 15, - icon = util.get_item_or_fluid_icon(recipe), - crafting = { efficiency = 10 }, - research = { level = research_level }, - } - end - end - for recipe, d in pairs(eff_data) do - log("Adding "..recipe.." crafting efficiency") - d.name = recipe:gsub("^%l", string.upper).." efficiency" - CE_Add_Recipe(d, recipe) - end -end diff --git a/data-updates.lua b/data-updates.lua index 545a22b..86f4227 100644 --- a/data-updates.lua +++ b/data-updates.lua @@ -5,7 +5,6 @@ require("omni") require("map-gen-preset-updates") require("strange-matter") require("compatibility/248k") -require("compatibility/crafting-efficiency") local util = require("data-util") util.redo_recycling() @@ -22,4 +21,4 @@ if mods["any-planet-start"] then }) end -util.add_shiftite_recipe("titanium-plate", "beta", 2) +util.add_shiftite_recipe("titanium-plate", {"beta"}, 2) diff --git a/data-util.lua b/data-util.lua index 0560a31..1cff5c3 100644 --- a/data-util.lua +++ b/data-util.lua @@ -12,6 +12,22 @@ util.get_setting = util.me.get_setting util.titanium_plate = "" util.titanium_processing = "" +local foo = [[ +local item_sounds = require('__base__.prototypes.item_sounds') + + inventory_move_sound = item_sounds.wire_inventory_move, + pick_sound = item_sounds.wire_inventory_pickup, + drop_sound = item_sounds.wire_inventory_move, + + inventory_move_sound = item_sounds.metal_small_inventory_move, + pick_sound = item_sounds.metal_small_inventory_pickup, + drop_sound = item_sounds.metal_small_inventory_move, + + inventory_move_sound = item_sounds.resource_inventory_move, + pick_sound = item_sounds.resource_inventory_pickup, + drop_sound = item_sounds.resource_inventory_move, +]] + util.A = {{"automation-science-pack", 1}} util.AL = {{"automation-science-pack", 1}, {"logistic-science-pack", 1}} util.ALC = {{"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}} @@ -157,6 +173,7 @@ function util.add_shiftite_recipe(item, shiftites, quantity) end -- Add the gleba rock. If it exists, still add resource to mine from it +local gleba_tint = {.6, .8, 1} function util.add_gleba_rock(resource, amount_min, amount_max) if (not data.raw.planet.gleba or not data.raw.planet.gleba.map_gen_settings or -- attempted compatibility fixes @@ -176,7 +193,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) name = "gleba-rock", localised_name = {"entity-name.big-rock"}, flags = {"placeable-neutral", "placeable-off-grid"}, - icon = "__base__/graphics/icons/big-sand-rock.png", + icons = {{icon = "__base__/graphics/icons/big-sand-rock.png", tint=gleba_tint}}, subgroup = "grass", order = "b[decorative]-l[rock]-a[big]", deconstruction_alternative = "big-rock", @@ -227,6 +244,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) { { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-01.png", + tint = gleba_tint, width = 209, height = 138, shift = {0.304688, -0.4}, @@ -234,6 +252,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-02.png", + tint = gleba_tint, width = 165, height = 129, shift = {0.0, 0.0390625}, @@ -241,6 +260,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-03.png", + tint = gleba_tint, width = 151, height = 139, shift = {0.151562, 0.0}, @@ -248,6 +268,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-04.png", + tint = gleba_tint, width = 216, height = 110, shift = {0.390625, 0.0}, @@ -255,6 +276,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-05.png", + tint = gleba_tint, width = 154, height = 147, shift = {0.328125, 0.0703125}, @@ -262,6 +284,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-06.png", + tint = gleba_tint, width = 154, height = 132, shift = {0.16875, -0.1}, @@ -269,6 +292,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-07.png", + tint = gleba_tint, width = 193, height = 130, shift = {0.3, -0.2}, @@ -276,6 +300,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-08.png", + tint = gleba_tint, width = 136, height = 117, shift = {0.0, 0.0}, @@ -283,6 +308,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-09.png", + tint = gleba_tint, width = 157, height = 115, shift = {0.1, 0.0}, @@ -290,6 +316,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-10.png", + tint = gleba_tint, width = 198, height = 153, shift = {0.325, -0.1}, @@ -297,6 +324,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-11.png", + tint = gleba_tint, width = 190, height = 115, shift = {0.453125, 0.0}, @@ -304,6 +332,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-12.png", + tint = gleba_tint, width = 229, height = 126, shift = {0.539062, -0.015625}, @@ -311,6 +340,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-13.png", + tint = gleba_tint, width = 151, height = 125, shift = {0.0703125, 0.179688}, @@ -318,6 +348,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-14.png", + tint = gleba_tint, width = 137, height = 117, shift = {0.160938, 0.0}, @@ -325,6 +356,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-15.png", + tint = gleba_tint, width = 201, height = 141, shift = {0.242188, -0.195312}, @@ -332,6 +364,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }, { filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-16.png", + tint = gleba_tint, width = 209, height = 154, shift = {0.351562, -0.1}, @@ -571,7 +604,7 @@ function util.se_matter(params) {"se-contaminated-scrap", 1}, {type=item, name=sedata, amount=1, probability=.99}, {type=item, name=sejunk, amount=1, probability=.01}, - {type="fluid", name="se-space-coolant-hot", amount=25, catalyst_amount=25}, + {type="fluid", name="se-space-coolant-hot", amount=25, ignored_by_stats=25, ignored_by_productivity=25}, } } }) @@ -608,7 +641,7 @@ function util.se_matter(params) results = { {type=item, name="se-kr-matter-liberation-data", amount=1, probability=.99}, {type=item, name=sejunk, amount=1, probability=.01}, - {type="fluid", name="se-particle-stream", amount=params.stream_out, catalyst_amount=50}, + {type="fluid", name="se-particle-stream", amount=params.stream_out, ignored_by_stats=50, ignored_by_productivity=50}, } } }) @@ -928,7 +961,12 @@ function add_product(recipe, product) if recipe ~= nil then if product.name and data.raw[product.type][product.name] then if recipe.results == nil then - recipe.results = {{recipe.result, recipe.result_count and recipe.result_count or 1}} + recipe.results = {} + end + for _, old in pairs(recipe.results) do + if old.name == product.name then + return + end end recipe.result = nil recipe.result_count = nil @@ -1182,8 +1220,11 @@ function multiply_recipe(recipe, multiple) result.amount_min = result.amount_min * multiple result.amount_max = result.amount_max * multiple end - if result.catalyst_amount then - result.catalyst_amount = result.catalyst_amount * multiple + if result.ignored_by_stats then + result.ignored_by_stats = result.ignored_by_stats * multiple + end + if result.ignored_by_productivity then + result.ignored_by_productivity = result.ignored_by_productivity * multiple end end end @@ -1478,6 +1519,12 @@ function util.set_to_founding(recipe, options) util.set_subgroup(recipe, "foundry-intermediate", options) end +function util.add_asteroid_to_planet(planet, spawn_def) + if data.raw.planet[planet] and data.raw[spawn_def.type][spawn_def.asteroid] then + table.insert(data.raw.planet[planet].asteroid_spawn_definitions, spawn_def) + end +end + -- Add crafting category to an entity function util.add_crafting_category(entity_type, entity, category) if data.raw[entity_type][entity] and data.raw["recipe-category"][category] then @@ -1658,12 +1705,17 @@ end function util.remove_prior_unlocks(tech, recipe) if data.raw.technology[tech].prerequisites then for i, prerequisite in pairs(data.raw.technology[tech].prerequisites) do - remove_prior_unlocks(prerequisite, recipe) + remove_prior_unlocks(prerequisite, recipe, {}) end end end -function remove_prior_unlocks(tech, recipe) +function remove_prior_unlocks(tech, recipe, processed) + if processed[tech] then + print("Already processed ".. tech .. " returning") + return + end + processed[tech] = true local technology = data.raw.technology[tech] if technology then log("Removing prior unlocks for ".. tech) @@ -1672,7 +1724,7 @@ function remove_prior_unlocks(tech, recipe) for i, prerequisite in pairs(technology.prerequisites) do if string.sub(prerequisite, 1, 3) ~= 'ei_' then -- log("BZZZ removing prior unlocks for " .. recipe .. " from " .. tech ..", checking " .. prerequisite) -- Handy Debug :| - remove_prior_unlocks(prerequisite, recipe) + remove_prior_unlocks(prerequisite, recipe, processed) end end end @@ -1696,12 +1748,17 @@ function util.replace_ingredients_prior_to(tech, old, new, multiplier) end if data.raw.technology[tech].prerequisites then for i, prerequisite in pairs(data.raw.technology[tech].prerequisites) do - replace_ingredients_prior_to(prerequisite, old, new, multiplier) + replace_ingredients_prior_to(prerequisite, old, new, multiplier, {}) end end end -function replace_ingredients_prior_to(tech, old, new, multiplier) +function replace_ingredients_prior_to(tech, old, new, multiplier, processed) + if processed[tech] then + print("Already processed ".. tech .. " returning") + return + end + processed[tech] = true log("Replacing for tech "..tech) local technology = data.raw.technology[tech] if technology then @@ -1717,7 +1774,7 @@ function replace_ingredients_prior_to(tech, old, new, multiplier) for i, prerequisite in pairs(technology.prerequisites) do -- log("BZZZ checking " .. prerequisite) -- Handy Debug :| if string.sub(prerequisite, 1, 3) ~= 'ei_' then - replace_ingredients_prior_to(prerequisite, old, new, multiplier) + replace_ingredients_prior_to(prerequisite, old, new, multiplier, processed) end end end diff --git a/info.json b/info.json index 2f57b56..ad78463 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bztitanium", - "version": "2.0.20", + "version": "2.0.22", "factorio_version": "2.0", "title": "Titanium", "author": "Brevven", diff --git a/titanium-ore.lua b/titanium-ore.lua index d341391..10a12d5 100644 --- a/titanium-ore.lua +++ b/titanium-ore.lua @@ -1,6 +1,6 @@ local resource_autoplace = require('resource-autoplace'); - local util = require("__bztitanium__.data-util"); +local item_sounds = require('__base__.prototypes.item_sounds') if mods["FactorioExtended-Plus-Core"] then util.remove_raw("item", "titanium-ore") @@ -73,6 +73,9 @@ data:extend({ name = "titanium-ore", icon_size = 64, icon_mipmaps = 3, icon = "__bztitanium__/graphics/icons/titanium-ore.png", + inventory_move_sound = item_sounds.resource_inventory_move, + pick_sound = item_sounds.resource_inventory_pickup, + drop_sound = item_sounds.resource_inventory_move, pictures = { {filename="__bztitanium__/graphics/icons/titanium-ore.png", size=64, scale=0.5}, {filename="__bztitanium__/graphics/icons/titanium-ore-2.png", size=64, scale=0.5}, diff --git a/titanium-recipe.lua b/titanium-recipe.lua index 2e071af..62b16f0 100644 --- a/titanium-recipe.lua +++ b/titanium-recipe.lua @@ -1,6 +1,7 @@ -- Titanium smelting local util = require("__bztitanium__.data-util"); +local item_sounds = require('__base__.prototypes.item_sounds') if mods["FactorioExtended-Plus-Core"] then util.remove_raw("recipe", "titanium-ore") @@ -52,6 +53,9 @@ data:extend({ order = "b[titanium-plate]", stack_size = util.get_stack_size(100), weight = 1*kg, + inventory_move_sound = item_sounds.metal_small_inventory_move, + pick_sound = item_sounds.metal_small_inventory_pickup, + drop_sound = item_sounds.metal_small_inventory_move, }, { type = "technology", @@ -163,8 +167,8 @@ data:extend({ name = "titanium-extraction", category = "organic-or-hand-crafting", icons = { - { icon = "__space-age__/graphics/icons/jellynut.png", icon_size = 64, scale = 0.5, shift = {-4, -6}}, - { icon = "__bztitanium__/graphics/icons/titanium-ore.png", icon_size = 64, scale = 0.5, icon_mipmaps = 3, shift = {4,6}}, + { icon = "__bztitanium__/graphics/icons/titanium-ore.png", icon_size = 64, scale = 0.5, icon_mipmaps = 3, shift = {6,8}}, + { icon = "__space-age__/graphics/icons/jellynut.png", icon_size = 64, scale = 0.5, shift = {-6, -8}}, }, surface_conditions = {