on_player_connected/on_player_disconnected events

This is the place to request new mods or give ideas about what could be done.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

on_player_connected/on_player_disconnected events

Post by binbinhfr »

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.
My mods on the Factorio Mod Portal :geek:
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: on_player_connected/on_player_disconnected events

Post by bobingabout »

viewtopic.php?f=34&t=25270
Added several player related events: ... on_player_joined_game, on_player_left_game
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: on_player_connected/on_player_disconnected events

Post by binbinhfr »

bobingabout wrote:viewtopic.php?f=34&t=25270
Added several player related events: ... on_player_joined_game, on_player_left_game
Ok, i'm stupid, I red the post, but miss this important one :oops:
I must improve my english...
My mods on the Factorio Mod Portal :geek:
Post Reply

Return to “Ideas and Requests For Mods”