May end up doing this myself, but figured I'd put it here in case someone else does it before I do.
Currently the only way to do this is with the console command /swap-players which calls Player::swap_players, but it would be neat if mods could do the same as well.
LuaPlayer::swap_players
- _CodeGreen
- Long Handed Inserter
- Posts: 92
- Joined: Sat Mar 05, 2022 11:30 am
- Contact:
LuaPlayer::swap_players
My Mods | If you can't make it perfect, make it adjustable
Re: LuaPlayer::swap_players
Thank you for adding LuaPlayer::swap_characters() for 2.0.67.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: LuaPlayer::swap_players
Oooops, looks like I'll have to rework a major part of miniMAXIme …
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: LuaPlayer::swap_players
The characters need players attached (you pass the player to the method, not the character) so I don't think this will work for character switcher mods.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: LuaPlayer::swap_players
Two players, two characters? Yes, that really wouldn't help my mod to exchange characters. However, it could be necessary (not sure, must check the code first) for my mod to update the character data (e.g. in games with modded characters, when the player's new character is based on a different prototype than the old one). Will you raise an event when characters are swapped?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: LuaPlayer::swap_players
It works exactly the same way as the existing console command mentioned in the first post.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.