Adding a new Inventory tab

Place to get help with not working mods / modding interface.
DopplerEffect
Burner Inserter
Burner Inserter
Posts: 5
Joined: Tue Jan 13, 2015 9:44 pm
Contact:

Adding a new Inventory tab

Post by DopplerEffect »

Hi, I hope that someone can give me some advice because I've stared at this for a few hours and I'm not really sure what I'm missing. I would like to add a new tab to the inventory. After reading the documentation and looking at a few other mods it seems to me that all I should need to do is create a mod with a structure like this:

Code: Select all

MyMod_0.0.1
  |- info.json
  |- data.lua
  |- control.lua
  |- prototypes
        | - item-groups.lua
With the contents as follows:
info.json

Code: Select all

{ 
  "name":"MyMod",
  "title":"asdf",
  "version":"0.0.1"
  "homepage":"asdf",
  "author":"DopplerEffect",
  "contact":"example@gmail.com",
  "description":"MyMod description",
  "dependencies":["base >= 0.11.8"],
}
data.lua

Code: Select all

require("prototypes.item-groups")
control.lua is blank

item-groups.lua

Code: Select all

data:extend(
{
  {
    type = "item-group",
    name = "test-group",
    icon = "__base__/graphics/technology/automation.png",
    inventory_order = "f",
    order = "e"
  },
  {
    type = "item-subgroup",
    name = "test-subgroup",
    group = "test-group",
    order = "a"
  }
})
Did I set it up incorrectly? Does an item for that tab have to exist before it would show up in the inventory? Or did I just completely miss something and you can't add new inventory tabs
FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: Adding a new Inventory tab

Post by FishSandwich »

Do you have a recipe to put there? I'm not entirely sure but it makes sense to me that item groups don't show up if there's no recipe there.
DopplerEffect
Burner Inserter
Burner Inserter
Posts: 5
Joined: Tue Jan 13, 2015 9:44 pm
Contact:

Re: Adding a new Inventory tab

Post by DopplerEffect »

okay, I've added an item, recipe and entity definition and associated it with test-subgroup. Now the structure is like this

Code: Select all

MyMod_0.0.1
  |- info.json
  |- data.lua
  |- control.lua
  |- prototypes
        | - entity.lua
        | - item-groups.lua
        | - items.lua
        | - recipe.lua
Entity.lua

Code: Select all

data:extend
(
    {    
        {
            type = "assembling-machine",
            name = "electric-boiler",
            icon = "__TestMod__/graphics/icons/electric-boiler.png",
            flags = {"placeable-neutral", "player-creation"},
            minable = {hardness = 0.2, mining_time = 0.5, result = "electric-boiler"},
            max_health = 100,
            corpse = "small-remnants",
            resistances =
            {
                {
                    type = "fire",
                    percent = 80
                }
            },
            collision_box = {{-0.29, -0.29}, {0.29, 0.29}},
            selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
            fast_replaceable_group = "pipe",
            animation =
            {
                filename = "__TestMod__/graphics/entity/boiler/electric-boiler.png",
                priority="high",
                width = 44,
                height = 50,
                frame_count = 1,
                line_length = 1,
            },
            crafting_categories = {"crafting"},
            crafting_speed = 6,
            energy_source =
            {
                type = "electric",
                usage_priority = "secondary-input",
            },
            energy_usage = "700kW",
            ingredient_count = 1,
            fluid_boxes =
            {
                {
                    base_area = 1,
                    pipe_covers = pipecoverspictures(),
                    pipe_connections =
                    {
                        { position = {0, -1} },
                        { position = {0, 1} },
                        { position = {-1, 0} },
                        { position = {1, 0} },
                    },
                }
            }
        }
    }
)
items.lua

Code: Select all

data:extend
(
  {
      {
        type = "item",
        name = "electric-boiler",
        icon = "__TestMod__/graphics/icons/electric-boiler.png",
        flags = {"goes-to-quickbar"},
        subgroup = "test-subgroup",
        order = "a[boiler]-b[electric-boiler]",
        place_result = "electric-boiler",
        stack_size = 50
      }
  }
)
and recipe.lua

Code: Select all

data:extend({
  {
    type = "recipe",
    name = "electric-boiler",
    enabled = "false",
    ingredients = 
    {
        {"steel-plate", 6},
        {"advanced-circuit", 4},
        {"stone-brick", 4}
    },
    result = "electric-boiler"
  }
})
and modifying data.lua to require all the listed files. The item was basically copied from another mod (https://github.com/Kioshi/Factorio-Alphamod) and I still get nothing
FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: Adding a new Inventory tab

Post by FishSandwich »

Hm, try in the recipe.lua, change enabled = "true".

enabled = "false" means it would need to be researched before it will show in the crafting menu.

Sorry I can't help more, I'm not at my computer right now to test it.
DopplerEffect
Burner Inserter
Burner Inserter
Posts: 5
Joined: Tue Jan 13, 2015 9:44 pm
Contact:

Re: Adding a new Inventory tab

Post by DopplerEffect »

That was it, thanks a lot :)
FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: Adding a new Inventory tab

Post by FishSandwich »

Great :) No problem.
Post Reply

Return to “Modding help”