I have a problem, when placing my Musk floors using robots. The hidden wires don't connect.
The issue does not happen with player placing the floors.
Here is an image of player placing the floors:

Player Code
Robot Placed tiles:Code: Select all
local function Player_Tile_Built(event)
local player = game.players[event.player_index]
local surface = player and player.surface
for i, vv in ipairs(event.tiles) do
local position = vv.position
local currentTilename = surface.get_tile(position.x,position.y).name
if currentTilename == "bi-solar-mat" then
writeDebug("Solar Mat has been built")
local force = event.force
local solar_mat = surface.get_tile(position.x,position.y)
local sm_pole_name = "bi_solar_pole"
local sm_panel_name = "bi_solar-panel_for_Solar-Mat"
local create_sm_pole = surface.create_entity({name = sm_pole_name, position = {position.x + 0.5, position.y + 0.5}, force = force})
local create_sm_panel = surface.create_entity({name = sm_panel_name, position = {position.x + 0.5, position.y + 0.5}, force = force})
create_sm_pole.minable = false
create_sm_pole.destructible = false
create_sm_panel.minable = false
create_sm_panel.destructible = false
else
local radius = 0.5
local area = {{position.x - radius, position.y - radius}, {position.x + radius, position.y + radius}}
writeDebug("NOT Solar Mat")
local entities = surface.find_entities(area)
local entity1 = entities[1]
entity1 = surface.find_entities_filtered{area=area, name="bi_solar_pole", limit=1}
if entity1 then
for _, o in pairs(surface.find_entities_filtered({area = area, name = "bi_solar_pole"})) do o.destroy() end
writeDebug("bi_solar_pole Removed")
else
writeDebug("bi_solar_pole not found")
end
--- Remove the Hidden Solar Panel
local entity2 = entities[1]
entity2 = surface.find_entities_filtered{area=area, name="bi_solar-panel_for_Solar-Mat", limit=1}
if entity2 then
for _, o in pairs(surface.find_entities_filtered({area = area, name = "bi_solar-panel_for_Solar-Mat"})) do o.destroy() end
writeDebug("bi_solar-panel_for_Solar-Mat Removed")
else
writeDebug("bi_solar-panel_for_Solar-Mat not found")
end
end
end
end

Robot Code
As you can see, the wires are not connecting as they should.Code: Select all
local function Robot_Tile_Built(event)
local robot = event.robot
local surface = robot.surface
-- fix #2 Error while running event Bio_Industries::on_robot_built_tile
if surface == nil then
return
end
for i, vv in ipairs(event.tiles) do
local position = vv.position
local currentTilename = surface.get_tile(position.x,position.y).name
if currentTilename == "bi-solar-mat" then
writeDebug("Solar Mat has been built")
local force = event.force
local solar_mat = surface.get_tile(position.x,position.y)
local sm_pole_name = "bi_solar_pole"
local sm_panel_name = "bi_solar-panel_for_Solar-Mat"
local create_sm_pole = surface.create_entity({name = sm_pole_name, position = position, force = force})
local create_sm_panel = surface.create_entity({name = sm_panel_name, position = position, force = force})
create_sm_pole.minable = false
create_sm_pole.destructible = false
create_sm_panel.minable = false
create_sm_panel.destructible = false
else
local radius = 0.5
local area = {{position.x - radius, position.y - radius}, {position.x + radius, position.y + radius}}
writeDebug("NOT Solar Mat")
local entities = surface.find_entities(area)
local entity1 = entities[1]
entity1 = surface.find_entities_filtered{area=area, name="bi_solar_pole", limit=1}
if entity1 then
for _, o in pairs(surface.find_entities_filtered({area = area, name = "bi_solar_pole"})) do o.destroy() end
writeDebug("bi_solar_pole Removed")
else
writeDebug("bi_solar_pole not found")
end
--- Remove the Hidden Solar Panel
local entity2 = entities[1]
entity2 = surface.find_entities_filtered{area=area, name="bi_solar-panel_for_Solar-Mat", limit=1}
if entity2 then
for _, o in pairs(surface.find_entities_filtered({area = area, name = "bi_solar-panel_for_Solar-Mat"})) do o.destroy() end
writeDebug("bi_solar-panel_for_Solar-Mat Removed")
else
writeDebug("bi_solar-panel_for_Solar-Mat not found")
end
end
end
end