Crafting Categories
Posted: Mon Jan 19, 2026 12:07 am
I'm new to modding and just messing around a bit. I've followed the basic tutorial creating the fire armor and looked at some existing mods - but i can't figure out crafting categories. I can change the crafting category of the item so that it is craftable in different machines but making a new category has stumped me. Here is my current code;
Thanks for any guidance
Code: Select all
--data.lua
local function sprite(name)
return '__chem-craft__/graphics/'..name
end
--Create a new recipe category called chemistry-vials
data:extend(
{
{
type = "recipe-category",
name = "chemistry-vials"
},
}
)
--Add the recipe category to the chemical plant, so that it can now craft this new category.
--i assume this is where i've gone wrong
table.insert(data.raw["assembling-machine"]["chemical-plant"].crafting_categories, "chemistry-vials")
--create the item using iron-plate as a template
local Resource_Oxygen = table.deepcopy(data.raw["item"]["iron-plate"])
Resource_Oxygen.name = "oxygen-vial"
Resource_Oxygen.icons = {
{
icon = sprite('Oxygen.png'),
icon_size = 64,
--tint = {r=1,g=0,b=0,a=0.3}
},
}
Resource_Oxygen.stack_size = 100
-- create a recipe for the item
local OxygenRecipe = {
type = "recipe",
name = "oxygen-vial",
category = "chemistry-vials",
enabled = true,
energy_required = 1,
ingredients = {
{type = "item", name = "copper-plate", amount = 200},
{type = "item", name = "steel-plate", amount = 50}
},
results = {{type = "item", name = "oxygen-vial", amount = 1}}
}
data:extend{Resource_Oxygen, OxygenRecipe}