Magic Quality Chest

by Dreaden

This mod adds a chest that upgrades the contents to the selected quality.

Tweaks
1 year, 11 months ago
2.0
632
Cheats

g 2.1 Ready

a month ago

Corrected script, compatible with version 2.1. Simply replace the contents of the magic-quality-chest.lua script located within the prototypes folder in the archive with this version.

--[[
Create a clone of the logistic buffer-chest that we can periodically service.
]]
local constants = require "src.constants"

local name = constants.CHEST_NAME
local source_item_name = "buffer-chest"
local source_prototype = "logistic-container"

local entity = table.deepcopy(data.raw[source_prototype][source_item_name])
entity.name = name

-- Korrektur für Factorio 2.0: Zugriff über das neue graphics_set
if entity.graphics_set and entity.graphics_set.animation and entity.graphics_set.animation.layers then
entity.graphics_set.animation.layers[1].filename = constants.path_graphics("entity/magic-quality-chest.png")
elseif entity.animation and entity.animation.layers then
-- Fallback für ältere Factorio-Versionen (falls benötigt)
entity.animation.layers[1].filename = constants.path_graphics("entity/magic-quality-chest.png")
end

entity.minable.result = name
entity.se_allow_in_space = true
entity.render_not_in_network_icon = false
entity.use_exact_mode = true

local item = table.deepcopy(data.raw["item"][source_item_name])
item.name = name
item.place_result = name
item.icon = constants.path_graphics("icons/magic-quality-chest.png")
item.order = string.format("a[items]-b[%s]", constants.CHEST_NAME)
item.weight = 20000

local recipe = {
name = name,
type = "recipe",
enabled = true,
ingredients = {
--{ name="iron-chest", amount=1, type="item" }
},
results = {
{ amount=1, name=name, type = "item" }
}
}

data:extend({ entity, item, recipe })

New response