Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for auto decon of miners #143

Open
vfinn opened this issue Apr 1, 2024 · 0 comments
Open

Fix for auto decon of miners #143

vfinn opened this issue Apr 1, 2024 · 0 comments

Comments

@vfinn
Copy link

vfinn commented Apr 1, 2024

This is simpler code that works with any size mining field. The key is that miner.mining_target goes to nil when the miner.mining_target.amount == 0.

function OarcAutoDeconOnTick()
    if (global.oarc_decon_miners and (#global.oarc_decon_miners > 0)) then
        for i,miner in pairs(global.oarc_decon_miners) do
            if (miner and miner.valid and (miner.mining_target == nil)) then
                miner.order_deconstruction(miner.force)
            end
            table.remove(global.oarc_decon_miners, i)
        end
    end
end

MINOR ISSUE ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant