Linked Belts


Quantum connection between belts; UPS-free, multiplayer, multiple forces and surfaces compatible

Content
1 year, 7 months ago
1.1
3.75K
Cheats

i Mark linked belt for deconstruction if one got mined/destroyed

1 year, 2 months ago

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

1 year, 2 months ago

Hi, thanks, you are invited to collab.

1 year, 1 month ago

Is it possible to make an option for the belt return to its previous state after destroying the linked one? Like remembering which belt it was linked to so we don't have to destroy the first one?

New response