Better Asteroid Belt

by Kryzeth

Ground-up reimplementation of Asteroid Belt, made to function completely standalone. Compatible with all planet mods, Outer Rim, Redrawn Space Connections, and Redrawn Space Compatibility, with settings to move Maraxsis and Cubium to the outer planet area.

Content
5 days ago
2.1
3.78K
Planets

i [Implemented] K2 Imersite Asteroids compabilty

6 days ago

Hey! Could you add compatibility with Krastorio 2 Imersite Asteroids? It already supports the original Asteroid Belt, but Better Asteroid Belt replaces the Fulgora and Gleba connections, which can cause their custom asteroid spawn definitions to be lost.

One possible fix would be to preserve custom asteroid spawn definitions from the original connections when rebuilding them. This could also improve compatibility with other mods that add custom asteroids. Alternatively, a small compatibility patch specifically for Imersite Asteroids would work too.

I could directly tell what to do in the both variants, if you don't wanna dig deep into it.

6 days ago

By "Fulgora and Gleba connections", I'm assuming you mean, to Aquilo? Since the vanilla Fulgora-Gleba connection shouldn't be modified by Better Asteroid Belt (that would likely be getting removed by RSC, if it's installed)

Hmm, I'll have to look into how they did their Asteroid Belt compat, if it was a manual override or something more automated. If it was a manual override, then yeah, I would probably want to look into writing some more automated functionality for it. Maybe I can borrow some logic from RSC, since they do have a way to preserve asteroid types on connections.

I wouldn't mind hearing your idea, since this does sound like it would be a major improvement. Doesn't have to be exact code, any pseudo code would help (since I won't be able to work on this until tomorrow)

6 days ago

Yep, I meant Fulgora-Aquilo and Gleba-Aquilo.

Imersite Asteroids adds its spawn definitions manually to those two connections. The original Asteroid Belt changes their destinations to the inner belt edge but keeps their internal names, so the imersite spawn definitions are preserved.

Better Asteroid Belt, removes those connections and creates new ones, which is where the original spawn definitions can get lost.

My suggestions are:

1.Save the custom asteroid spawn definitions before deleting connections in prune_connections().
2.After repair_connections(), find the corresponding replacement connections and merge the saved definitions into them, avoiding duplicates.

For example, fulgora-aquilo would pass its custom asteroid spawn definitions to fulgora-asteroid-belt-inner-edge, and the same would apply to Gleba.

5x density multiplier should be applied to your mod too, since internal asteroid belt's names are the same.

If RSC already has a way to preserve custom asteroid spawn definitions, reusing that logic would probably be the cleanest solution rather than adding another mod specific compatibility patch.

5 days ago
(updated 5 days ago)

Hmmm, I had to tweak the logic so it became a little bit more complex than that (specifically with regards to More Asteroids having planet-exclusive asteroids, and with certain routes that had Big asteroids (such as Fulgora-Paracelsin), polluting the inner routes.

But the core idea remained the same, just had to ensure asteroids from pruned connections aren't added to the 'wrong' side of the belt.

Also, annoyingly, imersite asteroid calls its own data-updates from within data, which means that data-updates script no longer runs in data-updates (this behavior is handled differently in 2.1, if they always coded it that way; scripts used to run twice when called this way, but now they are "cached" so they only run once when called from different files, maybe to improve loading times, idk)

They have an optional compatibility on the original asteroid belt mod, so their compat code works fine in the early data stage, but due to load order shennanigans, it will miss my asteroid belt data stage.

I set the dependency from my side to force the load order and just copied over the asteroid spawn definitions from one of the route definitions to the belt (using data.raw directly, to avoid copying anything from their GPL code) so it works "good enough"

Ideally, they should stop calling data-updates from within the data stage, since that would fix the problem immediately (from my testing). I also wrote the copy logic so that if they DO fix it, my workaround solution should deactivate itself instead.

Anyways, implemented in v1.0.16

New response