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 problems with knife swap/stay command timing #888

Merged
merged 1 commit into from
Oct 3, 2022

Conversation

nickdnk
Copy link
Collaborator

@nickdnk nickdnk commented Sep 28, 2022

It seems there are still some rare problems with !stay and !swap being called at the exact wrong time causing the game to misbehave and sometimes skip the live countdown entirely.

This PR disables the ability to choose a side until the knife-round has completely ended, removing the race-condition window that would cause this bug.

It also reduces info message interval from 29 to 20, but instead restarts the timer on each round start to avoid double-printing messages, such as the "Team X won the knife round, waiting for them to type swap/stay", which is also triggered when the knife round ends.

Added mp_round_restart_delay 3 to the default knife config as you now can't do swap/stay until the round ends, so 5 seconds is a bit much.

Deduplicate logic for the knife-decision chat message

Remove round-end-fun-fact override hack; it was buggy.

I would like to merge this to 0.10 and release as 0.10.4 (with #887), as this is potentially game-breaking and 0.11 is still not ready.

@nickdnk nickdnk added the bug label Sep 28, 2022
@nickdnk nickdnk requested a review from splewis September 28, 2022 00:53
@nickdnk
Copy link
Collaborator Author

nickdnk commented Sep 28, 2022

Also, I have tested this as well as I can with just myself and a bot, so I know it works, but I would appreciate it if someone else would give it a test.

@nickdnk
Copy link
Collaborator Author

nickdnk commented Sep 28, 2022

I observed that doing knife cvar restore when the knife round reaches its win-panel is the cause of some of these problems. It will potentially restore mp_respawn_on_death_t/ct (which is set to 1 in warmup, then saved as a cvar overridden by 0 in knife config) right as the win panel shows up which causes players to sometimes respawn. I've moved this to the same place as the warmup config which seems to solve that problem. It also makes sense that we don't mess with cvars for a round that has not yet completely ended. This may have been the cause of a bunch of other issues as well, as these cvars could contain basically anything, as configs are user-defined.

I'm running with all of these changes on top of 0.11 for my game service at the moment, and I'll leave it there for a couple of days to observe if things work.

See 67c30d1

…causes odd race conditions when called at the wrong time

Reduce info message interval from 29 to 20 but restart it on each round start to avoid double-printing messages
Default mp_round_restart_delay 3 in knife config
Deduplicate knife decision prompt text
Remove MVP reason hack; it was buggy and could print for someone from wrong team
Restore knife cvars when knife round has ended, not on round win panel
Adjust knife round winner callout due to changes
Properly reset knife round var
Move cvar save logic to start-knife callback to prevent exec clashes
Move knife timer to round end instead of win panel
Do not allow less than 10 seconds on knife timer as that does not really make any sense.
@nickdnk nickdnk force-pushed the fix_knife_timing_issues branch from 192097a to 6b01f68 Compare September 30, 2022 00:20
@nickdnk
Copy link
Collaborator Author

nickdnk commented Sep 30, 2022

I have extensively tested this in real games and manual testing and everything seems to be working correctly.

Copy link
Owner

@splewis splewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; this is a good catch. I'm not surprised such a race condition was possible.

@nickdnk nickdnk merged commit fb9c4c1 into master Oct 3, 2022
@nickdnk nickdnk deleted the fix_knife_timing_issues branch October 3, 2022 00:13
Apfelwurm pushed a commit to Lan2Play/get5 that referenced this pull request Oct 19, 2022
…causes odd race conditions when called at the wrong time (splewis#888)

Reduce info message interval from 29 to 20 but restart it on each round start to avoid double-printing messages
Default mp_round_restart_delay 3 in knife config
Deduplicate knife decision prompt text
Remove MVP reason hack; it was buggy and could print for someone from wrong team
Restore knife cvars when knife round has ended, not on round win panel
Adjust knife round winner callout due to changes
Properly reset knife round var
Move cvar save logic to start-knife callback to prevent exec clashes
Move knife timer to round end instead of win panel
Do not allow less than 10 seconds on knife timer as that does not really make any sense.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants