/swap-players event handler
-
- Filter Inserter
- Posts: 464
- Joined: Tue Jun 28, 2016 2:07 pm
- Contact:
/swap-players event handler
Using /swap-players breaks some mods without a clean way to handle it. Discovered as a result of Klonan's Construction Drones ceasing to function.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: /swap-players event handler
Never heared of that command but the in-game help says it just changes the character that is associated with a player. That can happen at any time without notification when any mod calls LuaPlayer.character = LuaEntity. So the event would have to notify any changes to LuaPlayer.character and LuaPlayer.get_associated_characters().
For the meantime i think the "clean way" to handle this would be not to assume anything about Player<->Character associations. Have you notified Klonan of his bug?
For the meantime i think the "clean way" to handle this would be not to assume anything about Player<->Character associations. Have you notified Klonan of his bug?
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: /swap-players event handler
My mod doesn't care about the player, only the charactereradicator wrote: ↑Wed Mar 25, 2020 7:35 pm For the meantime i think the "clean way" to handle this would be not to assume anything about Player<->Character associations. Have you notified Klonan of his bug?
The problem is, the character just pops into existance, with nothing telling my mod there is a new character entity running around
Re: /swap-players event handler
I don't see this as happening. There are a multitude of different ways the character entity can be swapped out on a player. Having events for all of them isn't something I want to maintain on the C++ side due to how much stuff mods can break every time the game calls a mod event handler.
For example:
Console commands, setting the controller on a player, a migration changing the character entity to another, the swap command, deleting the character by destroy(), deleting it via the map editor, and i'm sure others.
It's similar to the "item added/removed" event; it happens in so many different cases in so many different ways that the game would have to try to guard against mods breaking stuff during all of those cases and that's just too much so we don't provide those events.
For example:
Console commands, setting the controller on a player, a migration changing the character entity to another, the swap command, deleting the character by destroy(), deleting it via the map editor, and i'm sure others.
It's similar to the "item added/removed" event; it happens in so many different cases in so many different ways that the game would have to try to guard against mods breaking stuff during all of those cases and that's just too much so we don't provide those events.
If you want to get ahold of me I'm almost always on Discord.