bug: surrender winner, workshop cvar overrides, knife timeout resolution - #169
Merged
Conversation
Surrender resolution was keyed off lineup.name compared against "CT" / "TERRORIST", which never matched, so every surrender fell through to lineup_2 and handed the win to whichever team happened to be lineup 2. It now resolves the lineup by the side it is currently playing, side swaps included, and passes the winning lineup id through to UpdateMapStatus so the API records a winner instead of a surrendered map with no winner at all. Also in this change: - Re-apply the timeout, overtime, halftime and pause cvars that workshop maps block, with per-match overrides honored - Retry PauseMatch while a tactical timeout is active instead of dropping the pause - Refuse .resume while a team is empty - Resolve the knife round winner when the round ends on TimeRanOut - Auto-resume once every expected player has reconnected - Announce map conclusion vs match conclusion based on whether another map is queued - Disable friendly fire for the knife round Applied to both the CounterStrikeSharp and Swiftly plugins.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every change here is applied to both the CounterStrikeSharp and Swiftly plugins.
Pairs with the API and web branches of the same name.
Surrender awarded the win to the wrong team
The headline fix.
Surrender()resolved the winning lineup by comparinglineup.nameagainst"CT"and"TERRORIST".lineup.nameis the team's display name — "Theft's Team" — so the comparison was never true. Every surrender fell through to thelineup_2branch and handed the win to whichever team happened to be lineup 2, regardless of who actually forfeited.Two changes:
TeamUtility.GetLineupSide(matchData, currentMap, lineupId, roundsPlayed), so side swaps are accounted for.Surrender()now takes the team that wins, not the team giving up. The vote site passes the opposite team in. This reads backwards at the call site if you are not expecting it, so it is called out in a comment where it matters.The winning lineup id is also passed through to
UpdateMapStatus(eMapStatus.Surrendered, lineup_id). Without it the API recorded the map as surrendered with no winner at all.Workshop maps blocking convars
Workshop maps refuse a set of convars outright with
DISALLOWED WORKSHOP CONVAR, which silently left matches running with wrong timeout, overtime and pause behaviour.MatchManagernow carries aWorkshopBlockedCvarstable and re-applies them after map load:mp_team_timeout_timemp_team_timeout_maxmp_overtime_limitmp_halftime_pausematchmp_competitive_endofmatch_extra_timesv_pausablePer-match overrides are honored — if the match config sets one of these, that value wins.
Pause, timeout and resume
PauseMatchdropped the pause when a tactical timeout was active.mp_pause_matchdoes not take during a native timeout. It now retries, up to 20 attempts, whileIsTimeoutActive()..resumeis refused while a team is empty, so a match cannot be resumed into an empty server.Knife round ending on the timer
If the knife round ran out the clock,
RoundEndfired witheWinReason.TimeRanOutand no winner was recorded — the knife round just hung.ResolveTimedOutKnifeWinner(reported)now resolves it from the reported winner when the round ends that way.Also:
mp_friendlyfire 0for the knife round. A blanket toggle is fine here because knife-round damage can only ever come from a knife, unlike the live match which needs per-source filtering to keep grenade friendly fire working. The match-type cfg re-exec inStartLiverestores it to1.Match vs map conclusion
GameEndannounced the same thing whether a map had finished or the whole match had. It now keys the announcement on whether another map is queued.Entities
FiveStackMatchgainsis_tournament_match,is_draft_matchandcancels_at, all of which the API already sends oncurrent-match/:serverId.