Page 1 of 1

Cross-surface teleport support for other entities

Posted: Sun Jul 13, 2025 4:13 pm
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.

Re: Cross-surface teleport support for other entities

Posted: Sun Jul 13, 2025 5:50 pm
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.

Re: Cross-surface teleport support for other entities

Posted: Mon Jul 14, 2025 7:57 am
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.