Page 1 of 1
[1.1.74] Cloning a rocket silo doesn't work
Posted: Mon Jan 30, 2023 12:20 pm
by Piratux
Cloning a rocket doesn't clone it properly. The cloned rocket's inventory (for ex.: satellite) disappears, and no rocket is launched when clicking "launch" button.
I can see the issue has been mentioned a while ago here and it seems all the issues described here remain:
67635
Re: [1.1.74] Cloning a rocket silo doesn't work
Posted: Mon Jan 30, 2023 3:47 pm
by Rseding91
Thanks for the report however this is working correctly: cloning just the rocket silo does not clone the rocket. This is because the rocket is its own entity separate from the silo and just happens to be launched through the rocket silo GUI.
If you are using the
https://lua-api.factorio.com/latest/Lua ... e_entities function and provide both the rocket silo and the rocket it will clone as you are wanting. If you just do one of the entities it will not do the other.
Re: [1.1.74] Cloning a rocket silo doesn't work
Posted: Wed Feb 01, 2023 10:44 am
by Piratux
Ah sorry, looks like I was wrong, cloning entities one by one doesn't work:
/c
people = game.player.surface.find_entities_filtered{position=game.player.position, radius = 15}
for i,j in pairs(people) do
if j.name == 'rocket-silo' or j.name == 'rocket-silo-rocket' or j.name == 'rocket-silo-rocket-shadow' then
local pos = game.player.position
pos.y = pos.y - 30
j.clone{position = pos}
end
end
But using clone_entities works:
/c
local entities = {}
local offset = {x = 0, y = -50}
people = game.player.surface.find_entities_filtered{position=game.player.position, radius = 15}
for i,j in pairs(people) do
if j.name == 'rocket-silo' or j.name == 'rocket-silo-rocket' or j.name == 'rocket-silo-rocket-shadow' then
entities[#entities+1] = j
end
end
game.player.surface.clone_entities{entities = entities, destination_offset = offset}
Thanks for the reply.