Page 1 of 1

New smelting entities - advice on approach

Posted: Sun Feb 23, 2020 6:00 pm
by Trblz
I want to make a copy of the vanilla smelters to tweak some settings (extreme pollution).

What is the best way to do this? Do a deep copy of data.raw and then update some values (like pollution rate, graphics and research)?
How do I assign a modded item only to work for the new entities and not the vanilla ones?

Re: New smelting entities - advice on approach

Posted: Sun Feb 23, 2020 6:09 pm
by eradicator
Yes deepcopy.

Recipe: change name and result
Item: change name and place_result
Entity: change name and minable.result

Best practice is to add a prefix to the name to avoid incompabilities with other mods. I.e. "trblz-dirty-furnace"

Re: New smelting entities - advice on approach

Posted: Sun Feb 23, 2020 6:51 pm
by Trblz
eradicator wrote:
Sun Feb 23, 2020 6:09 pm
Yes deepcopy.

Recipe: change name and result
Item: change name and place_result
Entity: change name and minable.result

Best practice is to add a prefix to the name to avoid incompabilities with other mods. I.e. "trblz-dirty-furnace"
What does item.place_result do? Wiki mentions "Name of prototype/Entity that can be built using this item" so I read this as the list of outputs that this item can generate.

I will give this a try. The mod already has a prefix for everything.

Re: New smelting entities - advice on approach

Posted: Mon Feb 24, 2020 11:37 am
by darkfrei
Trblz wrote:
Sun Feb 23, 2020 6:51 pm
What does item.place_result do? Wiki mentions "Name of prototype/Entity that can be built using this item" so I read this as the list of outputs that this item can generate.

I will give this a try. The mod already has a prefix for everything.
Recipe, item and entity can have different names.

Code: Select all

item.name = "custom-furnace" -- item name
item.place_result = "nice-furnace" -- entity name

entity.name = "nice-furnace" -- entity name
entity.minable.result = "custom-furnace" -- item name

recipe.name = "custom-recipe-for-nice-custom-furnace" -- recipe name
recipe.result = "custom-furnace" -- item name
And by the technology must be the recipe name.

Re: New smelting entities - advice on approach

Posted: Mon Feb 24, 2020 7:47 pm
by Trblz
I have made the new entities using the deep copy step.
Next is to figure out the data.raw change to redirect a vanilla ore from vanilla burner to my custom burner

Re: New smelting entities - advice on approach

Posted: Mon Feb 24, 2020 8:55 pm
by darkfrei
Trblz wrote:
Mon Feb 24, 2020 7:47 pm
I have made the new entities using the deep copy step.
Next is to figure out the data.raw change to redirect a vanilla ore from vanilla burner to my custom burner
Don't forget to add your new prototypes to the data.raw:

Code: Select all

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

Re: New smelting entities - advice on approach

Posted: Tue Feb 25, 2020 3:15 am
by Trblz
I am missing something that should be right in front of me :roll:

I define the new entity, recipe and technology for "cdmo-stone-furnace":

Code: Select all

--define new entity
local fn1 = table.deepcopy(data.raw["furnace"]["stone-furnace"]) 
fn1.name = "cdmo-stone-furnace"
fn1.icon = "__cdmo__/graphics/icons/stone-furnace.png" 
fn1.icon_size = 32
fn1.icon_mipmaps = nil 
fn1.minable.result = fn1.name  
fn1.next_upgrade = "cdmo-steel-furnace"
fn1.animation.layers[1].filename = "__cdmo__/graphics/entity/stone-furnace/stone-furnace.png"
fn1.animation.layers[1].hr_version.filename = "__cdmo__/graphics/entity/stone-furnace/hr-stone-furnace.png"
data.extend({fn1})

--define recipe
data:extend({
        {
            type = "recipe",
            name = "cdmo-stone-furnace",
            enabled = false,
            energy_required = 5,
            ingredients = { {"stone-furnace", 1},{"steel-plate", 10}},
            result = "cdmo-stone-furnace"
        }
 })
 -- define technology
 data:extend({
        {
            type = "technology",
            name = "cdmo-stone-furnace",
            icon_size = 32,
            icon = "__base__/graphics/technology/oil-processing.png",
            prerequisites = {"advanced-oil-processing"},
            effects = {                
                {
                    type = "unlock-recipe",
                    recipe = "cdmo-stone-furnace"
                },
            },
            unit = {
                count = 1,
                ingredients = {{"automation-science-pack", 1},{"production-science-pack", 1}
                },
                time = 30
            },
            order = "d-c"
        },
})
if i do it like this, how do i force that iron-ore can be smelted in "cdmo-stone-furnace" and not anymore vanilla.stone-furnace?

Re: New smelting entities - advice on approach

Posted: Tue Feb 25, 2020 6:46 am
by darkfrei
Set up the new recipe category, change it by smelting recipe and set it by your furnace.

https://wiki.factorio.com/Prototype/RecipeCategory
https://wiki.factorio.com/Data.raw#recipe-category