Event to detect when a cargo pod is launched

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
thesixthroc
Fast Inserter
Fast Inserter
Posts: 114
Joined: Wed Apr 29, 2020 9:53 pm
Contact:

Event to detect when a cargo pod is launched

Post by thesixthroc »

This seems the biggest gap in the cargo pod APIs and prevents mods from restricting cargo pod launches from space platforms (except by rapidly checking the surface for cargo pods or reacting late to the cargo pod leaving to space platform surface.)
Rseding91
Factorio Staff
Factorio Staff
Posts: 16073
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Event to detect when a cargo pod is launched

Post by Rseding91 »

There is no current (and likely never will be) way to stop cargo pods from launching. The entire purpose of platforms with cargo bays is to 1: extend the hub size, and 2: launch/receive cargo pods.

You can simply remove the cargo hatch definitions from the cargo bay to remove functionality #2. But, when it exists - it's going to get used by the engine.
If you want to get ahold of me I'm almost always on Discord.
thesixthroc
Fast Inserter
Fast Inserter
Posts: 114
Joined: Wed Apr 29, 2020 9:53 pm
Contact:

Re: Event to detect when a cargo pod is launched

Post by thesixthroc »

Very well. I have several popular mods which restrict cargo drops under certain conditions and 'right after launch' proved to be the best UX, and while there is performance cost they seem to work fine by scanning the surface and intercepting pods.
Loup&Snoop
Inserter
Inserter
Posts: 49
Joined: Wed Dec 04, 2024 4:33 am
Contact:

Re: Event to detect when a cargo pod is launched

Post by Loup&Snoop »

+1 Blocking (specific) cargo pod drops to a specific surface would be useful for mod planets.
Sad to see that we need some hackey solutions.
thesixthroc
Fast Inserter
Fast Inserter
Posts: 114
Joined: Wed Apr 29, 2020 9:53 pm
Contact:

Re: Event to detect when a cargo pod is launched

Post by thesixthroc »

Bumping this with a polite FYI. I’d like to point out that tens of thousands of players are running find_entitites_filtered on every space platform above Cerys, Rubia, etc multiple times per second due to this missing API, which hurts performance of modded games.

Since (as mentioned above) cargo pods immediately being destroyed after an attempted launch is the best UX in the current API, this will likely rise to >100k players through PlanetsLib.
Quorken
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Aug 18, 2025 3:53 pm
Contact:

Re: Event to detect when a cargo pod is launched

Post by Quorken »

+1

They raise some good points - if a mod wants to stop cargo pods from even entering a surface, there isn't much they can do beyond a frequent, non-performant scan of all space platforms stopped at a given planet. And there are reasons beyond destroying cargo pods - maybe a mod wants to track some statistic regarding launched cargo pods, or print some message to chat.

Could instead be a on_cargo_pod_departed, which is fired when the cargo pod has fully "left" its origin entity (a rocket or space platform hub).

Mods could do something like having an invisible, "dummy" cargo landing pad placed on the surface in some out of the way location (a million tiles away), which is destroyed whenever the mod wants to allow cargo pods on that surface. But it would be great if there was an event when a cargo pod was created.

There also on_cargo_pod_finished_ascending, which is fired when the cargo pod leaves its surface of origin.

These kinda work for something like Hardcore Cargo Drops, but they aren't very immediate - the cargo pod isn't immediately destroyed.

Perhaps planets and space platforms could have a runtime "allow_cargo_pod_drops" member (boolean, default=true), which does exactly what it says. Adding it to planets means planet-wide bans don't have to monitor every platform around the planet, while adding it to the platforms means mods can have platform-specific criteria, like "this electromagnetically active substance is messing with the sensitive cargo pod circuitry".
Post Reply

Return to “Modding interface requests”