Page 2 of 2
Re: Entity Modification
Posted: Tue Mar 12, 2019 9:55 pm
by darkfrei
DiegoPro77 wrote: Tue Mar 12, 2019 9:14 pm
Could you help me please?
Code: Select all
local ores = {"iron", "copper", "uranium"}
local recipe_chain = {"ore", "dust", "enriched", "deoxidized", "particle", "smelted", "plate"}
local mod_name = '__My_Mod_Name_For_Ores_Enrichment__' -- you are need to change the mod name
local recipe_category = "enriching" -- nice name for enrichment
data:extend({
{
type = "recipe-category",
name = recipe_category
}
})
table.insert (data.raw["assembling-machine"].centrifuge.crafting_categories, recipe_category) -- for example in centrifuge
for i, ore_name in pairs (ores) do
for j = 2, #recipe_chain do
local name = ore_name .. "-" .. recipe_chain[j]
local ingredient_name = ore_name .. "-" .. recipe_chain[j-1]
data:extend({
{
type = "recipe",
category = recipe_category,
name = name,
enabled = "true",
energy_requied = 3,
ingredients =
{
{ingredient_name, 4}
},
results = {{name = name, type = "item", amount = 3}},
}
})
if not data.raw.item[name] then -- add item if you haven't it
data:extend({
{
type = "item",
name = name,
icon = mod_name.."/graphics/icons/"..name..".png", -- you are need to add icons here
icon_size = 32,
subgroup = "raw-resource",
order = "rc-"..i..'-'..j,
stack_size = 100
}
})
end
end
end
Just rename the
mod_name, add icons 32x32 to the folder.
Re: Entity Modification
Posted: Wed Mar 13, 2019 2:39 pm
by DiegoPro77
Perfect, now it works with dusts.
This type of coding will be very useful for me, as i need a method for fast create recipes and, who knows, compatibilities too, as i'll use it in many other processes too.
Here's the result, for now i've omitted the data.raw.item part as i've already created them:
Code: Select all
mod_name = "__Dp77s-RealFactory-Core__"
local ores = {"iron", "copper", "olivine", "chalcopyrite"}
local recipe_chain = {"ore", "dust"}
local recipe_category = "steam_spalling"
--Thanks to Darkfrei and Bob for this piece of code--
for i, ore_name in pairs (ores) do
for j = 2, #recipe_chain do
local name = ore_name .. "-" .. recipe_chain[j]
local ingredient_name = ore_name .. "-" .. recipe_chain[j-1]
data:extend({
{
type = "recipe",
icon = mod_name.."/graphics/icons/"..name..".png",
icon_size = 32,
category = recipe_category,
subgroup = "steam_spalling",
name = name,
enabled = "true",
energy_requied = 7,
ingredients =
{
{ingredient_name, 3}
},
results =
{
{ name = name, type = "item", amount = 3 },
{ name = "crushed-stone", type = "item", amount = 5 },
},
}
})
end
end
Thank you Darkfrei, you and bob will be mentioned in the description of the modpack for your support.
_DiegoPro77
Re: Entity Modification
Posted: Fri Mar 29, 2019 7:02 pm
by DiegoPro77
Another thing on entities,
is there a method for creating machines that don't need power for work - and not burner-like?
_DiegoPro77
Re: Entity Modification
Posted: Fri Mar 29, 2019 7:35 pm
by Bilka
Use the void energy source type.
Re: Entity Modification
Posted: Fri Mar 29, 2019 8:42 pm
by darkfrei
DiegoPro77 wrote: Fri Mar 29, 2019 7:02 pm
Another thing on entities,
is there a method for creating machines that don't need power for work - and not burner-like?
_DiegoPro77
Here's the mod for it
https://mods.factorio.com/mod/NoEnergyRequired
Re: Entity Modification
Posted: Sun Mar 31, 2019 6:21 pm
by DiegoPro77
Thank you bilka, I didn't notice this feature.
_DiegoPro77