-
Notifications
You must be signed in to change notification settings - Fork 174
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
Clean up pause time counter logic #784
Conversation
Okay was testing the pauses and first thing broke lol Test Case OneRelevant pause vars:
This should make all pauses last to a total of 300 seconds, and require intervention on both users to resume, or have the timer run its course. Afterwards, it should now allow anymore pauses for the team. Right now, it allows for 1 timeout of 60 seconds on each side, and trying to call !pause again just simply resets the countdown to round start timer to 15, and does not allow for any more timeouts. Calling a tech pause does the same thing, and the TechPause timer goes up when in freeze time, but stops during round, the match is not paused. Attached is the server log, will continue with attempting fixed timer max pauses. I will attach this to the issue once I'm done testing as well Also, admins force pausing the match have it failed to pause even with using sm_pause:
Test Case Two45 second fixed
serverlog_fixed_pause_time_45.log Test Case Threeget5_max_pause_time "0" The first timeout is incorrect as it's showing 0/4 timeouts (this currently happens in development!), second timeout shows 2/4. Admins are unable to pause and tech pauses do not happen but the counter is shown to be counting upwards in the LogDebugs until match start, or until someone else calls a Attached below is the log file. I think hooking into the mp_pause/unpause may not be the play here, due to the fact ServerCommand will always call the hook which immediately prevents it from working as intended. I believe all of the following test cases should work as intended:
The issue right now with this PR as well, is that the underlying I hope this test case helps, and if you need me to test more I can rig up these cases again and keep testing for intended behaviour :) Edit: Was thinking about this further, and I think we just have to make a design decision as well in regards to these three cvars - Thanks! |
9a9ef34
to
f251f4a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! After discord talks and testing, we even squashed a few bugs in relation to the UI timeout not updating properly. Looks a lot cleaner and everything is working as intended.
So I'm fairly certain everthing works as we want it to now. Please give this a run, @PhlexPlexico. I've tested it pretty extensively myself. I've managed to merge the timer callback function for both types of pauses and reduce a lot of code that was essentially the same. Remember to copy in translations; I added a bunch more. Also: Squashed and force-pushed. Edit: Something to consider. We currently just track a tech pause's length and reset these trackers on unpause. There is no "combined tech pause" time, which is slightly inconsistent compared to tactical pauses, but if this is what we want, then it does work as intended.
|
4595e3e
to
bfb4aaa
Compare
90e3f6c
to
a91af96
Compare
Overall this still looks good to me. I'll test this tomorrow. In regards to the inconsistencies with tech pause time tracking and max tactical pauses, this is intentional. I believe the tracked timing is more of an independent Get5 features, where technical pauses already had precedence in the way it's implemented (right now, it's identical to ESEA), and was requested to be implemented like this by users. So I believe we should keep it as is :) |
Okay, so we can get rid of the array-logic for technical pause time and just use a single counter like we do with the fixed pause timer. If it's not supposed to track time used per team, we don't need another variable for it. |
003c5a6
to
ae4c189
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
7c469a7
to
3b49042
Compare
scripting/get5/pausing.sp
Outdated
@@ -1,8 +1,17 @@ | |||
public bool Pauseable() { | |||
return g_GameState >= Get5State_KnifeRound && g_PausingEnabledCvar.BoolValue; | |||
return g_GameState == Get5State_Live && g_PausingEnabledCvar.BoolValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Game can now only be paused when live. If you want a pause during knife, you must wait until live freezetime. I'm not 100% sure we want this, but it seems like calling a pause right after you readied your team is stupid. Admin can always pause.
Things can change in the 20 seconds between the match officially begins and the knife freeze time. I would rather this change not be made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's also fine to let this go back to >=knife. I originally made this change to reduce logical complexity when refactoring, but it's been cleaned up so much that I don't see a problem with this. I'll just have to test it once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think one other test that should be done is to check the warmup countdown right after the knife decision, as that reduces the amount of fixed pauses a team has per half, as reported here, without pausing the game - #647 so maybe test this as well, just in case this still happens then? I think with this refactoring, that may no longer be an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that the game is restarted when the knife round ends, which I think unpauses? Will have to test.
It might actually be a bit of a problem to work around if that is in fact the case. @splewis is it a big deal to just let people pause in the freeze time after going live? They're going to end up paused at the same stage anyway, they just can't do it while still knifing for sides.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, the problem is of course if you want to pause in the knife freezetime? Because yea, we wouldn't allow that currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be solvable by changing the if to if (g_GameState >= Knife && g_GameState != WaitingForKnifeDecision)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove g_PauseTimeUsed Only fire necessary timers Ensure fixed pause configuration takes precedence over combined max pause time Redirect sm_tech to admin pause if used in console Prevent direct calls to mp_pause_match and mp_unpause_match, force sm_pause/sm_unpause Remove g_TeamGivenTechPauseCommand array Add g_PausingTeam and g_PauseType to debug output Prevent multiple pauses from being triggered at the same time Prevent spectators and team none from ever calling pause or unpause Renamed g_MaxTechPauseTime to g_MaxTechPauseDurationCvar for consistency Renamed g_MaxPausesCvar to g_MaxTacticalPausesCvar for consistency Renamed g_TechPausedTimeOverride to g_TechnicalPauseTimeUsed, as that's what it is Renamed g_TeamPauseTimeUsed to g_TacticalPauseTimeUsed Renamed g_TechPauseTimeUsed to g_TechnicalPauseTimeUsed Renamed g_TeamPausesUsed to g_TacticalPausesUsed Renamed g_TeamTechPausesUsed to g_TechnicalPausesUsed Add print-to-all localized hints for all pauses, ditched the in-game pause state as it's buggy Add util function for converting seconds to minutes:seconds Ensure unpausing when loading a match Refactored translations and removed redundant chat-text Allow admin to pause even if pausing is disabled Add team name to max pause/pause time used. Add backup pause type hint Add stop command not enabled translation Don't allow stop command during admin pause Automatically unpause if max pauses get set to a lower value than already consumed while a pause is active Adjust danish translations Adjust game state pause permissions
* Progress with documentation * link get5_scrim to scrim template * Fix "Client x is not in game" error on player disconnect * Minor doc updates * Use user ID in player object (splewis#776) * Use the user ID in the stat-tracking logic for grenades, as this is unique within the scope of the server. Avoids having to compare steamID strings. * Fix coaching problems generated by `ChangeClientTeam` in 0.9 (splewis#775) Fix coach placement problems related to auto-joining of teams. * Also remove player from coaches when removed from teams (splewis#778) * Fix typo in translation string (splewis#779) * Add !tac alias for !pause (splewis#782) * Adjust EnsurePausedWarmup and renamed it to EnsureIndefiniteWarmup (splewis#777) * Remove extraneous calls to mp_warmup_pausetimer 1 and mp_do_warmup_period 1 in EnsurePausedWarmup * Rename EnsurePausedWarmup to more appropriate EnsureIndefiniteWarmup since no pausing takes place * Doc progress * Attempt to fix relation resolution in docs index page (/get5 problem) * Hook bots to damage taken (splewis#785) * Fix suicide logic (again) (splewis#787) Add bomb parameter to player death event Make attacker and weapon nullable on player death event Add self to array of victims for grenades * Suicide stat was not being used at all Refactor suicide logic again * Once again fixing suicide because molotovs are weapon id 0 (thanks valve) Fix bad hooking of SDKHook_OnTakeDamageAlive when bots are in the game * SDKHook on plugin reload (splewis#789) Allow bots to be in damage report Don't increment stats for bots Fix SDK rehooking on plugin reload * Clean up pause time counter logic: (splewis#784) Remove g_PauseTimeUsed Only fire necessary timers Ensure fixed pause configuration takes precedence over combined max pause time Redirect sm_tech to admin pause if used in console Prevent direct calls to mp_pause_match and mp_unpause_match, force sm_pause/sm_unpause Remove g_TeamGivenTechPauseCommand array Add g_PausingTeam and g_PauseType to debug output Prevent multiple pauses from being triggered at the same time Prevent spectators and team none from ever calling pause or unpause Renamed g_MaxTechPauseTime to g_MaxTechPauseDurationCvar for consistency Renamed g_MaxPausesCvar to g_MaxTacticalPausesCvar for consistency Renamed g_TechPausedTimeOverride to g_TechnicalPauseTimeUsed, as that's what it is Renamed g_TeamPauseTimeUsed to g_TacticalPauseTimeUsed Renamed g_TechPauseTimeUsed to g_TechnicalPauseTimeUsed Renamed g_TeamPausesUsed to g_TacticalPausesUsed Renamed g_TeamTechPausesUsed to g_TechnicalPausesUsed Add print-to-all localized hints for all pauses, ditched the in-game pause state as it's buggy Add util function for converting seconds to minutes:seconds Ensure unpausing when loading a match Refactored translations and removed redundant chat-text Allow admin to pause even if pausing is disabled Add team name to max pause/pause time used. Add backup pause type hint Add stop command not enabled translation Don't allow stop command during admin pause Automatically unpause if max pauses get set to a lower value than already consumed while a pause is active Adjust danish translations Adjust game state pause permissions * Bring Danish translations up to speed. * CI Integration For Releases/Nightlies (splewis#773) Add support for automatic pre-release and release builds on GitHub Actions * Update version number to include a commit hash through Actions. (splewis#790) CI adjustments Add changelog * Nightly tags (#24) * Add release.yml to generate release notes. * Adjust changelogs. * Nightly tags (#25) * Add release.yml to generate release notes. * Adjust changelogs. * Test changelogs. * Add release.yml to generate release notes. (#26) Co-authored-by: Nicolai Cornelis <nickdnk@hotmail.com> Co-authored-by: Nicolai Cornelis <nickdnk@users.noreply.github.com>
* Progress with documentation * link get5_scrim to scrim template * Fix "Client x is not in game" error on player disconnect * Minor doc updates * Use user ID in player object (#776) * Use the user ID in the stat-tracking logic for grenades, as this is unique within the scope of the server. Avoids having to compare steamID strings. * Fix coaching problems generated by `ChangeClientTeam` in 0.9 (#775) Fix coach placement problems related to auto-joining of teams. * Also remove player from coaches when removed from teams (#778) * Fix typo in translation string (#779) * Add !tac alias for !pause (#782) * Adjust EnsurePausedWarmup and renamed it to EnsureIndefiniteWarmup (#777) * Remove extraneous calls to mp_warmup_pausetimer 1 and mp_do_warmup_period 1 in EnsurePausedWarmup * Rename EnsurePausedWarmup to more appropriate EnsureIndefiniteWarmup since no pausing takes place * Doc progress * Attempt to fix relation resolution in docs index page (/get5 problem) * Hook bots to damage taken (#785) * Fix suicide logic (again) (#787) Add bomb parameter to player death event Make attacker and weapon nullable on player death event Add self to array of victims for grenades * Suicide stat was not being used at all Refactor suicide logic again * Once again fixing suicide because molotovs are weapon id 0 (thanks valve) Fix bad hooking of SDKHook_OnTakeDamageAlive when bots are in the game * SDKHook on plugin reload (#789) Allow bots to be in damage report Don't increment stats for bots Fix SDK rehooking on plugin reload * Clean up pause time counter logic: (#784) Remove g_PauseTimeUsed Only fire necessary timers Ensure fixed pause configuration takes precedence over combined max pause time Redirect sm_tech to admin pause if used in console Prevent direct calls to mp_pause_match and mp_unpause_match, force sm_pause/sm_unpause Remove g_TeamGivenTechPauseCommand array Add g_PausingTeam and g_PauseType to debug output Prevent multiple pauses from being triggered at the same time Prevent spectators and team none from ever calling pause or unpause Renamed g_MaxTechPauseTime to g_MaxTechPauseDurationCvar for consistency Renamed g_MaxPausesCvar to g_MaxTacticalPausesCvar for consistency Renamed g_TechPausedTimeOverride to g_TechnicalPauseTimeUsed, as that's what it is Renamed g_TeamPauseTimeUsed to g_TacticalPauseTimeUsed Renamed g_TechPauseTimeUsed to g_TechnicalPauseTimeUsed Renamed g_TeamPausesUsed to g_TacticalPausesUsed Renamed g_TeamTechPausesUsed to g_TechnicalPausesUsed Add print-to-all localized hints for all pauses, ditched the in-game pause state as it's buggy Add util function for converting seconds to minutes:seconds Ensure unpausing when loading a match Refactored translations and removed redundant chat-text Allow admin to pause even if pausing is disabled Add team name to max pause/pause time used. Add backup pause type hint Add stop command not enabled translation Don't allow stop command during admin pause Automatically unpause if max pauses get set to a lower value than already consumed while a pause is active Adjust danish translations Adjust game state pause permissions * Bring Danish translations up to speed. * CI Integration For Releases/Nightlies (#773) Add support for automatic pre-release and release builds on GitHub Actions * Update version number to include a commit hash through Actions. (#790) CI adjustments Add changelog * Add release.yml to generate release notes. (#791) * Remove Weapon nullability because of molotovs being ID 0. (#792) * Consider "scrim" and "manual" matchID to be the same as no match ID in MySQL context (#795) * Adjust Danish * Simplify suicide logic (#798) Refactor suicide logic to be simpler. * Add build output from pull requests (#799) Adjust output filenames to match version Set commit length to 7 instead of 6 to match changelog tags Pr head sha for PR build * Add function to check for new version of get5 (#786) Add dev/prerelease warning * Docs almost done (#800) * Fix coach game prop when reconnect or calling !stop from match. (#802) Co-authored-by: PhlexPlexico <flexing@phlexplexi.co>
Remove g_PauseTimeUsed Only fire necessary timers Ensure fixed pause configuration takes precedence over combined max pause time Redirect sm_tech to admin pause if used in console Prevent direct calls to mp_pause_match and mp_unpause_match, force sm_pause/sm_unpause Remove g_TeamGivenTechPauseCommand array Add g_PausingTeam and g_PauseType to debug output Prevent multiple pauses from being triggered at the same time Prevent spectators and team none from ever calling pause or unpause Renamed g_MaxTechPauseTime to g_MaxTechPauseDurationCvar for consistency Renamed g_MaxPausesCvar to g_MaxTacticalPausesCvar for consistency Renamed g_TechPausedTimeOverride to g_TechnicalPauseTimeUsed, as that's what it is Renamed g_TeamPauseTimeUsed to g_TacticalPauseTimeUsed Renamed g_TechPauseTimeUsed to g_TechnicalPauseTimeUsed Renamed g_TeamPausesUsed to g_TacticalPausesUsed Renamed g_TeamTechPausesUsed to g_TechnicalPausesUsed Add print-to-all localized hints for all pauses, ditched the in-game pause state as it's buggy Add util function for converting seconds to minutes:seconds Ensure unpausing when loading a match Refactored translations and removed redundant chat-text Allow admin to pause even if pausing is disabled Add team name to max pause/pause time used. Add backup pause type hint Add stop command not enabled translation Don't allow stop command during admin pause Automatically unpause if max pauses get set to a lower value than already consumed while a pause is active Adjust danish translations Adjust game state pause permissions
mp_pause_match
ormp_unpause_match
directly as those mess with the pause logicg_
variables to be more consistent and removed some that are no longer needed.g_MaxTechPauses
to haveg_MaxTechPausesCvar
like the rest of cvarspause_type
to the unpause event object!unpause
if a pause was called during a round; you must now wait until freezetime and the pause count will be correctly consumed. The opposing team, however, can call!unpause
immediately if they just want to unpause as soon as the pausing team does.