Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Session Dict Before invoking PlayerStatusChanged #5500

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

benev0
Copy link

@benev0 benev0 commented Oct 21, 2024

Tested with SS14 master

Stops session existing in InternalSessions while PlayerStatusChanged is invoked

fix space-wizards/space-station-14#32926

@benev0
Copy link
Author

benev0 commented Oct 21, 2024

  • readyCount has delay after changes: original behavior was to alter on original player reconnect (assuming also incorrect)
  • no clue if original behavior of the function is actuality correct
  • PlayerStatusChanged has 56 refs in ss14 content repo; no clue what dire consequences may be unleashed regardless of if new behavior is correct

@benev0
Copy link
Author

benev0 commented Oct 21, 2024

I am going to assume that the test failure is unrelated

@ElectroJr
Copy link
Member

ElectroJr commented Oct 23, 2024

no clue what dire consequences may be unleashed regardless of if new behavior is correct

IMO it makes more sense for the session to still exist when the event gets raised, in case some event handlers end up calling other methods that need to retrieve the session via the userId. Its up to event handlers to check the status of sessions. I.e., its probably better to just fix this by having the lobby only count players with either SessionStatus.Connected or SessionStatus.InGame, instead of introducing breaking changes that might cause bugs elsewhere else.

Actually, given that the description of ISharedPlayerManager.PlayerCount is "Number of players currently connected to this server", either the description is inaccurate and need updating, or there is a bug and it should already be filtering by the session status. I guess it depends on what PlayerCount is mainly used for.

@benev0
Copy link
Author

benev0 commented Oct 23, 2024

IMO it makes more sense for the session to still exist when the event gets raised ...

My head cannon is that the PlayerStatusChanged event should either have data passed or be fired after changes occur. Firing before with no data indicates that status will change for a player, but that data is not available, nor does it indicate which player will have this change; this behavior is also inconsistent with the PlayerStatusChanged fired on connect which waits for the player to be added to the data. Regardless, it seems that a full examination of downstream subscribers may be in order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lobby player count is not updated correctly when a player leaves
2 participants