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

fix: duplicate player creation on death screen #3325

Merged
merged 2 commits into from
Feb 8, 2025

Conversation

dudantas
Copy link
Member

@dudantas dudantas commented Feb 5, 2025

Description

This commit fixes a bug where a duplicate player instance was created when a player confirmed the death screen ("ok") and was subsequently kicked for exceeding the maximum packets per second. This bug resulted in two player objects being active simultaneously, leading to unpredictable in-game behavior because the system couldn't determine which instance to interact with.

Behaviour

Actual

When a player confirms the death screen and is kicked for exceeding the max packets per second, a duplicate player instance is created. This leads to two active instances of the same player, causing erratic in-game behavior.

Expected

Upon confirming the death screen, the system should first check if a player with the same name is already online. If so, it should use the existing instance rather than creating a new one, ensuring that only one active instance per player exists.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested

To reproduce the bug:

  1. Lower the "Max packets per second" value to a very low value (e.g., 7 or 10).
  2. Kill your character to trigger the death screen.
  3. On the death screen, press "ok" to confirm.
  4. Quickly perform an action that sends additional packets (e.g., press "ctrl g", which triggers a client request).
  5. When the console displays a message similar to:
    [2025-05-02 00:35:23.770] [thread 26856] [warning] [Connection::parseHeader] - 127.0.0.1 disconnected for exceeding packet per second limit.
    it indicates that the bug has been reproduced.

With this fix applied, the character should not duplicate when following these steps.

  • Manual testing was performed following the steps above

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

@dudantas dudantas force-pushed the dudantas/fix-char-duplication-on-death branch from 67d5c92 to eea1f8c Compare February 5, 2025 04:57
@dudantas dudantas force-pushed the dudantas/fix-char-duplication-on-death branch from eea1f8c to 7cfbf14 Compare February 5, 2025 05:03
@dudantas dudantas force-pushed the dudantas/fix-char-duplication-on-death branch from 87b2ed2 to 7784d6e Compare February 7, 2025 00:16
Copy link

sonarqubecloud bot commented Feb 7, 2025

@dudantas dudantas linked an issue Feb 8, 2025 that may be closed by this pull request
5 tasks
@majestyotbr majestyotbr merged commit f99a3ba into main Feb 8, 2025
33 checks passed
@majestyotbr majestyotbr deleted the dudantas/fix-char-duplication-on-death branch February 8, 2025 18:01
lucas-caminha pushed a commit to lucas-caminha/canary that referenced this pull request Feb 10, 2025
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.

Corpse and Login Duplicate
3 participants