Page 1 of 1

PlayerEntered event does not fire when adding a new player

PostPosted: Sat Mar 14, 2020 2:25 am
by Nash
In the following scenario:

1) With a mod that has a PlayerEntered event. Player 1 starts a single player game. Event fires off as expected
2) Save the the game, then quit
3) Start a 2 player game, load up the saved game
4) The PlayerEntered event does not fire for Player 2.

My question is if such a scenario is deliberately not supported?

Re: PlayerEntered event does not fire when adding a new play

PostPosted: Sat Mar 14, 2020 2:37 am
by Rachael
I don't think lack of support for this is deliberate, however I also don't think it's something easily accounted for. I don't think when the event system was designed, such a scenario ever crossed anyone's mind.

This is yet another way I think that the event system as a whole is showing some of its weaknesses. You really have to account for every little thing, and that's simply not possible because it's really easy to come up with ways that are less conventional - such as this.

Re: PlayerEntered event does not fire when adding a new play

PostPosted: Sat Mar 14, 2020 2:50 am
by Nash
Should I make a suggestion for this? Probably a new event to ensure compatibility; NewPlayerEntered? PlayerAdded?

Re: PlayerEntered event does not fire when adding a new play

PostPosted: Sat Mar 14, 2020 2:55 am
by Rachael
I think it's best to report it as a bug., but it will call into question whether the scenario you described should be directly supported or not. (Which is a good thing, don't worry)

Re: PlayerEntered event does not fire when adding a new play

PostPosted: Sat Mar 14, 2020 3:54 am
by Nash
Added runnable example file, requesting thread moved to Bugs

Re: PlayerEntered event does not fire when adding a new play

PostPosted: Sat Mar 14, 2020 9:17 am
by phantombeta
I believe this happens for the same reason as this bug report.
I don't think we can trivially change where it's called from without breaking existing mods, so it might be a better idea to have a boolean that indicates whether to use the old behaviour or the new one. Or we could just straight up use the versioning system to choose that, that should work too.