Cross-surface teleport support for other entities

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
protocol_1903
Filter Inserter
Filter Inserter
Posts: 276
Joined: Fri Sep 09, 2022 4:33 pm
Contact:

Cross-surface teleport support for other entities

Post by protocol_1903 »

tl;dr I want entity.teleport to allow for cross-surface teleportation on (basically) all entities. I'm fine with leaving transport lines out of this conversation.

Compound entities are, well, compound, and having to deconstruct and reconstruct them piecewise whenever they are teleported can become both cumbersome and prevent certain features from working properly without massive headaches. I'd like to be able to teleport these entities regardless, so that a mod with compound entities can hook onto that event and just update the entity's surface and/or location.
If you need to reach me, message me on discord.

I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15885
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Cross-surface teleport support for other entities

Post by Rseding91 »

Cross surface teleport is riddled with issues on the C++ side as the game needs to invalidate all references to the entity - but not destroy configuration data - and then restore the entity on the other surface. This makes it extremely tedious to implement because it can't be done generically. Every entity that wants to do it has to know it's about to happen, do a bunch of special logic, and then un-do it when moved to the other surface.
If you want to get ahold of me I'm almost always on Discord.
curiosity
Filter Inserter
Filter Inserter
Posts: 668
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Cross-surface teleport support for other entities

Post by curiosity »

Rseding91 wrote: Sun Jul 13, 2025 5:50 pm Cross surface teleport is riddled with issues on the C++ side as the game needs to invalidate all references to the entity - but not destroy configuration data - and then restore the entity on the other surface. This makes it extremely tedious to implement because it can't be done generically. Every entity that wants to do it has to know it's about to happen, do a bunch of special logic, and then un-do it when moved to the other surface.
So, what you are saying it's clone_entities and destroying the originals after? Seems to me like it could be a single API method so the entities are unambiguously moved from the script perspective. Consider a uniquely existing entity, e.g. a Factorissimo building. Such entities would benefit from being able to detect the move.
Post Reply

Return to “Modding interface requests”