productivity, and other fixes

This commit is contained in:
Brevven 2025-03-02 19:44:30 -08:00
parent 4dfb899ecd
commit f3c368adb1
4 changed files with 46 additions and 18 deletions

View file

@ -1,4 +1,10 @@
---------------------------------------------------------------------------------------------------
Version: 2.1.8
Date: 2025-03-03
Changes:
- Allow productivity on several recipes
- Other minor tweaks and fixes
---------------------------------------------------------------------------------------------------
Version: 2.1.7
Date: 2025-02-22
Fixes:

View file

@ -571,7 +571,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 +608,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},
}
}
})
@ -1187,8 +1187,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
@ -1483,6 +1486,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
@ -1663,12 +1672,16 @@ 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, 0)
end
end
end
function remove_prior_unlocks(tech, recipe)
function remove_prior_unlocks(tech, recipe, depth)
if depth > 10000 then
log("Infinite recursion detected, backing out.")
return
end
local technology = data.raw.technology[tech]
if technology then
log("Removing prior unlocks for ".. tech)
@ -1677,7 +1690,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, depth+1)
end
end
end
@ -1701,12 +1714,16 @@ 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, 0)
end
end
end
function replace_ingredients_prior_to(tech, old, new, multiplier)
function replace_ingredients_prior_to(tech, old, new, multiplier, depth)
if depth > 10000 then
log("Infinite recursion detected, backing out.")
return
end
log("Replacing for tech "..tech)
local technology = data.raw.technology[tech]
if technology then
@ -1722,7 +1739,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, depth + 1)
end
end
end

View file

@ -1,6 +1,6 @@
{
"name": "bztin",
"version": "2.1.7",
"version": "2.1.8",
"factorio_version": "2.0",
"title": "Tin",
"author": "Brevven",

View file

@ -28,13 +28,14 @@ data:extend({
-- {type="item", name = "tin-plate", amount=5}
-- }
-- } or
main_product = "tin-plate",
enabled = true,
energy_required = 2.4,
ingredients = {util.item("tin-ore", 1)},
results = {
{type="item", name = "tin-plate", amount=1}
},
main_product = "tin-plate",
enabled = true,
energy_required = 2.4,
ingredients = {util.item("tin-ore", 1)},
results = {
{type="item", name = "tin-plate", amount=1}
},
allow_productivity = true,
-- expensive =
-- {
-- main_product = "tin-plate",
@ -84,6 +85,7 @@ data:extend({
energy_required = 1,
ingredients = solder_ingredients,
results = {util.item("solder", 4)},
allow_productivity = true,
}
})
@ -187,6 +189,7 @@ data:extend({
energy_required = 5,
ingredients = {util.item("tin-plate", 3), {type="fluid", name="petroleum-gas", amount=20}},
results = {{type="fluid", name="organotins", amount=50}},
allow_productivity = true,
crafting_machine_tint = {
primary = {r = 1.000, g = 0.995, b = 0.089, a = 1.000},
secondary = {r = 1.000, g = 0.975, b = 0.890, a = 1.000},
@ -233,6 +236,7 @@ data:extend({
enabled = false,
energy_required = 1.5,
ingredients = {util.item("tin-plate", 1), util.item("copper-cable", 8)},
allow_productivity = true,
results = {util.item("tinned-cable", 8)},
},
{
@ -279,6 +283,7 @@ data:extend({
energy_required = 60,
ingredients = {},
results = {util.item("bronze-plate", 20)},
allow_productivity = true,
},
})
for item, count in pairs(bronze_i) do