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

b 3 Bugs with surfaces

7 months ago
(updated 7 months ago)

When importing a surface from another save (go to the editor > Surfaces > Import save (the last button)), the setup function isn't called for the new surface which allows extra beacons to be added around machines that already have a beacon without overloading them. When you deconstruct and reconstruct the original beacon, it works correctly again (for that beacon).

And also, when a surface is deleted (editor > Surfaces > Delete surface (the red button)), the global.beacon_tiles data for that surface is not deleted, which can cause machines to be overloaded when they are only surrounded by 1 beacon. This happens after the beacon is deconstructed and reconstructed (I think the original beacon from the deleted surface (which had the same name) is still in global.beacon_tiles, together with the newly added beacon on the same spot).

I also found a third bug, when you add a machine, and beacon, then remove all entities (go to the editor > Surfaces > Remove all entities), and then place another machine and beacon on the same spot, it will get overloaded.

So to reproduce:
[ ] create a small sandbox world
[ ] add a machine with beacon
[ ] save the game
[ ] go to the editor > Surfaces > Import save
[ ] import the game that you just saved
[ ] go to the new surface by selected it in the combobox on the Surfaces tab in the editor
[ ] add an extra beacon around the machine
[ ] machine now has 2 beacons without overloading

And to reproduce the second bug:
[ ] follow the same steps as the first bug
[ ] deconstruct the beacons on the imported surface
[ ] place the beacon again
[ ] delete the surface
[ ] import the save again to get another surface with the same name as the one you deleted
[ ] remove the beacon, and add it again
[ ] machine will now be overloaded with 1 beacon

I think the solution is to handle the events related to surface deletion, creation, clearing, and probably renaming:
[ ] on_surface_created (for the first bug)
[ ] on_surface_deleted (for the second bug)
[ ] on_surface_cleared (for the third bug)
[ ] on_surface_renamed (I have no idea when surfaces get renamed, but maybe you want to have a look at this one as well)

7 months ago

Can confirm the third bug, that's how I came here :)
Deleted all entities in the editor extensions testing surface to free up some FPS, noticed that beacons become overloaded around specific coordinates.

New response