New Event: on_entity_teleported, script_raised_teleported

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

New Event: on_entity_teleported, script_raised_teleported

Post by eradicator »

What

Official support for event based teleportation handling between mods.

Details

Several mods like Picker Dollies or Warptorio 2 allow the player to teleport/move existing entities. However due to lack of an "official" event for this everyone implements their own undocumented remote interface for sharing event ids which makes it difficult for other mod authors to support "moving" as a generic function.

Expected

Ideally it would be awesome if LuaEntity.teleport() also supported "{raise_teleported=true}" style equivalent to LuaSurface.create_entity. The event could look something like this:

Code: Select all

on_entity_teleported or script_raised_teleported

  Called after an entity was teleported.

  Contains
    entity :: LuaEntity
    source_position :: Position
    source_surface :: LuaSurface
    player_index :: uint (optional): The player that caused the teleporting.
    
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: New Event: on_entity_teleported, script_raised_teleported

Post by Optera »

+1
Having to register to custom events on each mod teleporting entities around became a loosing battle.
ILLISIS
Inserter
Inserter
Posts: 25
Joined: Wed Feb 09, 2022 10:49 am
Contact:

Re: New Event: on_entity_teleported, script_raised_teleported

Post by ILLISIS »

+1 from me

Space Exploration's upcoming version will teleport spiders to other surfaces instead of cloning them so having a natural event-driven way to detect a surface change of a spider will be useful.
User avatar
Stringweasel
Filter Inserter
Filter Inserter
Posts: 419
Joined: Thu Apr 27, 2017 8:22 pm
Contact:

Re: New Event: on_entity_teleported, script_raised_teleported

Post by Stringweasel »

+1

Would be great to ensure your custom entities don't break without you knowing. For example with SE's spaceships and my Space Spidertron
Alt-F4 Author | Factorio Modder
My Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock | Weasel's Demolition Derby
Official Contributor to Space Exploration
Xorimuth
Filter Inserter
Filter Inserter
Posts: 705
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: New Event: on_entity_teleported, script_raised_teleported

Post by Xorimuth »

+1
Picker dollies and Space Exploration both use teleportation and are both very common. It would be nice not to have to rely on implementing custom events, etc.
My mods
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Pi-C
Smart Inserter
Smart Inserter
Posts: 1738
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: New Event: on_entity_teleported, script_raised_teleported

Post by Pi-C »

+1! GCKI may teleport vehicles to another surface. If a vehicle controlled by AAI Programmable Vehicles is teleported to another surface, it will resume its path there -- even if that doesn't make sense. While I have a custom event that I can raise (or so I believe), it would be more transparent for other mods if they could listen to a vanilla event instead of having to ask me for the latest event ID.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
Stringweasel
Filter Inserter
Filter Inserter
Posts: 419
Joined: Thu Apr 27, 2017 8:22 pm
Contact:

Re: New Event: on_entity_teleported, script_raised_teleported

Post by Stringweasel »

This is implemented 1.1.77. Awesome! :D
Alt-F4 Author | Factorio Modder
My Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock | Weasel's Demolition Derby
Official Contributor to Space Exploration
Post Reply

Return to “Implemented mod requests”