Repository navigation
Read the game-mode and teammate cvars through the typed ConVar<T> API [patch] - #86
Open
matt-edmondson wants to merge 4 commits into
Open
matt-edmondson wants to merge 4 commits into
matt-edmondson wants to merge 4 commits into
Conversation
… [patch] CounterStrikeSharp 1.0.379 marks the untyped ConVar obsolete, so a Debug build of the plugin failed with 6 x CS0618. Look up mp_teammates_are_enemies as ConVar<bool> and game_type / game_mode as ConVar<int>, the cvars' native types in CS2, and read them through Value. Fixes #83 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW4d7dbQrUhkrt4JoGT
…s again [patch] Dependabot #81 bumped Microsoft.Extensions.Logging.Abstractions to 11.0.0 and added a direct reference to it in Core, which doesn't use it. The reference flowed into the Site and replaced the ASP.NET Core 10 shared-framework copy, so ktsu.Sdk failed the Site build with KTSU0006. Remove the reference, put the central version back to 10.0.0 to match the host and the framework, and keep Dependabot from proposing major bumps of Microsoft.Extensions.* on their own. Fixes #82 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW4d7dbQrUhkrt4JoGT
Contributor
Author
|
#85 already fixes it, so I've cherry-picked that commit here ( Generated by Claude Code |
Resolve Directory.Packages.props: take main's ktsu.Semantics.Strings 6.0.0 and keep Microsoft.Extensions.Logging.Abstractions 10.0.0 from #85. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5B3W6WRadY4oRm8a7
Takes main's MySqlConnector 3.0.0 and the 10.0.15 Logging.Abstractions pin from #85, the floor MySqlConnector 3.0.0 needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW55E1qd6SA7hhzHqoF
|
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.



Fixes #83
What was wrong
CounterStrikeSharp 1.0.379 (bumped in #69) marks the untyped
ConVar[Obsolete("Use ConVar<T> instead")]. Debug builds treat warnings as errors, so the plugin's documenteddotnet build CounterStrikeProgression/CounterStrikeProgression.csprojfailed with 6 × CS0618 inGameState.csandSite/SiteReporter.cs.Change
GameState.TeammatesAreEnemiesusesConVar<bool>.Find("mp_teammates_are_enemies")and reads.Value.SiteReporter.CollectBatchusesConVar<int>.Find("game_type")/ConVar<int>.Find("game_mode")and reads.Value.?? false/?? 0fallbacks for a missing cvar are unchanged.ConVar<T>.Findreturns null when the name isn't registered, asConVar.Finddid.No
[SuppressMessage]was needed.Reviewer note: unlike
GetPrimitiveValue<T>,ConVar<T>.ValuechecksTagainst the cvar's native type. It throwsInvalidOperationExceptionon a mismatch (I read this from the 1.0.379 assembly). The types used here are those cvars' CS2 types:mp_teammates_are_enemiesis Bool, andgame_type/game_modeare Int32. They are also the types the old code already read them as. I couldn't run this against a live CS2 server, so the in-game read is unverified.Also carries #85
main's Site doesn't build until #82 is fixed (KTSU0006). That kept this PR's CI from reaching the tests, so this branch also carries #85's commit. After merging main (MySqlConnector 3.0.0, #92),
Directory.Packages.propshere is identical to #85's: MySqlConnector 3.0.0 and Logging.Abstractions 10.0.15, the floor MySqlConnector 3.0.0 needs. So whichever PR merges first, the other still merges cleanly.Verification
2a7d412), the Debug plugin build fails with 6 × CS0618. On this branch, after merging main, it builds with 0 warnings and 0 errors, and the Release solution build has 0 errors.dotnet test --project CounterStrikeProgression.Test -c Release: 748 total, 741 passed, 7 MySQL skipped, 0 failed.🤖 Generated with Claude Code
https://claude.ai/code/session_017vfJW55E1qd6SA7hhzHqoF