New smelting entities - advice on approach

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Trblz
Long Handed Inserter
Long Handed Inserter
Posts: 63
Joined: Thu Sep 21, 2017 1:23 am
Contact:

New smelting entities - advice on approach

Post 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?
My Mod list: Necormant co-author

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: New smelting entities - advice on approach

Post 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"
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
Trblz
Long Handed Inserter
Long Handed Inserter
Posts: 63
Joined: Thu Sep 21, 2017 1:23 am
Contact:

Re: New smelting entities - advice on approach

Post 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.
My Mod list: Necormant co-author

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: New smelting entities - advice on approach

Post 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.

User avatar
Trblz
Long Handed Inserter
Long Handed Inserter
Posts: 63
Joined: Thu Sep 21, 2017 1:23 am
Contact:

Re: New smelting entities - advice on approach

Post 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
My Mod list: Necormant co-author

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: New smelting entities - advice on approach

Post 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})

User avatar
Trblz
Long Handed Inserter
Long Handed Inserter
Posts: 63
Joined: Thu Sep 21, 2017 1:23 am
Contact:

Re: New smelting entities - advice on approach

Post 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?
My Mod list: Necormant co-author

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: New smelting entities - advice on approach

Post 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

Post Reply

Return to “Modding help”