Page 1 of 1

deep copy a existing item

Posted: Tue Mar 26, 2019 10:34 pm
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

Re: deep copy a existing item

Posted: Tue Mar 26, 2019 11:41 pm
by DaveMcW
Try using machine.name to change the name.

Re: deep copy a existing item

Posted: Wed Mar 27, 2019 8:24 am
by darkfrei
tables {} and {""} are not same