Allow character entities to be teleported to another surface

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1645
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Allow character entities to be teleported to another surface

Post by Pi-C »

TLDR:

Allow teleporting character entities to another surface iff teleporting entities comes with less overhead than generating new ones.
Why?
This would allow at least two mods to perform better.
What?
I've recently discussed with Earendel how AAI Programmable Vehicles and Autodrive work. Both mods rely on dummy characters (character entities not connected to a player) inserted into vehicles, but the mods use different approaches:

AAI inserts a dummy and leaves it in the vehicle. That's comparatively cheap UPS wise, but it makes the vehicles unminable -- and should the mod ever be removed from a running game, the dummy characters will be left behind.

Autodrive inserts a dummy when needed (no player inside vehicle, and gate or enemy sensor are installed, and player/character is needed to open gates or shoot), and removes them again at the end of the tick. This is bad UPS wise, but vehicles can be mined without problems at any time, and no dummies will litter the surface when the mod is removed.

Earendel suggested that it may be cheaper if we didn't create a new dummy character each time it's needed, but create it just once and hide it on another surface if it's not needed. That seemed like a good idea (I immediately thought of a 1x1 surface called "dummy_dungeon") -- until I read this:
teleport(position, surface) → boolean

[…]

surface :: SurfaceSpecification (optional): Surface to teleport to. If not given, will teleport to the entity's current surface. Only players and cars can be teleported cross-surface.
I'm not sure whether teleporting a character entity really would have less overhead than creating a new one each time it's needed (at least, reusing one dummy wouldn't waste as many unit_numbers). If it really comes with less overhead, please consider allowing characters to be teleported to another surface!
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Modding interface requests”