Beacon Rebalance


Beacon rebalance mod that emulates the balance of Space Exploration's beacons, including the overload mechanic. (Now with Krastorio 2 and Bob's/SeaBlock compatibility!)

Tweaks
1 year, 3 months ago
1.1
16.6K

g Command to recalculate the beacons

7 months ago
(updated 7 months ago)

I've had a few issues now and then with machines being overloaded while only having 1 beacon (because of cloning for example). My suggestion is to have a command to recalculate the beacons.

You can register a command by calling commands.add_command in the on_load and on_init eventhandlers. This will make it possible to use /recalc-beacons in the console similar to the already existing commands such as /evolution, /help, or /permissions.

So in on_load_setup you could have:

    commands.add_command("recalc-beacons", {"command-help.recalc-beacons"}, function(args)
        global.beacon_tiles = {}

        for _, surface in pairs(game.surfaces) do
            for _, beacon in ipairs(surface.find_entities_filtered{type="beacon"}) do
                update_beacon_tiles(beacon, "add")
            end
        end
    end)

You might want to move some code around to avoid code repetition, but make sure that the command doesn't call on_load_setup again.

Also, I accidentally used the wrong discussion type, this should have been Ideas & suggestions instead of General, and only the mod author seems to be able to change this...

New response