deep copy a existing item

Place to get help with not working mods / modding interface.
nosports
Filter Inserter
Filter Inserter
Posts: 274
Joined: Fri Jan 19, 2018 5:44 pm
Contact:

deep copy a existing item

Post by nosports »

Hello,

i just have the question how do i 'deep-copy' a chemical-plant ?
it seems i did not understand it full

I want to make a true heat exchanger (i find it best to use the chemical plant because its a decent size and have all the input/output definitions.....)

-------------
This works so far
-------------
local machine = table.deepcopy(data.raw["offshore-pump"]["offshore-pump"])
machine.name = "air-filter"
machine.adjacent_tile_collision_test = {
""
}
machine.fluid = "air"
machine.max_health = 50
machine.minable = {
mining_time = 0.05,
result = "air-filter"
}

data:extend{machine}

------------------
But this don't and unfortunately i just don't see why not.... :oops:
------------------

local machine = table.deepcopy(data.raw["chemical-plant"])
machine = "heat-excanger2"
machine.allowed_effects = {
""
}
machine.crafting_categories = {
"heat-exchange"
}
machine.energy_usage = void
machine.minable = {
mining_time = 0.2,
result = "heat-exchanger2",
}
machine.module_specification = {
module_slots = 0
}

data:extend{machine}

------------------

Can anyone guide me on this ? :P
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: deep copy a existing item

Post by DaveMcW »

Try using machine.name to change the name.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: deep copy a existing item

Post by darkfrei »

tables {} and {""} are not same
Post Reply

Return to “Modding help”