Add setting for spoiling of science packs

This commit is contained in:
Simon Brodtmann 2025-08-29 22:26:22 +02:00
parent 8cb2417f6d
commit a146b68220
4 changed files with 61 additions and 2 deletions

View file

@ -2,6 +2,8 @@ local item_tints = require("__base__.prototypes.item-tints")
local item_sounds = require("__base__.prototypes.item_sounds")
local Technology = require("__cf-lib__/data/Technology")
local spoil = settings.startup["lignumis-sciences-spoil"].value
data:extend({
{
type = "tool",
@ -21,7 +23,9 @@ data:extend({
factoriopedia_durability_description_key = "description.factoriopedia-science-pack-remaining-amount-key",
durability_description_value = "description.science-pack-remaining-amount-value",
random_tint_color = item_tints.iron_rust,
default_import_location = "lignumis"
default_import_location = "lignumis",
spoil_result = spoil and "steam-science-pack-spoiled" or nil,
spoil_ticks = spoil and 3600 * 5 or nil
},
{
type = "recipe",
@ -78,4 +82,42 @@ data:extend({
}
})
if spoil then
data:extend({
{
type = "item",
name = "steam-science-pack-spoiled",
icon = Lignumis.graphics .. "icons/steam-science-pack-spoiled.png",
subgroup = "science-pack",
color_hint = { text = "A" },
order = "2[steam-science-pack]",
inventory_move_sound = item_sounds.science_inventory_move,
pick_sound = item_sounds.science_inventory_pickup,
drop_sound = item_sounds.science_inventory_move,
stack_size = 200,
weight = 1 * kg,
random_tint_color = item_tints.iron_rust,
default_import_location = "lignumis"
},
{
type = "recipe",
name = "refresh-steam-science-pack",
category = "smelting",
enabled = false,
energy_required = 10,
ingredients = {
{ type = "item", name = "steam-science-pack-spoiled", amount = 1 }
},
results = { { type = "item", name = "steam-science-pack", amount = 1 } },
crafting_machine_tint = {
primary = { r = 0.65, g = 0.27, b = 0.18, a = 1.000 },
secondary = { r = 0.65, g = 0.27, b = 0.18, a = 1.000 },
},
allow_productivity = false
}
})
Technology:new("steam-science-pack"):addRecipe("refresh-steam-science-pack")
end
Technology:new("automation-2"):addRecipe("steam-science-pack-steam")

View file

@ -1,6 +1,8 @@
local item_tints = require("__base__.prototypes.item-tints")
local item_sounds = require("__base__.prototypes.item_sounds")
local spoil = settings.startup["lignumis-sciences-spoil"].value
data:extend({
{
type = "tool",
@ -20,7 +22,9 @@ data:extend({
factoriopedia_durability_description_key = "description.factoriopedia-science-pack-remaining-amount-key",
durability_description_value = "description.science-pack-remaining-amount-value",
random_tint_color = item_tints.iron_rust,
default_import_location = "lignumis"
default_import_location = "lignumis",
spoil_result = spoil and "spoilage" or nil,
spoil_ticks = spoil and 3600 * 60 or nil
},
{
type = "recipe",