In the meantime, what you should do is to make with the map editor 4 conveyor in each spot (one for each direction), and use conveyor:set_enabled() to enable only one of them every time. Do you see what I mean?
In general, using set:enabled() is much easier than removing and re-creating entities. Actually, that's why this bug exist: I almost never remove and re-create entities in my games.
I see. In fact, I was thinking about this possibility, but I considered that it was less complicated to remove and re-create than creating 4 entities for each conveyor. But if it's the best solution now, I guess I'll do this.

But considering what you said about remove_entities(), maybe I also see another possibility : if I put the part of the first function where I re-create the conveyors in another callback function called one or two cycles after, maybe the problem of remove_entities will disappear. I'll try this, just in case.
That being said, your puzzle looks nice and your code is well commented. I hope you will share your game on this forum soon
Thank you.

For now on, I essentially did mapping so I don't think there are many things to say about my project. But I eventually intended to share some scripts meantime (I'm currently working on a Beamos (from Alttp) implementation, maybe some quest developers would be interested).
Edit : finally, the alternative of waiting few cycles seems to work.

Of course it's not the best way to do this since there are a few cycles where the conveyors don't appear... but the player won't mind about two cycles missing I guess.

Here is the new code :
local map = ...
local brouillard
local mouvement_brouillard
local current_conveyor_direction = 0
-- Conveyors position
local random_conveyors = {
{ x = 376, y = 1261 },
{ x = 440, y = 1261 },
{ x = 504, y = 1261 },
{ x = 568, y = 1261 },
{ x = 376, y = 1325 },
{ x = 440, y = 1325 },
{ x = 504, y = 1325 },
{ x = 568, y = 1325 },
{ x = 376, y = 1389 },
{ x = 440, y = 1389 },
{ x = 504, y = 1389 },
{ x = 568, y = 1389 }
}
local function create_conveyors()
-- Remove conveyors before creating them again in another direction
local function remove_conveyors()
map:remove_entities("conveyor_")
sol.timer.start(2, create_conveyors) -- Cannot create the conveyors in the same cycle than the one when they disappear, have to wait.
end
-- Change the direction of conveyors (0 : east, 2 : north, 4 : west, 6 : south)
current_conveyor_direction = current_conveyor_direction + 2
if current_conveyor_direction > 7 then
current_conveyor_direction = 0
end
-- Create conveyors
for i = 1, 12, 1 do
map:create_conveyor_belt{
name = "conveyor_" .. i,
layer = 1,
x = random_conveyors[i].x,
y = random_conveyors[i].y,
direction = current_conveyor_direction
}
end
sol.timer.start(1898, remove_conveyors)
end
-- Activate the change of direction when Link walks on the sensor
function active_random_conveyors:on_activated()
create_conveyors()
active_random_conveyors:set_enabled(false)
end