diff --git a/PHI-CL/control.lua b/PHI-CL/control.lua index 178b105..273437d 100644 --- a/PHI-CL/control.lua +++ b/PHI-CL/control.lua @@ -1,5 +1,6 @@ local cargo_landing = require('control/cargo-landing') local chest = require('control/chest') +local infinity_container = require('control/infinity-infinity_containercontainer') local inserter = require('control/inserter') local pump = require('control/pump') local rail_support = require('control/rail-support') @@ -8,6 +9,7 @@ local trash = require('control/trash') local function entity_build(event) cargo_landing.build(event) chest.build(event) + infinity_container.build(event) rail_support.build(event) trash.build(event) end diff --git a/PHI-CL/control/infinity-container.lua b/PHI-CL/control/infinity-container.lua new file mode 100644 index 0000000..8957a3f --- /dev/null +++ b/PHI-CL/control/infinity-container.lua @@ -0,0 +1,33 @@ +local main = {} + +local chest_filter = {} + +do + for _, q in pairs(prototypes.quality) do + local q_name = q.name + local j = 0 + chest_filter[q_name] = {} + + for _, i in pairs(prototypes.item) do + if not i.hidden and not (i.subgroup and i.subgroup == 'parameters') then + j = j + 1 + table.insert(chest_filter[q_name], {index = j, name = i.name, quality = q_name, mode = 'exactly', count = i.stack_size}) + end + end + end +end + +function main.build(event) + if event.entity.type ~= 'infinity-container' then + return + end + + if event.entity.name ~= 'super-infinity-chest' then + return + end + + event.entity.remove_unfiltered_items = true + event.entity.infinity_container_filters = chest_filter[event.entity.quality.name] +end + +return main diff --git a/PHI-CL/data/b/ct.lua b/PHI-CL/data/b/ct.lua index 40de711..3614b50 100644 --- a/PHI-CL/data/b/ct.lua +++ b/PHI-CL/data/b/ct.lua @@ -133,6 +133,41 @@ if data.raw['electric-energy-interface'] and data.raw['electric-energy-interface end end +-- CT A 1 BASE ENTITY,ITEM,RECIPE +if data.raw['infinity-container'] and data.raw['infinity-container']['infinity-chest'] then + local item = table.deepcopy(data.raw['item']['infinity-chest']) + item.name = 'super-infinity-chest' + item.place_result = item.name + item.icons = {{icon = item.icon or '__base__/graphics/icons/infinity-chest.png', tint = mod_tint[8], icon_size = item.icon_size or 64, icon_mipmaps = item.icon_mipmaps or 4}} + item.icon = nil + item.icon_size = nil + item.icon_mipmaps = nil + item.localised_name = {'', {'name.super-entity'}, {'entity-name.infinity-chest'}} + data:extend({item}) + + local entity = table.deepcopy(data.raw['infinity-container']['infinity-chest']) + entity.name = item.name + entity.minable.result = item.name + entity.gui_mode = 'none' + entity.pictures.layers[1].tint = mod_tint[8] + entity.localised_name = {'', {'name.super-entity'}, {'entity-name.infinity-chest'}} + data:extend({entity}) + + data:extend({{ + type = 'recipe', + name = item.name, + energy_required = 2, + enabled = true, + categories = {'crafting'}, + hidden = true, + hidden_in_factoriopedia = true, + ingredients = {{type = 'item', name = 'steel-chest', amount = 1}}, + results = {{type = 'item', name = item.name, amount = 1}}, + main_product = item.name, + localised_name = {'', {'name.super-entity'}, {'entity-name.infinity-chest'}} + }}) +end + -- CT A 1 BASE MAP_GEN_PRESET if settings.startup['PHI-CT-TILE'].value then data.raw['map-gen-presets']['default']['empty-world'] = {