Hi,
I red somewhere that there will be a on_player_connected event in the 0.13, which I am waiting for. It would be very useful.
But I wanted to be sure taht you are thinking about its necessary counterpart : the on_player_disconnect. These two events are very useful in MP games, to precisely track who is connected or not, and to trigger some actions on connexion and deconnexion. Of course, we can poll teh player.connected status in on_tick but it's a waste of CPU time and it is not accurate, unless you do it every game.tick...
I have to precise that the on_player_disconnect should be also triggered on the last player disconnecting from the game, just before the server go in pause.
Both these events should accept changes in the global variables of course, but also on the GUI of the connecting/disconnecting player (so that we can open/close some GUI elements of the player), and on LUA types as if the player was connected (I think for example of the possibility to change player's force, that can be made only if player is considered as connected).
The cycle could be :
player is connecting :
- player.connected is set to true and eventually added to game.players
- player_on_connected is fired
- player is disconnecting :
- player_on_disconnect is fired
- player.connected is set to false
- server go eventually in pause.
Thanks for your feedback.
on_player_connected/on_player_disconnected events
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: on_player_connected/on_player_disconnected events
viewtopic.php?f=34&t=25270
Added several player related events: ... on_player_joined_game, on_player_left_game
Re: on_player_connected/on_player_disconnected events
Ok, i'm stupid, I red the post, but miss this important onebobingabout wrote:viewtopic.php?f=34&t=25270Added several player related events: ... on_player_joined_game, on_player_left_game

I must improve my english...
My mods on the Factorio Mod Portal 
