Recycled Rockets and Cargo Pods v2


Recycled rockets! Adds CargoPods as finite items. 2 new silos, advanced planet themed fuels.

Tweaks
8 months ago
2.0
432
Mining Fluids Manufacturing

b Massive Stutter?

8 months ago

It seems like this mod is causing some updates to take over 200ms to complete, every second or two. This is making the game very frustrating to play :c
My guess is its something in the on_nth_tick code. I have a lot of mods (including planet mods and factorissimo) which likely increases the surface count, possibly increasing the number of loop iterations significantly.

Ideally that would be resolved, but an alternative solution (because I really like the extra rocket types), is to add a setting to disable the cargo pods, or make a new mod adding only the rockets

I don't mind helping, I just don't have any modding experience. I can try my hand at separating out the rockets into another mod (with your permission ofc).

Apologies if any of this was rude, I didn't intend for it to be c:

8 months ago
(updated 8 months ago)

updates are almost up to 600ms now after starting on tenebris, so the issue is likely unrelated to my surface count guess

edit: ignore this for now, it seems like something else might be causing this lag, i'm still pretty sure this mod was causing the initial 200ms delay though.
will report back if i determine otherwise

8 months ago

Yeah I'm curious to hear. The only reason why this might be happening is if any of the item iteration logic is doing a lot more work than expected. Sadly the dev environment is difficult to test such things like timing.

It might be something to do with these lines:

for surface_name, surface in pairs(game.surfaces) do
    local cargo_pods = surface.find_entities_filtered({ name = "cargo-pod" })
    for _, pod in pairs(cargo_pods) do
        if not (pod and pod.valid) then
            break
        end

I could probably write some caching logic that would check all surface once, go through each and only keep spaceships and planets. After that, I could just check if the number of games surfaces changes, otherwise skip all of those.

What I'd really love is to find an event for 1: launching a rocket, 2: orbital dropping. Then I could just listen for those and never do the nth_tick.

New response