Hi,
Really great mod. One suggestion - what if the linked belt got marked for deconstruction when it's pair got either mined or destroyed ?
That would make it easier to clean up.
Sample Code Here :
script.on_event(defines.events.on_player_mined_entity, function(event)
local player_index = event.player_index
local player = game.players[player_index]
local entity = player.selected
if entity and entity.valid then
if entity.type == "linked-belt" then
local lbn = entity.linked_belt_neighbour
if lbn and lbn.surface == entity.surface then
--Mark linked belt neighbour for deconstruction
lbn.order_deconstruction(lbn.force, player)
end
end
end
end)
Pastebin link - https://pastebin.com/cB3mNnrz