steam output power not work

Place to get help with not working mods / modding interface.
aliakbartnt
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu May 16, 2024 6:45 pm
Contact:

steam output power not work

Post by aliakbartnt »

hi guys i am noob with moding and i want just simple mod for upgrade steam engine

my custom item work but output power not change and its vanilla

my item.lua:

Code: Select all

--item.lua

local steam_engine = table.deepcopy(data.raw.item["steam-engine"])
 
	
	steam_engine.name = "steam engine 2"
	
	steam_engine.icon = "__base__/graphics/icons/steam-engine.png"
	steam_engine.stack_size = 100
	steam_engine.icon_size = 64
	steam_engine.effectivity = 1
	
	steam_engine.max_power_output = "2KW"
	steam_engine.maximum_temperature = 500
	steam_engine.fluid_usage_per_tick = 32
	

 
data:extend({
	steam_engine
})
my recipe.lua :

Code: Select all

--recipe.lua

local steamrecipe = table.deepcopy(data.raw.recipe["steam-engine"])
	steamrecipe.name = "steam-engine-2"
	steamrecipe.enabled = true
	
	steamrecipe.ingredients = {{"steam-engin", 1}, {"iron-plate", 3}}
		
	
	steamrecipe.results = {{name = "steam-engine-2", amount = 1}}
	-- energy_required = 1
	steamrecipe.category = "crafting-with-fluid"
	steamrecipe.group = "production"
	steamrecipe.subgroup = "energy"
	steamrecipe.order = "a"
	steamrecipe.max_power_output = "2KW"
	steamrecipe.maximum_temperature = 500
	steamrecipe.fluid_usage_per_tick = 32


data:extend({
	steamrecipe
})

local steamregen = table.deepcopy(data.raw.generator["steam-engine"])
	steamregen.name = "steam-engine-2"
	steamregen.enabled = true
	
	steamregen.ingredients = {{"steam-engin", 1}, {"iron-plate", 3}}
		
	
	steamregen.results = {{name = "steam-engine-2", amount = 1}}
	-- energy_required = 1
	steamregen.category = "crafting-with-fluid"
	steamregen.group = "production"
	steamregen.subgroup = "energy"
	steamregen.order = "a"
	steamregen.max_power_output = "2KW"
	steamregen.maximum_temperature = 500
	steamregen.fluid_usage_per_tick = 32
data:extend({
	steamregen
})


why my outpute power not change ? i change max temp but its not work and show a vanilla value pls help me
my custom item but output power not change and its vanilla
my custom item but output power not change and its vanilla
Screenshot (590).png (3.94 MiB) Viewed 980 times
robot256
Filter Inserter
Filter Inserter
Posts: 995
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: steam output power not work

Post by robot256 »

Items are only the things held in inventory. Right now your new item places the same old engine entity. You need to make a new Entity and change the placement links for it to be different when you place it.
aliakbartnt
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu May 16, 2024 6:45 pm
Contact:

Re: steam output power not work

Post by aliakbartnt »

robot256 wrote: Thu May 16, 2024 9:48 pm Items are only the things held in inventory. Right now your new item places the same old engine entity. You need to make a new Entity and change the placement links for it to be different when you place it.
how i can do it ?
robot256
Filter Inserter
Filter Inserter
Posts: 995
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: steam output power not work

Post by robot256 »

The entity for the steam engine is stored in `data.raw.generator["steam-engine"]` and the prototype parameters for the generator entity can be found in the documentation at https://lua-api.factorio.com/latest/pro ... otype.html

Do another copy.deepcopy of the entity entry, rename it, and change the max power output parameter. You'll also have to change the mining result and the "placed by" parameters to your new item.
aliakbartnt
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu May 16, 2024 6:45 pm
Contact:

Re: steam output power not work

Post by aliakbartnt »

robot256 wrote: Sat May 18, 2024 4:27 pm The entity for the steam engine is stored in `data.raw.generator["steam-engine"]` and the prototype parameters for the generator entity can be found in the documentation at https://lua-api.factorio.com/latest/pro ... otype.html

Do another copy.deepcopy of the entity entry, rename it, and change the max power output parameter. You'll also have to change the mining result and the "placed by" parameters to your new item.
your mean this ? :

local steamrecipe = table.deepcopy(data.raw.entity["steam-engine"])
steamrecipe.name = "steam-engine-2"
steamrecipe.enabled = true

steamrecipe.ingredients = {{"steam-engine", 1}, {"iron-plate", 3}}


minable = { mining_time = 1, result = "steam-engine-2" },
steamrecipe.max_power_output = "2KW"
steamrecipe.maximum_temperature = 500
steamrecipe.fluid_usage_per_tick = 32
robot256
Filter Inserter
Filter Inserter
Posts: 995
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: steam output power not work

Post by robot256 »

1. You still need all the code you already had, which was correct. steamrecipe should stay the same, and you add a new section for e.g. steamentity

2. What I wrote was correct. Items are stored in data.raw.item, but entities are stored in many different categories, like data.raw.armor and data.raw["transport-belt"]. You have to use the right category name to get the prototype you want. In the prototype list page, it shows in quotes the key inside data.raw for each type of entity. Steam engine is in the 'generator' category.
aliakbartnt
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu May 16, 2024 6:45 pm
Contact:

Re: steam output power not work

Post by aliakbartnt »

robot256 wrote: Sat May 18, 2024 5:50 pm 1. You still need all the code you already had, which was correct. steamrecipe should stay the same, and you add a new section for e.g. steamentity

2. What I wrote was correct. Items are stored in data.raw.item, but entities are stored in many different categories, like data.raw.armor and data.raw["transport-belt"]. You have to use the right category name to get the prototype you want. In the prototype list page, it shows in quotes the key inside data.raw for each type of entity. Steam engine is in the 'generator' category.
near this ?
local steamregen = table.deepcopy(data.raw.generator["steam-engine"])
steamregen.name = "steam-engine-2"
steamregen.enabled = true

steamregen.ingredients = {{"steam-engin", 1}, {"iron-plate", 3}}


steamregen.results = {{name = "steam-engine-2", amount = 1}}
-- energy_required = 1
steamregen.category = "crafting-with-fluid"
steamregen.group = "production"
steamregen.subgroup = "energy"
steamregen.order = "a"
steamregen.max_power_output = "2KW"
steamregen.maximum_temperature = 500
steamregen.fluid_usage_per_tick = 32
data:extend({
steamregen
})

if yes i am using this code i my recipe.lua and its not work
aliakbartnt
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu May 16, 2024 6:45 pm
Contact:

Re: steam output power not work

Post by aliakbartnt »

aliakbartnt wrote: Sat May 18, 2024 5:54 pm
robot256 wrote: Sat May 18, 2024 5:50 pm 1. You still need all the code you already had, which was correct. steamrecipe should stay the same, and you add a new section for e.g. steamentity

2. What I wrote was correct. Items are stored in data.raw.item, but entities are stored in many different categories, like data.raw.armor and data.raw["transport-belt"]. You have to use the right category name to get the prototype you want. In the prototype list page, it shows in quotes the key inside data.raw for each type of entity. Steam engine is in the 'generator' category.
near this ?
local steamregen = table.deepcopy(data.raw.generator["steam-engine"])
steamregen.name = "steam-engine-2"
steamregen.enabled = true

steamregen.ingredients = {{"steam-engin", 1}, {"iron-plate", 3}}


steamregen.results = {{name = "steam-engine-2", amount = 1}}
-- energy_required = 1
steamregen.category = "crafting-with-fluid"
steamregen.group = "production"
steamregen.subgroup = "energy"
steamregen.order = "a"
steamregen.max_power_output = "2KW"
steamregen.maximum_temperature = 500
steamregen.fluid_usage_per_tick = 32
data:extend({
steamregen
})

if yes i am using this code i my recipe.lua and its not work
i think i know wahts your mean . your mean this ? :

local steament = data.raw.generator["steam-engine-2"]
steament.name = "steam-engine-2"
steament.max_power_output = "2KW"
steament.maximum_temperature = 500




data:extend({
steament
})
robot256
Filter Inserter
Filter Inserter
Posts: 995
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: steam output power not work

Post by robot256 »

Yeah, the second one. That should get you close enough to start seeing results in the game!
aliakbartnt
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu May 16, 2024 6:45 pm
Contact:

Re: steam output power not work

Post by aliakbartnt »

robot256 wrote: Sat May 18, 2024 7:00 pm Yeah, the second one. That should get you close enough to start seeing results in the game!
its not work bro i try it this code :

Code: Select all

--recipe.lua

local steamrecipe = table.deepcopy(data.raw.recipe["steam-engine"])
	steamrecipe.name = "steam-engine-2"
	steamrecipe.enabled = true
	
	steamrecipe.ingredients = {{"steam-engine", 1}, {"iron-plate", 3}}
		
	
	steamrecipe.results = {{name = "steam-engines-2", amount = 1}}
	-- energy_required = 1
	steamrecipe.category = "crafting-with-fluid"
	steamrecipe.group = "production"
	steamrecipe.subgroup = "energy"
	steamrecipe.order = "a"
	steamrecipe.max_power_output = "2KW"
	steamrecipe.maximum_temperature = 500
	steamrecipe.fluid_usage_per_tick = 32


data:extend({
	steamrecipe
})

local steamregen = table.deepcopy(data.raw.generator["steam-engine"])
	steamregen.name = "steam-engine-2"
	steamregen.enabled = true
	
	steamregen.ingredients = {{"steam-engin", 1}, {"iron-plate", 3}}
		
	
	steamregen.results = {{name = "steam-engine-2", amount = 1}}
	-- energy_required = 1
	steamregen.category = "crafting-with-fluid"
	steamregen.group = "production"
	steamregen.subgroup = "energy"
	steamregen.order = "a"
	steamregen.max_power_output = "2KW"
	steamregen.maximum_temperature = 500
	steamregen.fluid_usage_per_tick = 32
data:extend({
	steamregen
})
local steament = data.raw.generator["steam-engine-2"]
	steament.name = "steam-engine-2"
	steament.max_power_output = "2KW"
	steament.maximum_temperature = 500
	
	steament.ingredients = {{"steam-engin", 1}, {"iron-plate", 3}}
	steament.minable = {mining_time = 2, result = "steam-engine-2"}	
	
	steament.results = {{name = "steam-engine-2", amount = 1}}
    
	
data:extend({
	steament
})
please say me whats problem ?
robot256
Filter Inserter
Filter Inserter
Posts: 995
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: steam output power not work

Post by robot256 »

There's a bunch of typos "engin" "engines", you're copying the entity twice instead if the item and the entity, the last one "steament" doesn't use the table.copy function at all. and a bunch of parameters that don't apply to the respective item/recipe/entity. Please go read the code from another mod that works and base yours on that one. Here's a good one: https://github.com/LsHallo/advanced-ele ... vamped-v16
aliakbartnt
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu May 16, 2024 6:45 pm
Contact:

Re: steam output power not work

Post by aliakbartnt »

robot256 wrote: Sat May 18, 2024 8:06 pm There's a bunch of typos "engin" "engines", you're copying the entity twice instead if the item and the entity, the last one "steament" doesn't use the table.copy function at all. and a bunch of parameters that don't apply to the respective item/recipe/entity. Please go read the code from another mod that works and base yours on that one. Here's a good one: https://github.com/LsHallo/advanced-ele ... vamped-v16
ok i try it thx you
Post Reply

Return to “Modding help”