Compare commits

...

46 Commits

Author SHA1 Message Date
Michael Wilson
25ca5dbe0c chore: use offsets for give named item (#427) 2024-04-27 19:56:07 +10:00
Nexd
7cae4be96d Fix: new game update broke signatures (#425)
Co-authored-by: KillStr3aK <KillStr3aK@users.noreply.github.com>
Co-authored-by: Roflmuffin <shortguy014@gmail.com>
2024-04-26 16:29:38 +10:00
Nexd
83bc1a95fb Make shared type loader less strict (#424)
Co-authored-by: KillStr3aK <KillStr3aK@users.noreply.github.com>
2024-04-26 10:26:39 +10:00
roflmuffin
71c694b52e [no ci] add windows install script 2024-04-14 13:25:43 +10:00
Michael Wilson
a452d79ba3 [no ci] feat: add install script 2024-04-14 12:58:24 +10:00
Nukoooo
dfc9859806 Make signature support IDA/x64Dbg style (#407)
Co-authored-by: Michael Wilson <roflmuffin@users.noreply.github.com>
2024-04-13 12:11:26 +10:00
Nukoooo
f99f58402a Add mising `GameData.GetSignature to NetworkStateChangedFunc` (#415) 2024-04-13 11:00:51 +10:00
Michael Wilson
6317559bd2 [no ci] Update .clang-format & add formatting tool install scripts (#410) 2024-04-12 12:36:39 +10:00
Michael Wilson
ad6e1ca2e2 chore: bump hl2sdk (#408) 2024-04-11 18:15:50 +10:00
Michael Wilson
2564ef9f39 fix: fix startup server listener 2024-04-11 16:14:16 +10:00
Michael Wilson
83a341d3cf feat: expose TargetTypeMap 2024-04-11 15:34:01 +10:00
Michael Wilson
534fc42444 fix: bad commit 2024-04-11 14:26:21 +10:00
Michael Wilson
41355d05fa docs: add more comments to base plugin 2024-04-11 14:20:24 +10:00
luxury fabka
d9da15be83 Add teleport overloads (#399)
Co-authored-by: Michael Wilson <roflmuffin@users.noreply.github.com>
2024-04-11 00:48:55 +00:00
B3none
75e2f6e8aa [no ci] Rename ACKNOWLEDGEMENTS to ACKNOWLEDGEMENTS.md (#401) 2024-04-10 16:34:15 +10:00
Michael Wilson
37b34e1d41 [no ci] add basic contributing guide 2024-04-08 10:02:18 +10:00
WidovV
5ce04649fd Add CenterHtmlMenu button colors (#398) 2024-04-06 21:43:38 +10:00
Michael Wilson
7b7202fe8a [no ci] Update README.md 2024-04-05 11:54:53 +10:00
Michael Wilson
cadb817ed2 fix: mark center html menu constructor as obsolete, throw error (#396) 2024-04-04 09:33:22 +10:00
luxury fabka
211516cce5 added Open method to each menu type (#385)
Co-authored-by: Michael Wilson <roflmuffin@users.noreply.github.com>
Co-authored-by: Roflmuffin <shortguy014@gmail.com>
2024-04-01 18:04:12 +10:00
Roflmuffin
ab211a42e6 [skip ci] chore: update ApiCompat to v202, disable suppression file 2024-03-26 12:46:42 +10:00
Roflmuffin
696ecadee4 fix: bad vector math 2024-03-26 12:16:53 +10:00
Roflmuffin
e4d598dba8 fix: main version number 2024-03-25 17:15:31 +10:00
Michael Wilson
5c67d88844 feat: improve version stamping (#389) 2024-03-25 17:11:16 +10:00
Michael Wilson
9d8b6beae6 .NET8 Upgrade (#261)
Co-authored-by: Frederik St-Onge <frederik.stonge@gmail.com>
Co-authored-by: B3none <24966460+B3none@users.noreply.github.com>
2024-03-25 14:16:32 +10:00
ipsvn
39604b7ad7 Fix backwards compatibility in DynamicHook (#388) 2024-03-22 23:04:09 +10:00
luxury fabka
1b1f1d04dd minor menu changes (#373)
Co-authored-by: Michael Wilson <roflmuffin@users.noreply.github.com>
Co-authored-by: Roflmuffin <shortguy014@gmail.com>
2024-03-18 05:00:31 +00:00
Ian Lucas
dbc348c1bf Add RemoveAll method to NetworkedVector class (#380) 2024-03-18 14:56:29 +10:00
Michael Wilson
d295589c44 fix: update collision groups (#376) 2024-03-13 16:10:42 +10:00
Michael Wilson
16767fd494 feat: add Server.RunOnTick method which allows tick scheduling (#374) 2024-03-11 23:08:54 +10:00
roflmuffin
36a97bfffd fix: disable autoload plugin but allow shared library loading 2024-03-09 15:29:45 +10:00
roflmuffin
178f7472c6 feat: add PluginAutoLoadEnabled config option
closes #370
2024-03-09 14:29:43 +10:00
luxury fabka
cba5144bbf remove unused arguments (#334)
Co-authored-by: Michael Wilson <roflmuffin@users.noreply.github.com>
2024-03-08 05:08:33 +00:00
roflmuffin
0de951cb6f fix: allows game events to be freed, frees event in print to center html
closes #346
2024-03-08 10:39:59 +10:00
Michael Wilson
c3d44a87bc feat: use concurrent queue for next frame & world update tasks (#365) 2024-03-06 21:08:22 +10:00
B3none
bd3c0c76e3 [no ci] Update minimum api version for shared api docs (#364) 2024-03-06 15:42:34 +10:00
Yarukon
656c0e3a84 Fix TerminateRound params (#363) 2024-03-04 10:59:02 +00:00
Michael Wilson
40c842149c fix: add error handling to OnAllPluginsLoaded 2024-03-04 17:21:50 +10:00
roflmuffin
64d1c0a9f4 chore: remove erroneous log 2024-03-04 16:56:49 +10:00
roflmuffin
a6de51c444 fix: use concurrent dictionary for function reference 2024-03-04 13:41:18 +10:00
roflmuffin
2535ac0575 feat: add assembly name lazy loading of shared libraries 2024-03-04 12:15:37 +10:00
Michael Wilson
bc61323315 chore: migrate to protobufs submodule (#362) 2024-03-04 10:48:52 +10:00
roflmuffin
241817b7f2 feat: update game events dump from Feb 14 update 2024-03-04 10:34:58 +10:00
BuSheeZy
fbcdce34fc fix: allow empty overrides to skip checks (#357)
Co-authored-by: Michael Wilson <roflmuffin@users.noreply.github.com>
2024-03-04 00:13:17 +00:00
Michael Wilson
daf0d25f36 Shared Plugin APIs/Capabilities (#253)
Co-authored-by: B3none <ablackham2000@gmail.com>
Co-authored-by: B3none <24966460+B3none@users.noreply.github.com>
2024-03-04 09:45:34 +10:00
Yarukon
12485be29f Adding the proper way to do resource precache (#358) 2024-03-02 15:10:37 +10:00
155 changed files with 107430 additions and 103857 deletions

View File

@@ -1,21 +1,72 @@
BasedOnStyle: LLVM
# Spacing
IndentWidth: 4
ColumnLimit: 100
UseTab: Never
ColumnLimit: 140
# Line Endings
LineEnding: LF
InsertNewlineAtEOF: true
DerivePointerAlignment: false
PointerAlignment: Left
AlignAfterOpenBracket: Align
KeepEmptyLinesAtTheStartOfBlocks: false
SortIncludes: false
SpaceBeforeParens: ControlStatements
AllowAllArgumentsOnNextLine: true
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
IndentCaseLabels: true
# Line Breaks
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterStruct: true
AfterControlStatement: Always
AfterEnum: true
AfterUnion: true
AfterNamespace: false
AfterFunction: true
AfterNamespace: false
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
PointerAlignment: Left
SortIncludes: CaseSensitive
IncludeBlocks: Regroup
IncludeCategories:
# External headers in <> with extension or /
- Regex: '<[-\w\/-_]+[\.\/][-\w\/-_]+>'
Priority: 2
# Standard headers in <>
- Regex: '<[-\w\/-_]+>'
Priority: 3
# Local headers in ""
- Regex: '"[-\w\/-_]*"'
Priority: 4
ReflowComments: true
CompactNamespaces: false
Cpp11BracedListStyle: false
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignEscapedNewlines: Left
AlignTrailingComments: Never
AllowShortBlocksOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: OnlyFirstIf
AllowShortLambdasOnASingleLine: Empty
BinPackArguments: true
BinPackParameters: false
LambdaBodyIndentation: OuterScope

14
.editorconfig Normal file
View File

@@ -0,0 +1,14 @@
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
max_line_length = 140
trim_trailing_whitespace = true
[*.json]
indent_size = 2

View File

@@ -3,22 +3,46 @@ name: Build & Publish
on:
push:
paths-ignore:
- 'docfx/**'
branches: [ "main", "dev" ]
- "docfx/**"
branches: ["main", "dev"]
pull_request:
branches: [ "main", "dev" ]
branches: ["main", "dev"]
env:
BUILD_TYPE: Release
jobs:
setup:
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
buildnumber: ${{ steps.buildnumber.outputs.build_number }}
steps:
- name: Generate build number
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
id: buildnumber
uses: onyxmueller/build-tag-number@v1
with:
token: ${{secrets.github_token}}
build_windows:
needs: setup
runs-on: windows-latest
steps:
- name: Prepare env
shell: bash
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Fallback build number
if: ${{ github.event_name == 'pull_request' || github.ref != 'refs/heads/main' }}
shell: bash
run: echo "BUILD_NUMBER=0" >> $GITHUB_ENV
- name: Main build number
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: echo "BUILD_NUMBER=${{ needs.setup.outputs.buildnumber }}" >> $GITHUB_ENV
- name: Visual Studio environment
shell: cmd
run: |
@@ -34,7 +58,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
submodules: "recursive"
- name: Build
run: |
@@ -56,6 +80,7 @@ jobs:
path: build/output/
build_linux:
needs: setup
runs-on: ubuntu-latest
# Could not figure out how to run in a container only on some matrix paths, so I've split it out into its own build.
container:
@@ -65,9 +90,18 @@ jobs:
shell: bash
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Fallback build number
if: ${{ github.event_name == 'pull_request' || github.ref != 'refs/heads/main' }}
shell: bash
run: echo "BUILD_NUMBER=0" >> $GITHUB_ENV
- name: Main build number
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: echo "BUILD_NUMBER=${{ needs.setup.outputs.buildnumber }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
submodules: 'recursive'
submodules: "recursive"
- name: Build
run: |
@@ -87,11 +121,10 @@ jobs:
path: build/output/
build_managed:
needs: setup
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
buildnumber: ${{ steps.buildnumber.outputs.build_number }}
steps:
- name: Prepare env
shell: bash
@@ -102,20 +135,17 @@ jobs:
shell: bash
run: echo "BUILD_NUMBER=0" >> $GITHUB_ENV
- name: Main build number
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: echo "BUILD_NUMBER=${{ needs.setup.outputs.buildnumber }}" >> $GITHUB_ENV
# We don't need expensive submodules for the managed side.
- uses: actions/checkout@v3
- name: Generate build number
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
id: buildnumber
uses: onyxmueller/build-tag-number@v1
with:
token: ${{secrets.github_token}}
- name: Build runtime v${{ env.BUILD_NUMBER }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
dotnet-version: "8.0.x"
- name: Install dependencies
run: dotnet restore managed/CounterStrikeSharp.sln
@@ -133,7 +163,7 @@ jobs:
- name: Publish artifacts
run: |
dotnet publish -c Release /p:Version=1.0.${{ env.BUILD_NUMBER }} managed/CounterStrikeSharp.API
dotnet pack -c Release /p:Version=1.0.${{ env.BUILD_NUMBER }} managed/CounterStrikeSharp.API
dotnet pack -c Release /p:Version=1.0.${{ env.BUILD_NUMBER }} managed/CounterStrikeSharp.API
- uses: actions/upload-artifact@v3
with:
@@ -144,7 +174,7 @@ jobs:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
permissions:
contents: write
needs: [ "build_linux", "build_windows", "build_managed" ]
needs: ["setup", "build_linux", "build_windows", "build_managed"]
runs-on: ubuntu-latest
steps:
- name: Prepare env
@@ -171,49 +201,48 @@ jobs:
run: |
mkdir -p build/linux/addons/counterstrikesharp/api
mkdir -p build/windows/addons/counterstrikesharp/api
cp -r build/api/net7.0/publish/* build/linux/addons/counterstrikesharp/api
cp -r build/api/net7.0/publish/* build/windows/addons/counterstrikesharp/api
cp -r build/api/net8.0/publish/* build/linux/addons/counterstrikesharp/api
cp -r build/api/net8.0/publish/* build/windows/addons/counterstrikesharp/api
- name: Zip Builds
run: |
(cd build/linux && zip -qq -r ../../counterstrikesharp-build-${{ needs.build_managed.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip *)
(cd build/windows && zip -qq -r ../../counterstrikesharp-build-${{ needs.build_managed.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip *)
(cd build/linux && zip -qq -r ../../counterstrikesharp-build-${{ needs.setup.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip *)
(cd build/windows && zip -qq -r ../../counterstrikesharp-build-${{ needs.setup.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip *)
- name: Add dotnet runtime
run: |
mkdir -p build/linux/addons/counterstrikesharp/dotnet
curl -s -L https://download.visualstudio.microsoft.com/download/pr/dc2c0a53-85a8-4fda-a283-fa28adb5fbe2/8ccade5bc400a5bb40cd9240f003b45c/aspnetcore-runtime-7.0.11-linux-x64.tar.gz \
curl -s -L https://download.visualstudio.microsoft.com/download/pr/c1371dc2-eed2-47be-9af3-ae060dbe3c7d/bd509e0a87629764ed47608466d183e6/aspnetcore-runtime-8.0.3-linux-x64.tar.gz \
| tar xvz -C build/linux/addons/counterstrikesharp/dotnet
mv build/linux/addons/counterstrikesharp/dotnet/shared/Microsoft.NETCore.App/7.0.11/* build/linux/addons/counterstrikesharp/dotnet/shared/Microsoft.NETCore.App/
mkdir -p build/windows/addons/counterstrikesharp/dotnet
curl -s -L https://download.visualstudio.microsoft.com/download/pr/a99861c8-2e00-4587-aaef-60366ca77307/a44ceec2c5d34165ae881600f52edc43/aspnetcore-runtime-7.0.11-win-x64.zip -o dotnet.zip
curl -s -L https://download.visualstudio.microsoft.com/download/pr/086d1dd6-57a5-437a-a1ef-549cf702fb48/dd4a8fe6c53a1016a414d6f2925c1323/aspnetcore-runtime-8.0.3-win-x64.zip -o dotnet.zip
unzip -qq dotnet.zip -d build/windows/addons/counterstrikesharp/dotnet
- name: Zip Builds
run: |
(cd build/linux && zip -qq -r ../../counterstrikesharp-with-runtime-build-${{ needs.build_managed.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip *)
(cd build/windows && zip -qq -r ../../counterstrikesharp-with-runtime-build-${{ needs.build_managed.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip *)
(cd build/linux && zip -qq -r ../../counterstrikesharp-with-runtime-build-${{ needs.setup.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip *)
(cd build/windows && zip -qq -r ../../counterstrikesharp-with-runtime-build-${{ needs.setup.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip *)
- name: Release
id: release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.build_managed.outputs.buildnumber }}
tag_name: v${{ needs.setup.outputs.buildnumber }}
files: |
counterstrikesharp-build-${{ needs.build_managed.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip
counterstrikesharp-with-runtime-build-${{ needs.build_managed.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip
counterstrikesharp-build-${{ needs.build_managed.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip
counterstrikesharp-with-runtime-build-${{ needs.build_managed.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip
counterstrikesharp-build-${{ needs.setup.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip
counterstrikesharp-with-runtime-build-${{ needs.setup.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip
counterstrikesharp-build-${{ needs.setup.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip
counterstrikesharp-with-runtime-build-${{ needs.setup.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip
- name: Publish NuGet package
run: |
dotnet nuget push build/api/CounterStrikeSharp.API.1.0.${{ needs.build_managed.outputs.buildnumber }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push build/api/CounterStrikeSharp.API.1.0.${{ needs.build_managed.outputs.buildnumber }}.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push build/api/CounterStrikeSharp.API.1.0.${{ needs.setup.outputs.buildnumber }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push build/api/CounterStrikeSharp.API.1.0.${{ needs.setup.outputs.buildnumber }}.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Send Notification to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.2
with:
args: "A new release of CS# has been tagged (v${{ needs.build_managed.outputs.buildnumber }}) at ${{ steps.release.outputs.url }}"
args: "A new release of CS# has been tagged (v${{ needs.setup.outputs.buildnumber }}) at ${{ steps.release.outputs.url }}"

3
.gitignore vendored
View File

@@ -1,8 +1,7 @@
.ccls-cache/
.cmake/
cmake-build-debug*/
cmake-build-*/
.kdev4/
.vscode/
generated/
# configure_file auto generated.

6
.gitmodules vendored
View File

@@ -14,12 +14,12 @@
[submodule "libraries/dyncall"]
path = libraries/dyncall
url = https://github.com/LWJGL-CI/dyncall
[submodule "libraries/GameTracking-CS2"]
path = libraries/GameTracking-CS2
url = https://github.com/SteamDatabase/GameTracking-CS2
[submodule "libraries/DynoHook"]
path = libraries/DynoHook
url = https://github.com/qubka/DynoHook
[submodule "libraries/asmjit"]
path = libraries/asmjit
url = https://github.com/asmjit/asmjit
[submodule "libraries/Protobufs"]
path = libraries/Protobufs
url = https://github.com/SteamDatabase/Protobufs

4
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"editor.defaultFormatter": null,
"editor.formatOnSave": true
}

View File

@@ -49,6 +49,8 @@ SET(SOURCE_FILES
src/core/managers/event_manager.cpp
src/core/timer_system.h
src/core/timer_system.cpp
src/core/tick_scheduler.h
src/core/tick_scheduler.cpp
src/scripting/autonative.h
src/scripting/natives/natives_engine.cpp
src/core/engine_trace.h
@@ -68,7 +70,6 @@ SET(SOURCE_FILES
src/core/memory_module.h
src/core/memory_module.cpp
src/core/cs2_sdk/interfaces/cgameresourceserviceserver.h
src/core/cs2_sdk/interfaces/cschemasystem.h
src/core/cs2_sdk/interfaces/cs2_interfaces.h
src/core/cs2_sdk/interfaces/cs2_interfaces.cpp
src/core/cs2_sdk/schema.h
@@ -90,6 +91,8 @@ SET(SOURCE_FILES
src/core/managers/voice_manager.cpp
src/core/managers/voice_manager.h
src/scripting/natives/natives_dynamichooks.cpp
src/core/game_system.h
src/core/game_system.cpp
)
@@ -101,8 +104,8 @@ if (LINUX)
)
endif()
set(PROTO_DIRS -I${CMAKE_CURRENT_SOURCE_DIR}/libraries/GameTracking-CS2/Protobufs)
file(GLOB PROTOS "${CMAKE_CURRENT_SOURCE_DIR}/libraries/GameTracking-CS2/Protobufs/*.proto")
set(PROTO_DIRS -I${CMAKE_CURRENT_SOURCE_DIR}/libraries/Protobufs/csgo)
file(GLOB PROTOS "${CMAKE_CURRENT_SOURCE_DIR}/libraries/Protobufs/csgo/*.proto")
## Generate protobuf source & headers
if (LINUX)

103
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,103 @@
# Contributing to CounterStrikeSharp
We'd love for you to contribute to CS# to make it better than it is today!
Here are the guidelines we'd like you to follow:
- [Question or Problem?](#question)
- [Issues and Bugs](#issue)
- [Submission Guidelines](#submit)
- [Coding Format](#format)
## <a name="question"></a> Got a Question or Problem?
If you have questions about how to contribute to CounterStrikeSharp, please join our [Discord][discord] server.
## <a name="issue"></a> Found an Issue?
If you find a bug in the source code or a mistake in the documentation, you can help us by
submitting an issue to our [GitHub Repository][github]. Even better you can submit a Pull Request
with a fix.
**Please see the [Submission Guidelines](#submit) below.**
## <a name="submit"></a> Submission Guidelines
### Submitting an Issue
Before you submit your issue please search the archive, maybe your question was already answered.
If your issue appears to be a bug and hasn't been reported, open a new issue. Help us to maximize
the effort we can spend fixing issues and adding new features, by not reporting duplicate issues.
Providing the following information will increase the chances of your issue being dealt with
quickly:
* **Overview of the Issue** - if an error is being thrown a stack trace helps
* **Operating System** - is this a problem with a specific OS (Windows or Linux)?
* **Reproduce the Error** - provide details, if possible, on how to reproduce the error
* **Related Issues** - has a similar issue been reported before?
* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be causing the problem (line of code or commit)
### Submitting a Pull Request
Before you submit your pull request consider the following guidelines:
* Search [GitHub](https://github.com/roflmuffin/CounterStrikeSharp/pulls) for an open or closed Pull Request
that relates to your submission. You don't want to duplicate effort.
* If adding a feature or enhancement, we recommend you first [start a discussion for
it](https://github.com/roflmuffin/CounterStrikeSharp/discussions) before submitting a Pull Request.
* [Fork](https://help.github.com/articles/fork-a-repo/) this repo.
* [Clone](https://help.github.com/articles/cloning-a-repository/) your copy.
```shell
git clone https://github.com/YOUR_USERNAME/CounterStrikeSharp.git
cd CounterStrikeSharp/
```
* After cloning, set a new remote [upstream](https://help.github.com/articles/configuring-a-remote-for-a-fork/) (this helps to keep your fork up to date)
```shell
git remote add upstream https://github.com/roflmuffin/CounterStrikeSharp.git
```
* Make your changes in a new git branch:
```shell
git checkout -b my-fix-branch master
```
* Create your patch and run appropriate tests.
* Commit your changes using a descriptive commit message that uses the imperative, present tense: "change" not "changed" nor "changes".
```shell
git commit -a
```
Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
* Push your branch to GitHub:
```shell
git push origin my-fix-branch
```
In GitHub, send a pull request to `CounterStrikeSharp:master`.
If we suggest changes, then:
* Make the required updates.
* Re-run CounterStrikeSharp to ensure everything is still working & tests are passing.
* Commit your changes to your branch (e.g. `my-fix-branch`).
* Push the changes to your GitHub repository (this will update your Pull Request).
If the PR gets too outdated we may ask you to rebase and force push to update the PR:
```shell
git fetch upstream
git rebase upstream/master
git push origin my-fix-branch -f
```
That's it! Thank you for your contribution!
#### After your pull request is merged
After your pull request is merged, you can safely delete your branch and pull the changes
from the main (upstream) repository.
[github]: https://github.com/roflmuffin/CounterStrikeSharp
[discord]: https://discord.gg/eAZU3guKWU

View File

@@ -1,6 +1,6 @@
# CounterStrikeSharp
CounterStrikeSharp is a server side modding framework for Counter-Strike: Global Offensive. This project attempts to implement a .NET Core scripting layer on top of a Metamod Source Plugin, allowing developers to create plugins that interact with the game server in a modern language (C#) to facilitate the creation of maintainable and testable code.
CounterStrikeSharp is a server side modding framework for Counter-Strike 2. This project implements a .NET 8 scripting layer on top of a Metamod Source Plugin, allowing developers to create plugins that interact with the game server in a modern language (C#) to facilitate the creation of maintainable and testable code.
[Come and join our Discord](https://discord.gg/eAZU3guKWU)
@@ -18,14 +18,12 @@ Detailed installation instructions can be found in the [docs](https://docs.cssha
## What works?
_(Note, these were features in the previous VSP.NET project, but have not been implemented yet in this project)_
These features are the core of the platform and work pretty well/have a low risk of causing issues.
- [x] Console Commands, Server Commands (e.g. css_mycommand)
- [x] Chat Commands with `!` and `/` prefixes (e.g. !mycommand)
- [ ] **(In Progress)** Console Variables
- [x] Game Event Handlers & Custom Events (e.g. player_death)
- [x] Fake Console Variables (commands which mimic ConVar behaviour as these have not been fully reverse engineered)
- [x] Game Event Handlers & Firing of Events (e.g. player_death)
- [x] Basic event value get/set (string, bool, int32, float)
- [x] Complex event values get/set (ehandle, pawn, player controller)
- [x] Game Tick Based Timers (e.g. repeating map timers)
@@ -34,7 +32,7 @@ These features are the core of the platform and work pretty well/have a low risk
- [x] Client Listeners (e.g. connect, disconnect, put in server)
- [x] OnMapStart
- [x] OnTick
- [x] Server Information (current map, game time, tick rate, model precaching)
- [x] Server Information (current map, game time)
- [x] Schema System Access (access player values like current weapon, money, location etc.)
## Links

View File

@@ -3,5 +3,6 @@
"SilentChatTrigger": [ "/" ],
"FollowCS2ServerGuidelines": true,
"PluginHotReloadEnabled": true,
"PluginAutoLoadEnabled": true,
"ServerLanguage": "en"
}

View File

@@ -28,8 +28,8 @@
},
"CCSPlayerController_Respawn": {
"offsets": {
"windows": 244,
"linux": 246
"windows": 244,
"linux": 246
}
},
"CBasePlayerController_SetPawn": {
@@ -42,15 +42,15 @@
"CCSPlayerPawnBase_PostThink": {
"signatures": {
"library": "server",
"windows": "\\x48\\x8B\\xC4\\x48\\x89\\x48\\x08\\x55\\x53\\x56\\x57\\x41\\x56\\x48\\x8D\\xA8\\xD8\\xFE\\xFF\\xFF",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x53\\x48\\x89\\xFB\\x48\\x81\\xEC\\x2A\\x2A\\x2A\\x2A\\xE8\\x2A\\x2A\\x2A\\x2A\\x48\\x89\\xDF"
"windows": "\\x48\\x2A\\x2A\\x55\\x53\\x56\\x57\\x41\\x2A\\x48\\x2A\\x2A\\x2A\\x48\\x2A\\x2A\\x2A\\x2A\\x2A\\x2A\\x4C\\x89\\x68",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x56\\x41\\x55\\x41\\x54\\x53\\x48\\x89\\xFB\\x48\\x83\\xEC\\x30\\xE8\\x2A\\x2A\\x2A\\x2A"
}
},
"GiveNamedItem": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x18\\x48\\x89\\x74\\x24\\x20\\x55\\x57\\x41\\x54\\x41\\x56\\x41\\x57\\x48\\x8D\\x6C\\x24\\xD9",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x49\\x89\\xCE\\x41\\x55\\x49\\x89\\xF5\\x41\\x54\\x49\\x89\\xD4"
"windows": "\\x48\\x89\\x5C\\x24\\x2A\\x48\\x89\\x74\\x24\\x2A\\x55\\x57\\x41\\x2A\\x41\\x2A\\x41\\x2A\\x48\\x2A\\x2A\\x2A\\x2A\\x48\\x2A\\x2A\\x2A\\x2A\\x2A\\x2A\\x4D\\x2A\\x2A\\x48",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x49\\x89\\x2A\\x41\\x55\\x49\\x89\\x2A\\x41\\x54\\x2A\\x2A\\x2A\\x2F\\xB6\\x77\\x00"
}
},
"UTIL_Remove": {
@@ -69,9 +69,9 @@
},
"CBaseModelEntity_SetModel": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x2A\\x48\\x89\\x7C\\x24\\x2A\\x55\\x48\\x8B\\xEC\\x48\\x83\\xEC\\x50\\x48\\x8B\\xF9\\x4C\\x8B\\xC2",
"linux": "\\x55\\x48\\x89\\xF2\\x48\\x89\\xE5\\x41\\x54\\x49\\x89\\xFC\\x48\\x8D\\x7D\\xE0\\x48\\x83\\xEC\\x2A\\x48\\x8D\\x05\\x2A\\x2A\\x2A\\x2A\\x48\\x8B\\x30\\x48\\x8B\\x06"
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x2A\\x48\\x89\\x7C\\x24\\x2A\\x55\\x48\\x8B\\xEC\\x48\\x83\\xEC\\x50\\x48\\x8B\\xF9\\x4C\\x8B\\xC2",
"linux": "\\x55\\x48\\x89\\xF2\\x48\\x89\\xE5\\x41\\x54\\x49\\x89\\xFC\\x48\\x8D\\x7D\\xE0\\x48\\x83\\xEC\\x2A\\x48\\x8D\\x05\\x2A\\x2A\\x2A\\x2A\\x48\\x8B\\x30\\x48\\x8B\\x06"
}
},
"CCSPlayer_WeaponServices_CanUse": {
@@ -81,44 +81,50 @@
"linux": "\\x48\\x85\\xF6\\x0F\\x84\\x2A\\x2A\\x2A\\x2A\\x55\\x31\\xC9\\x48\\x89\\xE5\\x41\\x55\\x49\\x89\\xFD"
}
},
"CCSPlayer_ItemServices_GiveNamedItem": {
"offsets": {
"windows": 17,
"linux": 18
}
},
"CCSPlayer_ItemServices_DropActivePlayerWeapon": {
"offsets": {
"windows": 18,
"linux": 19
"windows": 18,
"linux": 19
}
},
"CCSPlayer_ItemServices_RemoveWeapons": {
"offsets": {
"windows": 19,
"linux": 20
}
"offsets": {
"windows": 19,
"linux": 20
}
},
"CGameSceneNode_GetSkeletonInstance": {
"offsets": {
"windows": 8,
"linux": 8
"windows": 8,
"linux": 8
}
},
"CCSGameRules_TerminateRound": {
"signatures": {
"library": "server",
"windows": "\\x48\\x8B\\xC4\\x4C\\x89\\x48\\x20\\x55\\x57",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x81\\xEC\\xE8\\x01\\x00\\x00\\x48\\x8D\\x05\\x2A\\x2A\\x2A\\x2A"
}
"library": "server",
"windows": "\\x48\\x2A\\x2A\\x4C\\x89\\x48\\x2A\\x48\\x89\\x48\\x2A\\x55\\x41",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x81\\xEC\\xE8\\x01\\x00\\x00\\x48\\x8D\\x05\\x2A\\x2A\\x2A\\x2A"
}
},
"UTIL_CreateEntityByName": {
"signatures": {
"library": "server",
"windows": "\\x48\\x83\\xEC\\x48\\xC6\\x44\\x24\\x30\\x00",
"linux": "\\x48\\x8D\\x05\\x2A\\x2A\\x2A\\x2A\\x55\\x48\\x89\\xFA"
}
"library": "server",
"windows": "\\x48\\x83\\xEC\\x48\\xC6\\x44\\x24\\x30\\x00",
"linux": "\\x48\\x8D\\x05\\x2A\\x2A\\x2A\\x2A\\x55\\x48\\x89\\xFA"
}
},
"CBaseEntity_DispatchSpawn": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x10\\x57\\x48\\x83\\xEC\\x30\\x48\\x8B\\xDA\\x48\\x8B\\xF9\\x48\\x85\\xC9",
"linux": "\\x48\\x85\\xFF\\x74\\x2A\\x55\\x48\\x89\\xE5\\x41\\x56"
}
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x10\\x57\\x48\\x83\\xEC\\x30\\x48\\x8B\\xDA\\x48\\x8B\\xF9\\x48\\x85\\xC9",
"linux": "\\x48\\x85\\xFF\\x74\\x2A\\x55\\x48\\x89\\xE5\\x41\\x56"
}
},
"CEntityInstance_AcceptInput": {
"signatures": {
@@ -143,8 +149,8 @@
"CBasePlayerPawn_RemovePlayerItem": {
"signatures": {
"library": "server",
"linux": "\\x55\\x48\\x89\\x2A\\x41\\x2A\\x49\\x89\\x2A\\x41\\x2A\\x49\\x89\\x2A\\xE8\\x2A\\x2A\\x2A\\x2A\\x49\\x39",
"windows": "\\x48\\x85\\xD2\\x0F\\x84\\x2A\\x2A\\x2A\\x2A\\x48\\x89\\x5C\\x24\\x08\\x57\\x48\\x83\\xEC\\x30\\x48\\x8B\\xDA"
"windows": "\\x48\\x2A\\x2A\\x0F\\x84\\x2A\\x2A\\x2A\\x2A\\x48\\x89\\x5C\\x24\\x2A\\x57\\x48\\x2A\\x2A\\x2A\\x48\\x2A\\x2A\\x48\\x2A\\x2A\\xE8",
"linux": "\\x55\\x48\\x89\\x2A\\x41\\x2A\\x49\\x89\\x2A\\x41\\x2A\\x49\\x89\\x2A\\xE8\\x2A\\x2A\\x2A\\x2A\\x49\\x39"
}
},
"CBaseEntity_Teleport": {
@@ -206,5 +212,18 @@
"windows": "\\x4C\\x89\\x4C\\x24\\x20\\x53\\x55\\x57\\x41\\x54\\x41\\x56\\x48\\x81\\xEC",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x49\\x89\\xD4\\x53\\x48\\x89\\xF3\\x48\\x83\\xEC\\x58"
}
},
"IGameSystem_InitAllSystems_pFirst": {
"signatures": {
"library": "server",
"windows": "\\x48\\x8B\\x1D\\x2A\\x2A\\x2A\\x2A\\x48\\x85\\xDB\\x0F\\x84\\x2A\\x2A\\x2A\\x2A\\xBE\\x2A\\x2A\\x2A\\x2A\\x0F\\x1F\\x00\\x48\\x8B\\x7B\\x10",
"linux": "\\x4C\\x8B\\x35\\x2A\\x2A\\x2A\\x2A\\x4D\\x85\\xF6\\x75\\x2D\\xE9\\x2A\\x2A\\x2A\\x2A\\x0F\\x1F\\x40\\x00\\x48\\x8B\\x05"
}
},
"CEntityResourceManifest_AddResource": {
"offsets": {
"windows": 2,
"linux": 2
}
}
}

View File

@@ -0,0 +1 @@
This folder should contain any shared APIs, in the same DLL structure as the plugins folder (MySharedApi/MySharedApi.dll)

View File

@@ -0,0 +1,67 @@
---
title: Shared Plugin API (Capabilities)
description: How to add inter-plugin communication to CounterStrikeSharp plugins.
---
# Shared Plugin API
How to expose and use shared plugin APIs between multiple plugins.
## Creating a Contract Library
Inter-plugin communication requires a contract/shared library that simply exposes the shape of the API, using simple interfaces. e.g.
```csharp
public interface IBalanceHandler
{
decimal Balance { get; }
// These are just here to show that you can have methods on your shared types.
// You could also add a Setter to the Balance property.
public decimal Add(decimal amount);
public decimal Subtract(decimal amount);
}
```
This library ideally should not contain any business logic, and simply define the schema for callers.
This library should be placed in the `shared` subfolder, in the same folder layout as the plugins folder. So if a contract DLL is named `MySharedApi.dll` its file path should be: `shared/MySharedApi/MySharedApi.dll`.
## Creating a Capability
A capability can be declared with a simple static variable in your plugin class. A `PlayerCapability` is a player specific capability, and a `PluginCapability` is generic functionality that a plugin can expose.
```csharp
public static PlayerCapability<IBalanceHandler> BalanceCapability { get; } = new("myplugin:balance");
public static PluginCapability<IBalanceService> BalanceServiceCapability { get; } = new("myplugin:balance_service");
```
For every plugin that wishes to use this new "Balance API", they must ensure they create a capability using the shared API interface (`IBalanceHandler`), as well as use the same name (`myplugin:balance`).
## Registering a Capability
If you are the plugin that is expected to provide the basis of the API (i.e. you are providing a currency/balance plugin which does nothing except store users balances), then you will need to provide the implementation that other callers will use. This is done through the use of static members on the `Capabilities` class:
```csharp
// Player capabilities are given the calling player context
Capabilities.RegisterPlayerCapability(BalanceCapability, player => new BalanceHandler(player));
// Plugin capabilities can simply return an instance of the interface
Capabilities.RegisterPluginCapability(BalanceServiceCapability, () => new BalanceService());
```
### Using Capabilities
To utilise a capability, simply call the `.Get()` method provided on the static capability you declared earlier, i.e.
```csharp
var balance = BalanceCapability.Get(player);
var balanceService = BalanceServiceCapability.Get();
if (balance == null) return;
balance.Add(500);
```
This value _MUST_ be checked for null, as if there are no plugins providing implementations for a given capability, this method will return null, and you must handle this flow in your plugin.

View File

@@ -9,3 +9,6 @@
- name: Global Listeners
href: global-listeners.md
- name: Shared Plugin API
href: shared-plugin-api.md

View File

@@ -9,7 +9,7 @@ How to write your first plugin for CounterStrikeSharp
## Creating a New Project
First, ensure you have the relevant .NET 7.0 SDK for your platform installed on your machine. You can find the links to the latest downloads on the <a href="https://dotnet.microsoft.com/en-us/download/dotnet/7.0" target="_blank"> official Microsoft download page</a>.
First, ensure you have the relevant .NET 8.0 SDK for your platform installed on your machine. You can find the links to the latest downloads on the <a href="https://dotnet.microsoft.com/en-us/download/dotnet/8.0" target="_blank"> official Microsoft download page</a>.
### Creating a Class Library
@@ -25,7 +25,7 @@ Use your IDE (Visual Studio/Rider) to add a reference to the `CounterStrikeSharp
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
@@ -65,7 +65,7 @@ public class HelloWorldPlugin : BasePlugin
}
```
Now build your project using your ide or the `dotnet build` command. You should now have a built binary file in your `bin/Debug/net7.0` subdirectory in the project.
Now build your project using your ide or the `dotnet build` command. You should now have a built binary file in your `bin/Debug/net8.0` subdirectory in the project.
### Installing your Plugin

View File

@@ -33,6 +33,10 @@ receive a ban.
When enabled, plugins are automatically reloaded when their .dll file is updated.
## PluginAutoLoadEnabled
When enabled, plugins are automatically loaded from the plugins directory on server start.
## ServerLanguage
Configures the default language to use for server commands & messages. The format for the culture name based on RFC 4646 is `languagecode2-country`/`regioncode2`, where `languagecode2` is the two-letter language code and `country/regioncode2` is the two-letter subculture code. Examples include `ja-JP` for Japanese (Japan) and `en-US` for English (United States). Defaults to "en".

View File

@@ -0,0 +1,11 @@
[!INCLUDE [WithSharedTypes](../../examples/WithSharedTypes/README.md)]
<a href="https://github.com/roflmuffin/CounterStrikeSharp/tree/main/examples/WithSharedTypes" class="btn btn-secondary">View project on Github <i class="bi bi-github"></i></a>
[!code-csharp[](../../examples/WithSharedTypes/WithSharedTypesPlugin.cs)]
[!INCLUDE [WithSharedTypesConsumer](../../examples/WithSharedTypesConsumer/README.md)]
<a href="https://github.com/roflmuffin/CounterStrikeSharp/tree/main/examples/WithSharedTypesConsumer" class="btn btn-secondary">View project on Github <i class="bi bi-github"></i></a>
[!code-csharp[](../../examples/WithSharedTypesConsumer/WithSharedTypesConsumerPlugin.cs)]

View File

@@ -15,6 +15,8 @@ items:
href: WithGameEventHandlers.md
- name: Database (Dapper)
href: WithDatabase.md
- name: Shared Plugin Types
href: WithSharedTypes.md
- name: Translations
href: WithTranslations.md
- name: Voice Overrides

View File

@@ -0,0 +1,37 @@
# Tool taken from dotnet/runtime
# https://github.com/dotnet/runtime/blob/a8158c170b694f8c1dbae114c63c346b38244901/eng/formatting/download-tools.ps1
function DownloadClangTool {
param (
[string]
$toolName,
[string]
$downloadOutputPath
)
$clangVersion = "17.0.6"
$clangToolsRootUrl = "https://clrjit2.blob.core.windows.net/clang-tools"
$clangPlatform = "windows-x64"
$toolUrl = "$clangToolsRootUrl/$clangVersion/$clangPlatform/$toolName.exe"
$targetPath = "$downloadOutputPath\$toolName.exe"
if (-not $(ls $downloadOutputPath | Where-Object { $_.Name -eq "$toolName.exe" })) {
Write-Output "Downloading '$toolUrl' to '$targetPath'"
# Pass -PassThru as otherwise Invoke-WebRequest leaves a corrupted file if the download fails. With -PassThru the download is buffered first.
# -UseBasicParsing is necessary for older PowerShells when Internet Explorer might not be installed/configured
$null = Invoke-WebRequest -Uri "$toolUrl" -OutFile $(Join-Path $downloadOutputPath -ChildPath "$toolName.exe") -PassThru -UseBasicParsing
}
else {
Write-Output "Found '$targetPath'"
}
}
$downloadPathFolder = Split-Path $PSScriptRoot -Parent | Split-Path -Parent | Join-Path -ChildPath "artifacts" | Join-Path -ChildPath "tools"
mkdir $downloadPathFolder -ErrorAction SilentlyContinue
DownloadClangTool "clang-format" "$downloadPathFolder"
# Add to path to enable scripts to skip additional downloading steps since the tools will already be on the path.
$env:PATH = "$downloadPathFolder;$env:PATH"

View File

@@ -0,0 +1,60 @@
# Tool taken from dotnet/runtime
# https://github.com/dotnet/runtime/blob/a8158c170b694f8c1dbae114c63c346b38244901/eng/formatting/download-tools.sh
#!/usr/bin/env bash
set -ue
source="${BASH_SOURCE[0]}"
# resolve $source until the file is no longer a symlink
while [[ -h "$source" ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
function DownloadClangTool {
clangVersion="17.0.6"
clangToolsRootUrl="https://clrjit2.blob.core.windows.net/clang-tools"
clangPlatform="$(dotnet --info | grep 'RID:')"
clangPlatform="${clangPlatform##*RID:* }"
echo "dotnet RID: ${clangPlatform}"
# override common RIDs with compatible version so we don't need to upload binaries for each RID
case $clangPlatform in
ubuntu.*-x64)
clangPlatform=linux-x64
;;
esac
toolUrl="${clangToolsRootUrl}/${clangVersion}/${clangPlatform}/$1"
toolOutput=$2/$1
echo "Downloading $1 from ${toolUrl} to ${toolOutput}"
if [[ ! -x "$toolOutput" ]]; then
curl --silent --retry 5 --fail -o "${toolOutput}" "$toolUrl"
chmod 751 $toolOutput
fi
if [[ ! -x "$toolOutput" ]]; then
echo "Failed to download $1"
exit 1
fi
}
engFolder="$(cd -P "$( dirname "$scriptroot" )" && pwd )"
downloadPathFolder="$(cd -P "$( dirname "$engFolder" )" && pwd )/artifacts/tools"
mkdir -p "$downloadPathFolder"
DownloadClangTool "clang-format" "$downloadPathFolder"
export PATH=$downloadPathFolder:$PATH

29
eng/formatting/format.sh Normal file
View File

@@ -0,0 +1,29 @@
# Tool taken from dotnet/runtime
# https://github.com/dotnet/runtime/blob/a8158c170b694f8c1dbae114c63c346b38244901/eng/formatting/format.sh
#!/bin/sh
LC_ALL=C
# Select files to format
NATIVE_FILES=$(git diff --cached --name-only --diff-filter=ACM "*.h" "*.hpp" "*.c" "*.cpp" "*.inl" | sed 's| |\\ |g')
MANAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM "*.cs" "*.vb" | sed 's| |\\ |g')
exec 1>&2
if [ -n "$NATIVE_FILES" ]; then
# Format all selected files
echo "$NATIVE_FILES" | cat | xargs | sed -e 's/ /,/g' | xargs "./artifacts/tools/clang-format" -style=file -i
# Add back the modified files to staging
echo "$NATIVE_FILES" | xargs git add
fi
if [ -n "$MANAGED_FILES" ]; then
# Format all selected files
echo "$MANAGED_FILES" | cat | xargs | sed -e 's/ /,/g' | dotnet format whitespace --include - --folder
# Add back the modified files to staging
echo "$MANAGED_FILES" | xargs git add
fi
exit 0

71
eng/install/install.ps1 Normal file
View File

@@ -0,0 +1,71 @@
# Install script that downloads Metamod:Source and Counter-Strike Sharp (with runtime)
$MM_DOWNLOAD_URL = "https://mms.alliedmods.net/mmsdrop/2.0/mmsource-2.0.0-git1286-windows.zip"
$TARGET_DIR = "./game/csgo"
$GAMEINFO_FILE = Join-Path $TARGET_DIR "gameinfo.gi"
$ProgressPreference = 'SilentlyContinue'
# Verification
if (-not (Test-Path $GAMEINFO_FILE)) {
Write-Error "Error: $GAMEINFO_FILE does not exist in the specified directory."
exit 1
}
# GitHub API for Counter-Strike Sharp Releases
$RELEASE_INFO = (Invoke-WebRequest -Uri "https://api.github.com/repos/roflmuffin/CounterStrikeSharp/releases/latest").Content | ConvertFrom-Json
# Filtering download URLs
$CSSHARP_DOWNLOAD_URL = $RELEASE_INFO.assets |
Where-Object { $_.browser_download_url -like '*windows*.zip*' -and $_.browser_download_url -notlike '*with-runtime*' } |
Select-Object -First 1 -ExpandProperty browser_download_url
$CSSHARP_RUNTIME_DOWNLOAD_URL = $RELEASE_INFO.assets |
Where-Object { $_.browser_download_url -like '*windows*.zip*' -and $_.browser_download_url -like '*with-runtime*' } |
Select-Object -First 1 -ExpandProperty browser_download_url
### METAMOD:SOURCE ###
Write-Output "Downloading Metamod:Source..."
Invoke-WebRequest -Uri $MM_DOWNLOAD_URL -OutFile metamod.zip
Write-Output "Extracting Metamod:Source to $TARGET_DIR..."
Expand-Archive -Force -Path metamod.zip -DestinationPath $TARGET_DIR
Remove-Item metamod.zip
### GAMEINFO.GI UPDATE ###
$NEW_ENTRY = " Game csgo/addons/metamod"
$FILE_CONTENT = Get-Content $GAMEINFO_FILE
Write-Output "Updating $GAMEINFO_FILE..."
if ($FILE_CONTENT -contains $NEW_ENTRY) {
Write-Output "The entry '$NEW_ENTRY' already exists in $GAMEINFO_FILE. No changes were made."
} else {
$Pattern = "Game_LowViolence"
$Modified = $false
$NewContent = @()
foreach ($line in $FILE_CONTENT) {
if ($line -match $Pattern -and -not $Modified) {
$NewContent += $line
$NewContent += $NEW_ENTRY
$Modified = $true
} else {
$NewContent += $line
}
}
$NewContent | Set-Content $GAMEINFO_FILE
Write-Host "The file $GAMEINFO_FILE has been modified successfully. '$NEW_ENTRY' has been added."
}
### COUNTER-STRIKE SHARP ###
Write-Output "Downloading Counter-Strike Sharp (with runtime)..."
# Determine if runtime needs to be downloaded
if (-not (Test-Path "./game/csgo/addons/CounterStrikeSharp/dotnet/dotnet.exe")) {
$CSSHARP_DOWNLOAD_URL = $CSSHARP_RUNTIME_DOWNLOAD_URL
}
Invoke-WebRequest -Uri $CSSHARP_DOWNLOAD_URL -OutFile cssharp.zip
Write-Output "Extracting Counter-Strike Sharp to $TARGET_DIR..."
Expand-Archive -Force -Path cssharp.zip -DestinationPath $TARGET_DIR
Remove-Item cssharp.zip

72
eng/install/install.sh Executable file
View File

@@ -0,0 +1,72 @@
#!/bin/bash
# Install script that downloads Metamod:Source and Counter-Strike Sharp (with runtime)
MM_DOWNLOAD_URL="https://mms.alliedmods.net/mmsdrop/2.0/mmsource-2.0.0-git1286-linux.tar.gz"
TARGET_DIR="./game/csgo"
GAMEINFO_FILE="${TARGET_DIR}/gameinfo.gi"
if [ ! -f "${GAMEINFO_FILE}" ]; then
printf "Error: %s does not exist in the specified directory.\n" "$GAMEINFO_FILE"
exit 1
fi
RELEASE_INFO=$(curl -s https://api.github.com/repos/roflmuffin/CounterStrikeSharp/releases/latest)
# Filter and store download URLs
CSSHARP_DOWNLOAD_URL=$(echo "$RELEASE_INFO" | grep -o "browser_download_url.*linux.*\.zip" | cut -d '"' -f 3 | grep -v "with-runtime")
CSSHARP_RUNTIME_DOWNLOAD_URL=$(echo "$RELEASE_INFO" | grep -o "browser_download_url.*linux.*\.zip" | cut -d '"' -f 3 | grep "with-runtime")
### METAMOD:SOURCE ###
printf "Downloading Metamod:Source...\n"
curl -s -L -o metamod.tar.gz "$MM_DOWNLOAD_URL"
if [ $? -eq 0 ]; then
printf "Extracting Metamod:Source to %s...\n" "$TARGET_DIR"
tar -xzf metamod.tar.gz -C "$TARGET_DIR"
rm metamod.tar.gz
else
echo "Download failed. Please check the URL and your connection."
fi
### GAMEINFO.GI UPDATE ###
NEW_ENTRY=" Game csgo/addons/metamod"
printf "Updating %s...\n" "$GAMEINFO_FILE"
if grep -Fxq "$NEW_ENTRY" "$GAMEINFO_FILE"; then
echo "The entry '$(echo $NEW_ENTRY | xargs)' already exists in ${GAMEINFO_FILE}. No changes were made."
else
awk -v new_entry="$NEW_ENTRY" '
BEGIN { found=0; }
// {
if (found) {
print new_entry;
found=0;
}
print;
}
/Game_LowViolence/ { found=1; }
' "$GAMEINFO_FILE" > "$GAMEINFO_FILE.tmp" && mv "$GAMEINFO_FILE.tmp" "$GAMEINFO_FILE"
printf "The file %s has been modified successfully. '%s' has been added.\n" "$GAMEINFO_FILE" "$(echo $NEW_ENTRY | xargs)"
fi
printf "Downloading Counter-Strike Sharp (with runtime)...\n"
# If ./game/csgo/addons/CounterStrikeSharp/dotnet/dotnet does not exist, use the runtime download url
if [ ! -f "./game/csgo/addons/CounterStrikeSharp/dotnet/dotnet" ]; then
CSSHARP_DOWNLOAD_URL="$CSSHARP_RUNTIME_DOWNLOAD_URL"
fi
curl -s -L -o cssharp.zip "$CSSHARP_DOWNLOAD_URL"
if [ $? -eq 0 ]; then
printf "Extracting Counter-Strike Sharp to %s...\n" "$TARGET_DIR"
unzip -q -o cssharp.zip -d "$TARGET_DIR"
rm cssharp.zip
else
echo "Download failed. Please check the URL and your connection."
fi

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

View File

@@ -0,0 +1,11 @@
namespace MySharedTypes.Contracts;
public interface IBalanceHandler
{
decimal Balance { get; }
// These are just here to show that you can have methods on your shared types.
// You could also add a Setter to the Balance property.
public decimal Add(decimal amount);
public decimal Subtract(decimal amount);
}

View File

@@ -0,0 +1,6 @@
namespace MySharedTypes.Contracts;
public interface IBalanceService
{
public void ClearAllBalances();
}

View File

@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

View File

@@ -0,0 +1,33 @@
using CounterStrikeSharp.API.Core;
using MySharedTypes.Contracts;
namespace WithSharedTypes;
public class BalanceHandler : IBalanceHandler
{
private readonly CCSPlayerController _player;
// This could be a database, a file, or a dictionary like this.
internal static readonly Dictionary<CCSPlayerController, decimal> Balances = new();
public BalanceHandler(CCSPlayerController player)
{
_player = player;
}
public decimal Balance
{
get => Balances.TryGetValue(_player, out var balance) ? balance : 0;
set => Balances[_player] = value;
}
public decimal Add(decimal amount)
{
return Balance += amount;
}
public decimal Subtract(decimal amount)
{
return Balance -= amount;
}
}

View File

@@ -0,0 +1,11 @@
using MySharedTypes.Contracts;
namespace WithSharedTypes;
public class BalanceService : IBalanceService
{
public void ClearAllBalances()
{
BalanceHandler.Balances.Clear();
}
}

View File

@@ -0,0 +1,5 @@
# With Shared Types (Capabilities)
An example plugin that exposes a balance contract library, to use as a shared library between multiple plugins.
This allows one plugin to expose a capability for a player or plugin, and other plugins to use the exposed API.

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\managed\CounterStrikeSharp.API\CounterStrikeSharp.API.csproj" />
<ProjectReference Include="..\MySharedTypes.Contracts\MySharedTypes.Contracts\MySharedTypes.Contracts.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,57 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Core.Capabilities;
using MySharedTypes.Contracts;
namespace WithSharedTypes;
[MinimumApiVersion(184)]
public class WithSharedTypesPlugin : BasePlugin
{
public override string ModuleName => "Example: Shared Types";
public override string ModuleVersion => "1.0.0";
public override string ModuleAuthor => "CounterStrikeSharp & Contributors";
public override string ModuleDescription => "A simple plugin that shares types between multiple plugins";
// Declares a player capability, that stores some sort of functionality for a player.
// In this case, it's a balance handler, which is used to store a player's balance.
// Note that we use the same name for the capability as the one in the other plugin.
// IBalanceHandler is defined in MySharedTypes.Contracts, which is a shared library and placed in the `shared/` subfolder.
public static PlayerCapability<IBalanceHandler> BalanceCapability { get; } = new("myplugin:balance");
// Declares a player capability of a primitive type, in this case, a decimal.
public static PlayerCapability<Decimal> BalanceCapabilityDecimal { get; } = new("myplugin:balance_decimal");
// Plugin capabilities are similar to player capabilities, but they are not tied to a player, and are just generic APIs
// that are exposed by a plugin. In this case, we expose a balance service, which is used to clear all balances.
public static PluginCapability<IBalanceService> BalanceServiceCapability { get; } = new("myplugin:balance_service");
public override void Load(bool hotReload)
{
// Register the capability implementations here. Note that plugins don't need to register an implementation if it is already implemented in another plugin.
Capabilities.RegisterPlayerCapability(BalanceCapability, player => new BalanceHandler(player));
Capabilities.RegisterPluginCapability(BalanceServiceCapability, () => new BalanceService());
Capabilities.RegisterPlayerCapability(BalanceCapabilityDecimal, (player) => new BalanceHandler(player).Balance);
AddCommand("css_balance", "Gets your current balance", (player, info) =>
{
if (player == null) return;
player.PrintToChat($"Your balance is {BalanceCapability.Get(player)?.Balance}");
});
AddCommand("css_give", "Gives you money", (player, info) =>
{
if (player == null) return;
var balance = BalanceCapability.Get(player);
if (balance == null) return;
balance.Add(100);
player.PrintToChat($"Your balance is now {balance.Balance}");
});
}
public override void Unload(bool hotReload)
{
}
}

View File

@@ -0,0 +1,2 @@
# With Shared Types (Consumer Plugin)
Uses the decimal balance shared library.

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\managed\CounterStrikeSharp.API\CounterStrikeSharp.API.csproj" />
<ProjectReference Include="..\MySharedTypes.Contracts\MySharedTypes.Contracts\MySharedTypes.Contracts.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,56 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Core.Capabilities;
using CounterStrikeSharp.API.Core.Plugin;
using MySharedTypes.Contracts;
namespace WithSharedTypesConsumer;
[MinimumApiVersion(184)]
public class WithSharedTypesConsumerPlugin : BasePlugin
{
public override string ModuleName => "Example: Shared Types (Consumer)";
public override string ModuleVersion => "1.0.0";
public override string ModuleAuthor => "CounterStrikeSharp & Contributors";
public override string ModuleDescription => "A simple plugin that utilises the balance api from another plugin";
public static PlayerCapability<IBalanceHandler> BalanceCapability { get; } = new("myplugin:balance");
public static PlayerCapability<Decimal> BalanceCapabilityDecimal { get; } = new("myplugin:balance_decimal");
public static PluginCapability<IBalanceService> BalanceServiceCapability { get; } = new("myplugin:balance_service");
public override void Load(bool hotReload)
{
AddCommand("css_subtract", "Subtracts 50 from your balance", (player, info) =>
{
if (player == null) return;
var balance = BalanceCapability.Get(player);
if (balance == null) return;
balance.Subtract(50);
player.PrintToChat($"Your balance is now {balance.Balance}");
});
AddCommand("css_clearbalances", "Clears all balances", (player, info) =>
{
if (player == null) return;
var service = BalanceServiceCapability.Get();
if (service == null) return;
service.ClearAllBalances();
var balance = BalanceCapability.Get(player);
if (balance == null) return;
player.PrintToChat($"Your balance is now {balance.Balance}");
});
AddCommand("css_decimalbalance", "Gets your current balance", (player, info) =>
{
if (player == null) return;
player.PrintToChat($"Your balance is {BalanceCapabilityDecimal.Get(player)}");
});
}
public override void Unload(bool hotReload)
{
}
}

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

1
libraries/Protobufs Submodule

Submodule libraries/Protobufs added at 686a0628e6

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,7 @@ set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING
)
# TODO: Use C++20 instead.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
if (LINUX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
@@ -29,6 +29,18 @@ set(SOURCESDK_LIB ${SOURCESDK}/lib)
add_definitions(-DMETA_IS_SOURCE2)
if(DEFINED ENV{GITHUB_SHA_SHORT})
add_definitions(-DGITHUB_SHA="$ENV{GITHUB_SHA_SHORT}")
else()
add_definitions(-DGITHUB_SHA="Local")
endif()
if(DEFINED ENV{BUILD_NUMBER})
add_definitions(-DBUILD_NUMBER="$ENV{BUILD_NUMBER}")
else()
add_definitions(-DBUILD_NUMBER="0")
endif()
include_directories(
${SOURCESDK}
${SOURCESDK}/thirdparty/protobuf-3.21.8/src
@@ -43,6 +55,7 @@ include_directories(
${SOURCESDK}/public/entity2
${SOURCESDK}/public/game/server
${SOURCESDK}/public/entity2
${SOURCESDK}/public/schemasystem
${METAMOD_DIR}/core
${METAMOD_DIR}/core/sourcehook
libraries/dyncall/dynload
@@ -51,6 +64,7 @@ include_directories(
libraries/tl
libraries/funchook/include
libraries/DynoHook/src
libraries/moodycamel
libraries
)

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

View File

@@ -13,4 +13,14 @@ public class Api
{
return Assembly.GetAssembly(typeof(BasePlugin))!.GetName().Version!.Build;
}
/// <summary>
/// Returns the assembly version of CounterStrikeSharp running on the server as a string including git commit hash
/// </summary>
/// <example>1.0.0+9d8b6be</example>
public static string GetVersionString()
{
return Assembly.GetAssembly(typeof(BasePlugin))!.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!
.InformationalVersion;
}
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -315,16 +315,6 @@ namespace CounterStrikeSharp.API.Core
}
}
public static float GetGameFrameTime(){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.SetIdentifier(0x97E331CA);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
return (float)ScriptContext.GlobalScriptContext.GetResult(typeof(float));
}
}
public static double GetEngineTime(){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
@@ -512,6 +502,17 @@ namespace CounterStrikeSharp.API.Core
}
}
public static void QueueTaskForFrame(int tick, InputArgument callback){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.Push(tick);
ScriptContext.GlobalScriptContext.Push((InputArgument)callback);
ScriptContext.GlobalScriptContext.SetIdentifier(0x2F92C340);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
}
}
public static void QueueTaskForNextWorldUpdate(InputArgument callback){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
@@ -749,6 +750,16 @@ namespace CounterStrikeSharp.API.Core
}
}
public static void FreeEvent(IntPtr gameevent){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.Push(gameevent);
ScriptContext.GlobalScriptContext.SetIdentifier(0x7E8B60C2);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
}
}
public static void FireEvent(IntPtr gameevent, bool dontbroadcast){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
@@ -1085,6 +1096,16 @@ namespace CounterStrikeSharp.API.Core
}
}
public static void RemoveAllNetworkVectorElements(IntPtr vec){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.Push(vec);
ScriptContext.GlobalScriptContext.SetIdentifier(0x67206C08);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
}
}
public static short GetSchemaOffset(string classname, string propname){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();

View File

@@ -106,13 +106,13 @@ namespace CounterStrikeSharp.API.Core
[RequiresPermissions("@css/generic")]
private void OnCSSCommand(CCSPlayerController? caller, CommandInfo info)
{
var currentVersion = Api.GetVersion();
var versionString = $"v{Api.GetVersion()} ({Api.GetVersionString()})";
info.ReplyToCommand(
" CounterStrikeSharp was created and is maintained by Michael \"roflmuffin\" Wilson.\n" +
" Counter-Strike Sharp uses code borrowed from SourceMod, Source.Python, FiveM, Saul Rennison, source2gen and CS2Fixes.\n" +
" See ACKNOWLEDGEMENTS.md for more information.\n" +
" Current API Version: " + currentVersion);
" Current API Version: " + versionString);
return;
}
@@ -130,11 +130,11 @@ namespace CounterStrikeSharp.API.Core
{
var sb = new StringBuilder();
sb.AppendFormat(" [#{0}:{1}]: \"{2}\" ({3})", plugin.PluginId,
plugin.State.ToString().ToUpper(), plugin.Plugin.ModuleName,
plugin.Plugin.ModuleVersion);
if (!string.IsNullOrEmpty(plugin.Plugin.ModuleAuthor))
plugin.State.ToString().ToUpper(), plugin.Plugin?.ModuleName ?? "Unknown",
plugin.Plugin?.ModuleVersion ?? "Unknown");
if (!string.IsNullOrEmpty(plugin.Plugin?.ModuleAuthor))
sb.AppendFormat(" by {0}", plugin.Plugin.ModuleAuthor);
if (!string.IsNullOrEmpty(plugin.Plugin.ModuleDescription))
if (!string.IsNullOrEmpty(plugin.Plugin?.ModuleDescription))
{
sb.Append("\n");
sb.Append(" ");
@@ -175,6 +175,8 @@ namespace CounterStrikeSharp.API.Core
try
{
_pluginManager.LoadPlugin(path);
plugin = _pluginContextQueryHandler.FindPluginByModulePath(path);
plugin.Plugin.OnAllPluginsLoaded(false);
}
catch (Exception e)
{
@@ -185,6 +187,7 @@ namespace CounterStrikeSharp.API.Core
else
{
plugin.Load(false);
plugin.Plugin.OnAllPluginsLoaded(false);
}
break;
@@ -233,6 +236,7 @@ namespace CounterStrikeSharp.API.Core
plugin.Unload(true);
plugin.Load(true);
plugin.Plugin.OnAllPluginsLoaded(true);
break;
}

View File

@@ -73,6 +73,10 @@ namespace CounterStrikeSharp.API.Core
public virtual void Unload(bool hotReload)
{
}
public virtual void OnAllPluginsLoaded(bool hotReload)
{
}
public class CallbackSubscriber : IDisposable
{
@@ -118,9 +122,6 @@ namespace CounterStrikeSharp.API.Core
public readonly Dictionary<Delegate, CallbackSubscriber> CommandListeners =
new Dictionary<Delegate, CallbackSubscriber>();
public readonly Dictionary<Delegate, CallbackSubscriber> ConvarChangeHandlers =
new Dictionary<Delegate, CallbackSubscriber>();
public readonly Dictionary<Delegate, CallbackSubscriber> Listeners =
new Dictionary<Delegate, CallbackSubscriber>();
@@ -155,7 +156,23 @@ namespace CounterStrikeSharp.API.Core
var name = typeof(T).GetCustomAttribute<EventNameAttribute>()?.Name;
RegisterEventHandlerInternal(name, handler, hookMode == HookMode.Post);
}
/// <summary>
/// De-registers a game event handler.
/// </summary>
/// <inheritdoc cref="RegisterEventHandler{T}"/>
public void DeregisterEventHandler<T>(GameEventHandler<T> handler, HookMode hookMode = HookMode.Post) where T : GameEvent
{
var name = typeof(T).GetCustomAttribute<EventNameAttribute>()!.Name;
if (!Handlers.TryGetValue(handler, out var subscriber)) return;
NativeAPI.UnhookEvent(name, subscriber.GetInputArgument(), hookMode == HookMode.Post);
FunctionReference.Remove(subscriber.GetReferenceIdentifier());
Handlers.Remove(handler);
}
[Obsolete("Use the generic version of this method")]
public void DeregisterEventHandler(string name, Delegate handler, bool post)
{
if (!Handlers.TryGetValue(handler, out var subscriber)) return;
@@ -183,6 +200,12 @@ namespace CounterStrikeSharp.API.Core
CommandManager.RegisterCommand(definition);
}
/// <summary>
/// Adds a command listener which will be called before or after the command is executed on the server by a player.
/// </summary>
/// <param name="name">Name of the command, e.g. `jointeam`</param>
/// <param name="handler">Code to run when command is executed. Return <see cref="HookResult.Handled"/> or higher to prevent command execution.</param>
/// <param name="mode">Whether to hook before or after the command is executed.</param>
public void AddCommandListener(string? name, CommandInfo.CommandListenerCallback handler, HookMode mode = HookMode.Pre)
{
var wrappedHandler = new Func<int, IntPtr, HookResult>((i, ptr) =>
@@ -198,6 +221,11 @@ namespace CounterStrikeSharp.API.Core
CommandListeners[handler] = subscriber;
}
/// <summary>
/// Removes a server command.
/// </summary>
/// <param name="name">The name of the command.</param>
/// <param name="handler">The callback function to be invoked when the command is executed.</param>
public void RemoveCommand(string name, CommandInfo.CommandCallback handler)
{
if (CommandHandlers.ContainsKey(handler))
@@ -211,6 +239,10 @@ namespace CounterStrikeSharp.API.Core
}
}
/// <summary>
/// Remove a command listener.
/// </summary>
/// <inheritdoc cref="AddCommandListener"/>
public void RemoveCommandListener(string name, CommandInfo.CommandListenerCallback handler, HookMode mode)
{
if (CommandListeners.ContainsKey(handler))
@@ -224,39 +256,24 @@ namespace CounterStrikeSharp.API.Core
}
}
/*
public void HookConVarChange(ConVar convar, ConVar.ConVarChangedCallback handler)
{
var wrappedHandler = new Action<IntPtr, string, string>((ptr, oldVal, newVal) =>
{
handler?.Invoke(new ConVar(ptr), oldVal, newVal);
});
var subscriber = new CallbackSubscriber(convar, handler, wrappedHandler);
NativeAPI.HookConvarChange(convar.Handle, subscriber.GetInputArgument());
ConvarChangeHandlers[handler] = subscriber;
}
public void UnhookConVarChange(ConVar convar, ConVar.ConVarChangedCallback handler)
{
if (ConvarChangeHandlers.ContainsKey(handler))
{
var subscriber = ConvarChangeHandlers[handler];
NativeAPI.UnhookConvarChange(convar.Handle, subscriber.GetInputArgument());
FunctionReference.Remove(subscriber.GetReferenceIdentifier());
CommandHandlers.Remove(handler);
}
}*/
// Adds global listener, e.g. OnTick, OnClientConnect
/// <summary>
/// Registers a global listener, e.g. <see cref="Listeners.OnTick"/>, <see cref="Listeners.OnClientConnect"/>.
/// </summary>
/// <param name="handler"></param>
/// <typeparam name="T">Listener delegate type</typeparam>
/// <exception cref="ArgumentException">Invalid listener <see cref="T"/> provided</exception>
/// <example>
/// <code lang="C#">
/// RegisterListener&lt;Listeners.OnTick&gt;(OnTick);
/// </code>
/// </example>
public void RegisterListener<T>(T handler) where T : Delegate
{
var listenerName = typeof(T).GetCustomAttribute<ListenerNameAttribute>()?.Name;
if (string.IsNullOrEmpty(listenerName))
{
throw new Exception("Listener of type T is invalid and does not have a name attribute");
throw new ArgumentException("Listener of type T is invalid and does not have a name attribute",
nameof(T));
}
var parameterTypes = typeof(T).GetMethod("Invoke").GetParameters().Select(p => p.ParameterType).ToArray();
@@ -287,6 +304,34 @@ namespace CounterStrikeSharp.API.Core
Listeners[handler] = subscriber;
}
/// <summary>
/// Removes a global listener.
/// </summary>
/// <param name="handler"></param>
/// <typeparam name="T"></typeparam>
/// <exception cref="ArgumentException">Invalid listener <see cref="T"/> provided</exception>
public void RemoveListener<T>(T handler) where T : Delegate
{
var listenerName = typeof(T).GetCustomAttribute<ListenerNameAttribute>()?.Name;
if (string.IsNullOrEmpty(listenerName))
{
throw new ArgumentException("Listener of type T is invalid and does not have a name attribute",
nameof(T));
}
if (!Listeners.TryGetValue(handler, out var subscriber)) return;
NativeAPI.RemoveListener(listenerName, subscriber.GetInputArgument());
FunctionReference.Remove(subscriber.GetReferenceIdentifier());
Listeners.Remove(handler);
}
/// <summary>
/// Removes a global listener.
/// </summary>
/// <param name="name"></param>
/// <param name="handler"></param>
[Obsolete("Use the generic version of this method")]
public void RemoveListener(string name, Delegate handler)
{
if (!Listeners.TryGetValue(handler, out var subscriber)) return;
@@ -296,6 +341,14 @@ namespace CounterStrikeSharp.API.Core
Listeners.Remove(handler);
}
/// <summary>
/// Adds a timer that will call the given callback after the specified amount of seconds.
/// By default will only run once unless the <see cref="TimerFlags.REPEAT"/> flag is set.
/// </summary>
/// <param name="interval">Interval/Delay in seconds</param>
/// <param name="callback">Code to run when timer elapses</param>
/// <param name="flags">Controls if the timer is a one-off, repeat or stops on map change etc.</param>
/// <returns>An instance of the <see cref="Timer"/></returns>
public Timer AddTimer(float interval, Action callback, TimerFlags? flags = null)
{
var timer = new Timer(interval, callback, flags ?? 0);
@@ -303,7 +356,11 @@ namespace CounterStrikeSharp.API.Core
return timer;
}
/// <summary>
/// Registers all attribute handlers on the given instance.
/// Can be used to register event handlers, console commands, entity outputs etc. from classes that are not derived from `BasePlugin`.
/// </summary>
/// <param name="instance"></param>
public void RegisterAllAttributes(object instance)
{
this.RegisterAttributeHandlers(instance);
@@ -338,7 +395,7 @@ namespace CounterStrikeSharp.API.Core
}
/// <summary>
/// Registers all game event handlers that are decorated with the `[GameEventHandler]` attribute.
/// Registers all game event handlers that are decorated with the <see cref="GameEventHandlerAttribute"/> attribute.
/// </summary>
/// <param name="instance">The instance of the object where the event handlers are defined.</param>
public void RegisterAttributeHandlers(object instance)
@@ -368,6 +425,10 @@ namespace CounterStrikeSharp.API.Core
}
}
/// <summary>
/// Registers all console command handlers that are decorated with the <see cref="ConsoleCommandAttribute"/> attribute.
/// </summary>
/// <param name="instance">The instance of the object where the console command handlers are defined.</param>
public void RegisterConsoleCommandAttributeHandlers(object instance)
{
var eventHandlers = instance.GetType()
@@ -395,6 +456,10 @@ namespace CounterStrikeSharp.API.Core
}
}
/// <summary>
/// Registers all entity output handlers that are decorated with the <see cref="EntityOutputHookAttribute"/> attribute.
/// </summary>
/// <param name="instance">The instance of the object where entity output hook handlers are defined.</param>
public void RegisterEntityOutputAttributeHandlers(object instance)
{
var handlers = instance.GetType()
@@ -449,6 +514,12 @@ namespace CounterStrikeSharp.API.Core
RegisterFakeConVars(instance.GetType(), instance);
}
/// <summary>
/// Hooks an <a href="https://developer.valvesoftware.com/wiki/Inputs_and_Outputs">entity output</a>.
/// </summary>
/// <param name="classname">Classname to hook, or `*` for wildcard</param>
/// <param name="outputName">Output name to hook, or `*` for wildcard</param>
/// <param name="handler">Handler to call</param>
public void HookEntityOutput(string classname, string outputName, EntityIO.EntityOutputHandler handler, HookMode mode = HookMode.Pre)
{
var subscriber = new CallbackSubscriber(handler, handler,
@@ -458,6 +529,10 @@ namespace CounterStrikeSharp.API.Core
EntityOutputHooks[handler] = subscriber;
}
/// <summary>
/// Unhooks an entity output.
/// </summary>
/// <inheritdoc cref="HookEntityOutput"/>
public void UnhookEntityOutput(string classname, string outputName, EntityIO.EntityOutputHandler handler, HookMode mode = HookMode.Pre)
{
if (!EntityOutputHooks.TryGetValue(handler, out var subscriber)) return;
@@ -467,6 +542,12 @@ namespace CounterStrikeSharp.API.Core
EntityOutputHooks.Remove(handler);
}
/// <summary>
/// Hooks an entity output for a single entity instance.
/// </summary>
/// <param name="entityInstance">Entity instance to hook</param>
/// <param name="outputName">Output name to hook, or `*` for wildcard</param>
/// <param name="handler">Handler to call</param>
public void HookSingleEntityOutput(CEntityInstance entityInstance, string outputName, EntityIO.EntityOutputHandler handler)
{
// since we wrap around the plugin handler we need to do this to ensure that the plugin callback is only called
@@ -490,6 +571,10 @@ namespace CounterStrikeSharp.API.Core
EntitySingleOutputHooks[handler] = new EntityIO.EntityOutputCallback(entityInstance.DesignerName, outputName, internalHandler);
}
/// <summary>
/// Unhooks an entity output for a single entity instance.
/// </summary>
/// <inheritdoc cref="HookSingleEntityOutput"/>
public void UnhookSingleEntityOutput(CEntityInstance entityInstance, string outputName, EntityIO.EntityOutputHandler handler)
{
UnhookSingleEntityOutputInternal(entityInstance.DesignerName, outputName, handler);
@@ -528,10 +613,6 @@ namespace CounterStrikeSharp.API.Core
subscriber.Dispose();
}
foreach (var kv in ConvarChangeHandlers)
{
}
foreach (var subscriber in Listeners.Values)
{
subscriber.Dispose();

View File

@@ -0,0 +1,25 @@
namespace CounterStrikeSharp.API.Core.Capabilities;
public static class Capabilities
{
public static void RegisterPluginCapability<T>(PluginCapability<T> capability, Func<T> supplier)
{
if (!PluginCapability<T>.Providers.ContainsKey(capability.Name))
{
PluginCapability<T>.Providers.Add(capability.Name, new());
}
PluginCapability<T>.Providers[capability.Name].Add(supplier);
}
public static void RegisterPlayerCapability<T>(PlayerCapability<T> capability,
Func<CCSPlayerController, T> supplier)
{
if (!PlayerCapability<T>.Providers.ContainsKey(capability.Name))
{
PlayerCapability<T>.Providers.Add(capability.Name, new());
}
PlayerCapability<T>.Providers[capability.Name].Add(supplier);
}
}

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
namespace CounterStrikeSharp.API.Core.Capabilities;
public sealed class PlayerCapability<T>
{
public string Name { get; }
internal static readonly Dictionary<string, List<Func<CCSPlayerController, T>>> Providers = new();
public PlayerCapability(string name)
{
Name = name;
}
public T? Get(CCSPlayerController entity)
{
foreach (var provider in Providers[Name])
{
return provider(entity);
}
return default;
}
}

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
namespace CounterStrikeSharp.API.Core.Capabilities;
public sealed class PluginCapability<T>
{
public string Name { get; }
internal static readonly Dictionary<string, List<Func<T>>> Providers = new();
public PluginCapability(string name)
{
Name = name;
}
public T? Get()
{
foreach (var provider in Providers[Name])
{
return provider();
}
return default;
}
}

View File

@@ -106,6 +106,11 @@ public class CommandManager : ICommandManager
foreach (var attr in permissionsToCheck)
{
if (attr.Permissions.Count == 0)
{
continue;
}
attr.Command = name;
if (!attr.CanExecuteCommand(caller))
{

View File

@@ -50,6 +50,9 @@ namespace CounterStrikeSharp.API.Core
[JsonPropertyName("PluginHotReloadEnabled")]
public bool PluginHotReloadEnabled { get; set; } = true;
[JsonPropertyName("PluginAutoLoadEnabled")]
public bool PluginAutoLoadEnabled { get; set; } = true;
[JsonPropertyName("ServerLanguage")]
public string ServerLanguage { get; set; } = "en";
}
@@ -95,7 +98,13 @@ namespace CounterStrikeSharp.API.Core
/// </summary>
public static bool PluginHotReloadEnabled => _coreConfig.PluginHotReloadEnabled;
/// <summary>
/// When enabled, plugins are automatically loaded from the plugins directory on server start.
/// </summary>
public static bool PluginAutoLoadEnabled => _coreConfig.PluginAutoLoadEnabled;
public static string ServerLanguage => _coreConfig.ServerLanguage;
}
public partial class CoreConfig : IStartupService

View File

@@ -14,10 +14,9 @@
* along with CounterStrikeSharp. If not, see <https://www.gnu.org/licenses/>. *
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Concurrent;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
namespace CounterStrikeSharp.API.Core
@@ -29,140 +28,149 @@ namespace CounterStrikeSharp.API.Core
{
/// <summary>Delegate will be removed after the first invocation.</summary>
SingleUse,
/// <summary>Delegate will remain in memory for the lifetime of the application.</summary>
/// <summary>Delegate will remain in memory for the lifetime of the application (or until <see cref="FunctionReference.Remove"/> is called).</summary>
Permanent
}
/// <summary>
/// Represents a reference to a function that can be called from native code.
/// </summary>
public class FunctionReference
{
private readonly Delegate m_method;
public FunctionLifetime Lifetime { get; set; } = FunctionLifetime.Permanent;
public unsafe delegate void CallbackDelegate(fxScriptContext* context);
private CallbackDelegate s_callback;
private FunctionReference(Delegate method)
private static readonly ConcurrentDictionary<int, FunctionReference> IdToFunctionReferencesMap = new();
private static readonly ConcurrentDictionary<Delegate, FunctionReference> TargetMethodToFunctionReferencesMap = new();
private static readonly object ReferenceCounterLock = new();
private static int _referenceCounter;
private readonly Delegate _targetMethod;
private readonly CallbackDelegate _nativeCallback;
private readonly TaskCompletionSource _taskCompletionSource = new();
private FunctionReference(Delegate method, FunctionLifetime lifetime)
{
m_method = method;
unsafe
{
var dg = new CallbackDelegate((fxScriptContext* context) =>
{
try
{
var scriptContext = new ScriptContext(context);
if (method.Method.GetParameters().FirstOrDefault()?.ParameterType == typeof(ScriptContext))
{
var returnO = m_method.DynamicInvoke(scriptContext);
if (returnO != null)
{
scriptContext.SetResult(returnO, context);
}
return;
}
var paramsList = method.Method.GetParameters().Select((x, i) =>
{
var param = method.Method.GetParameters()[i];
object obj = null;
if (typeof(NativeObject).IsAssignableFrom(param.ParameterType))
{
obj = Activator.CreateInstance(param.ParameterType,
new[] { scriptContext.GetArgument(typeof(IntPtr), i) });
}
else
{
obj = scriptContext.GetArgument(param.ParameterType, i);
}
return obj;
}).ToArray();
var returnObj = m_method.DynamicInvoke(paramsList);
if (returnObj != null)
{
scriptContext.SetResult(returnObj, context);
}
}
catch (Exception e)
{
Application.Instance.Logger.LogError(e, "Error invoking callback");
}
finally
{
if (Lifetime == FunctionLifetime.SingleUse)
{
Remove(Identifier);
if (references.ContainsKey(m_method))
references.Remove(m_method);
}
}
});
s_callback = dg;
}
Lifetime = lifetime;
_targetMethod = method;
_nativeCallback = CreateWrappedCallback();
}
/// <summary>
/// <inheritdoc cref="FunctionLifetime"/>
/// </summary>
public FunctionLifetime Lifetime { get; }
/// <summary>
/// For <see cref="FunctionLifetime.SingleUse"/> function references, this task will complete when
/// the function has finished invoking.
/// </summary>
public Task CompletionTask => _taskCompletionSource.Task;
public int Identifier { get; private set; }
public static FunctionReference Create(Delegate method)
private unsafe CallbackDelegate CreateWrappedCallback()
{
if (references.ContainsKey(method))
return context =>
{
return references[method];
try
{
var scriptContext = new ScriptContext(context);
// Allow for manual handling of the script context
if (_targetMethod.Method.GetParameters().FirstOrDefault()?.ParameterType == typeof(ScriptContext))
{
var returnValue = _targetMethod.DynamicInvoke(scriptContext);
if (returnValue != null)
{
scriptContext.SetResult(returnValue, context);
}
return;
}
var parameterList = _targetMethod.Method.GetParameters().Select((_, i) =>
{
var parameter = _targetMethod.Method.GetParameters()[i];
return scriptContext.GetArgument(parameter.ParameterType, i);
}).ToArray();
var returnObj = _targetMethod.DynamicInvoke(parameterList);
if (returnObj != null)
{
scriptContext.SetResult(returnObj, context);
}
}
catch (Exception e)
{
Application.Instance.Logger.LogError(e, "Error invoking callback");
}
finally
{
if (Lifetime == FunctionLifetime.SingleUse)
{
RemoveSelf();
}
_taskCompletionSource.TrySetResult();
}
};
}
public static FunctionReference Create(Delegate method, FunctionLifetime lifetime = FunctionLifetime.Permanent)
{
// We always want to create a new reference if the lifetime is single use.
if (lifetime == FunctionLifetime.Permanent && TargetMethodToFunctionReferencesMap.TryGetValue(method, out var existingReference))
{
return existingReference;
}
var reference = new FunctionReference(method);
var reference = new FunctionReference(method, lifetime);
var referenceId = Register(reference);
reference.Identifier = referenceId;
return reference;
}
private static Dictionary<int, FunctionReference> ms_references = new Dictionary<int, FunctionReference>();
private static int ms_referenceId;
private static Dictionary<Delegate, FunctionReference> references =
new Dictionary<Delegate, FunctionReference>();
private static int Register(FunctionReference reference)
{
var thisRefId = ms_referenceId;
ms_references[thisRefId] = reference;
references[reference.m_method] = reference;
unchecked { ms_referenceId++; }
return thisRefId;
}
public static FunctionReference Get(int reference)
{
if (ms_references.ContainsKey(reference))
lock (ReferenceCounterLock)
{
return ms_references[reference];
}
var thisRefId = _referenceCounter;
IdToFunctionReferencesMap[thisRefId] = reference;
TargetMethodToFunctionReferencesMap[reference._targetMethod] = reference;
return null;
unchecked
{
_referenceCounter++;
}
return thisRefId;
}
}
public IntPtr GetFunctionPointer()
public IntPtr GetFunctionPointer() => Marshal.GetFunctionPointerForDelegate(_nativeCallback);
private void RemoveSelf()
{
IntPtr cb = Marshal.GetFunctionPointerForDelegate(s_callback);
return cb;
Remove(Identifier);
}
public static void Remove(int reference)
{
if (ms_references.TryGetValue(reference, out var funcRef))
if (IdToFunctionReferencesMap.TryGetValue(reference, out var functionReference))
{
ms_references.Remove(reference);
if (TargetMethodToFunctionReferencesMap.ContainsKey(functionReference._targetMethod))
{
TargetMethodToFunctionReferencesMap.Remove(functionReference._targetMethod, out _);
}
IdToFunctionReferencesMap.Remove(reference, out _);
Application.Instance.Logger.LogDebug("Removing function/callback reference: {Reference}", reference);
}

View File

@@ -4646,6 +4646,14 @@ namespace CounterStrikeSharp.API.Core
get => Get<int>("hitgroup");
set => Set<int>("hitgroup", value);
}
// attacker was in midair
public bool Attackerinair
{
get => Get<bool>("attackerinair");
set => Set<bool>("attackerinair", value);
}
}
[EventName("player_decal")]
@@ -7119,6 +7127,15 @@ namespace CounterStrikeSharp.API.Core
}
}
[EventName("warmup_end")]
public class EventWarmupEnd : GameEvent
{
public EventWarmupEnd(IntPtr pointer) : base(pointer){}
public EventWarmupEnd(bool force) : base("warmup_end", force){}
}
[EventName("weapon_fire")]
public class EventWeaponFire : GameEvent
{

View File

@@ -18,6 +18,12 @@ public interface IScriptHostConfiguration
/// </summary>
string PluginPath { get; }
/// <summary>
/// Gets the absolute path to the directory that contains CounterStrikeSharp plugin shared APIS.
/// e.g. /game/csgo/addons/counterstrikesharp/shared
/// </summary>
string SharedPath { get; }
/// <summary>
/// Gets the absolute path to the directory that contains CounterStrikeSharp configs.
/// e.g. /game/csgo/addons/counterstrikesharp/configs

View File

@@ -7,12 +7,14 @@ internal sealed class ScriptHostConfiguration : IScriptHostConfiguration
{
public string RootPath { get; }
public string PluginPath { get; }
public string SharedPath { get; }
public string ConfigsPath { get; }
public string GameDataPath { get; }
public ScriptHostConfiguration(IHostEnvironment hostEnvironment)
{
RootPath = Path.Join(new[] { hostEnvironment.ContentRootPath });
SharedPath = Path.Join(new[] { hostEnvironment.ContentRootPath, "shared" });
PluginPath = Path.Join(new[] { hostEnvironment.ContentRootPath, "plugins" });
ConfigsPath = Path.Join(new[] { hostEnvironment.ContentRootPath, "configs" });
GameDataPath = Path.Join(new[] { hostEnvironment.ContentRootPath, "gamedata" });

View File

@@ -28,17 +28,23 @@ namespace CounterStrikeSharp.API.Core
public interface IPlugin : IDisposable
{
/// <summary>
/// Name of the plugin.
/// Name of the plugin as it will appear in the plugin list.
/// </summary>
string ModuleName { get; }
/// <summary>
/// Module version.
/// Module version as it will appear in the plugin list.
/// </summary>
string ModuleVersion { get; }
/// <summary>
/// Author of the plugin as it will appear in the plugin list.
/// </summary>
string ModuleAuthor { get; }
/// <summary>
/// Brief description of the plugin as it will appear in the plugin list.
/// </summary>
string ModuleDescription { get; }
/// <summary>
@@ -53,12 +59,23 @@ namespace CounterStrikeSharp.API.Core
/// </summary>
void Unload(bool hotReload);
/// <summary>
/// Will be called by CounterStrikeSharp after all plugins have been loaded.
/// This will also be called for convenience after a reload or a late l oad, so that you don't have to handle
/// re-wiring everything.
/// </summary>
/// <param name="hotReload"></param>
void OnAllPluginsLoaded(bool hotReload);
/// <summary>
/// The path to the plugin's DLL file.
/// </summary>
string ModulePath { get; internal set; }
ILogger Logger { get; set; }
IStringLocalizer Localizer { get; set; }
ICommandManager CommandManager { get; set; }
void RegisterAllAttributes(object instance);

View File

@@ -2,6 +2,7 @@
using System;
using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Modules.Entities;
using CounterStrikeSharp.API.Modules.Utils;
namespace CounterStrikeSharp.API.Core
{
@@ -154,5 +155,13 @@ namespace CounterStrikeSharp.API.Core
/// <param name="simulating"><see langword="true"/> if simulating, <see langword="false"/> otherwise</param>
[ListenerName("OnServerPreWorldUpdate")]
public delegate void OnServerPreWorldUpdate(bool simulating);
/// <summary>
/// Called when the server precaching resources (only when initial startup / changing map).
/// </summary>
/// <param name="manifest">Resource Manifest</param>
[ListenerName("OnServerPrecacheResources")]
public delegate void OnServerPrecacheResources(ResourceManifest manifest);
}
}
}

View File

@@ -8,10 +8,14 @@ namespace CounterStrikeSharp.API.Core;
public partial class CBaseEntity
{
/// <exception cref="InvalidOperationException">Entity is not valid</exception>
public void Teleport(Vector position, QAngle angles, Vector velocity)
public void Teleport(Vector? position = null, QAngle? angles = null, Vector? velocity = null)
{
Guard.IsValidEntity(this);
position ??= AbsOrigin!;
angles ??= AbsRotation!;
velocity ??= AbsVelocity;
VirtualFunction.CreateVoid<IntPtr, IntPtr, IntPtr, IntPtr>(Handle, GameData.GetOffset("CBaseEntity_Teleport"))(
Handle, position.Handle, angles.Handle, velocity.Handle);
}
@@ -39,6 +43,6 @@ public partial class CBaseEntity
{
Guard.IsValidEntity(this);
return (T) Activator.CreateInstance(typeof(T), Marshal.ReadIntPtr(SubclassID.Handle + 4));
return (T)Activator.CreateInstance(typeof(T), Marshal.ReadIntPtr(SubclassID.Handle + 4));
}
}

View File

@@ -26,6 +26,6 @@ public partial class CCSGameRules
/// </summary>
public void TerminateRound(float delay, RoundEndReason roundEndReason)
{
VirtualFunctions.TerminateRound(Handle, roundEndReason, delay);
VirtualFunctions.TerminateRound(Handle, roundEndReason, delay, 0, 0);
}
}

View File

@@ -16,17 +16,22 @@ public partial class CCSPlayerController
/// <exception cref="InvalidOperationException">Entity is not valid</exception>
public IntPtr GiveNamedItem(string item)
{
Guard.IsValidEntity(this);
if (!PlayerPawn.IsValid) return 0;
if (PlayerPawn.Value == null) return 0;
if (!PlayerPawn.Value.IsValid) return 0;
if (PlayerPawn.Value.ItemServices == null) return 0;
return VirtualFunctions.GiveNamedItem(PlayerPawn.Value.ItemServices.Handle, item, 0, 0, 0, 0);
return GiveNamedItem<CEntityInstance>(item)?.Handle ?? IntPtr.Zero;
}
public IntPtr GiveNamedItem(CsItem item)
public T? GiveNamedItem<T>(string item) where T : CEntityInstance
{
Guard.IsValidEntity(this);
if (!PlayerPawn.IsValid) return null;
if (PlayerPawn.Value == null) return null;;
if (!PlayerPawn.Value.IsValid) return null;
if (PlayerPawn.Value.ItemServices == null) return null;
return PlayerPawn.Value.ItemServices.As<CCSPlayer_ItemServices>().GiveNamedItem<T>(item);
}
public IntPtr GiveNamedItem(CsItem item)
{
string? itemString = EnumUtils.GetEnumMemberAttributeValue(item);
if (string.IsNullOrWhiteSpace(itemString))
@@ -75,6 +80,7 @@ public partial class CCSPlayerController
Userid = this
};
@event.FireEventToClient(this);
@event.Free();
}
/// <summary>
@@ -93,7 +99,7 @@ public partial class CCSPlayerController
CCSPlayer_ItemServices itemServices = new CCSPlayer_ItemServices(PlayerPawn.Value.ItemServices.Handle);
CCSPlayer_WeaponServices weaponServices = new CCSPlayer_WeaponServices(PlayerPawn.Value.WeaponServices.Handle);
itemServices.DropActivePlayerWeapon(weaponServices.ActiveWeapon.Value);
}

View File

@@ -45,4 +45,13 @@ public partial class CCSPlayer_ItemServices
VirtualFunction.CreateVoid<nint>(Handle, GameData.GetOffset("CCSPlayer_ItemServices_RemoveWeapons"))(Handle);
}
}
public T? GiveNamedItem<T>(string item) where T : CEntityInstance
{
var pointer = VirtualFunction.Create<nint, string, nint>(Handle, GameData.GetOffset("CCSPlayer_ItemServices_GiveNamedItem"))(Handle, item);
if (pointer == IntPtr.Zero)
return null;
return (T)Activator.CreateInstance(typeof(T), pointer)!;
}
}

View File

@@ -33,6 +33,11 @@ public partial class NetworkedVector<T> : NativeObject, IReadOnlyCollection<T>
}
}
public void RemoveAll()
{
NativeAPI.RemoveAllNetworkVectorElements(Handle);
}
public IEnumerator<T> GetEnumerator()
{
for (int i = 0; i < Count; i++)

View File

@@ -1,7 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
using CounterStrikeSharp.API.Core.Capabilities;
using CounterStrikeSharp.API.Core.Commands;
using CounterStrikeSharp.API.Core.Hosting;
using McMaster.NETCore.Plugins;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@@ -14,8 +18,11 @@ public class PluginManager : IPluginManager
private readonly ICommandManager _commandManager;
private readonly IServiceProvider _serviceProvider;
private readonly ILogger<PluginManager> _logger;
private readonly Dictionary<string, Assembly> _sharedAssemblies = new();
private bool _loadedSharedLibs = false;
public PluginManager(IScriptHostConfiguration scriptHostConfiguration, ICommandManager commandManager, ILogger<PluginManager> logger, IServiceProvider serviceProvider, IServiceScopeFactory serviceScopeFactory)
public PluginManager(IScriptHostConfiguration scriptHostConfiguration, ICommandManager commandManager,
ILogger<PluginManager> logger, IServiceProvider serviceProvider, IServiceScopeFactory serviceScopeFactory)
{
_scriptHostConfiguration = scriptHostConfiguration;
_commandManager = commandManager;
@@ -23,6 +30,36 @@ public class PluginManager : IPluginManager
_serviceProvider = serviceProvider;
}
private void LoadLibrary(string path)
{
var loader = PluginLoader.CreateFromAssemblyFile(path, new[] { typeof(IPlugin), typeof(PluginCapability<>), typeof(PlayerCapability<>) },
config => { config.PreferSharedTypes = true; });
var assembly = loader.LoadDefaultAssembly();
_sharedAssemblies[assembly.GetName().Name] = assembly;
}
private void LoadSharedLibraries()
{
var sharedDirectory = Directory.GetDirectories(_scriptHostConfiguration.SharedPath);
var sharedAssemblyPaths = sharedDirectory
.Select(dir => Path.Combine(dir, Path.GetFileName(dir) + ".dll"))
.Where(File.Exists)
.ToArray();
foreach (var sharedAssemblyPath in sharedAssemblyPaths)
{
try
{
LoadLibrary(sharedAssemblyPath);
}
catch (Exception e)
{
_logger.LogError(e, "Failed to load shared assembly from {Path}", sharedAssemblyPath);
}
}
}
public void Load()
{
var pluginDirectories = Directory.GetDirectories(_scriptHostConfiguration.PluginPath);
@@ -31,15 +68,46 @@ public class PluginManager : IPluginManager
.Where(File.Exists)
.ToArray();
foreach (var path in pluginAssemblyPaths)
AssemblyLoadContext.Default.Resolving += (context, name) =>
{
if (!_loadedSharedLibs)
{
LoadSharedLibraries();
_loadedSharedLibs = true;
}
if (!_sharedAssemblies.TryGetValue(name.Name, out var assembly))
{
return null;
}
return assembly;
};
if (CoreConfig.PluginAutoLoadEnabled)
{
foreach (var path in pluginAssemblyPaths)
{
try
{
LoadPlugin(path);
}
catch (Exception e)
{
_logger.LogError(e, "Failed to load plugin from {Path}", path);
}
}
}
foreach (var plugin in _loadedPluginContexts)
{
try
{
LoadPlugin(path);
plugin.Plugin?.OnAllPluginsLoaded(false);
}
catch (Exception e)
{
_logger.LogError(e, "Failed to load plugin from {Path}", path);
_logger.LogError(e, "OnAllPluginsLoaded failed");
}
}
}
@@ -51,8 +119,9 @@ public class PluginManager : IPluginManager
public void LoadPlugin(string path)
{
var plugin = new PluginContext(_serviceProvider, _commandManager, _scriptHostConfiguration, path, _loadedPluginContexts.Select(x => x.PluginId).DefaultIfEmpty(0).Max() + 1);
var plugin = new PluginContext(_serviceProvider, _commandManager, _scriptHostConfiguration, path,
_loadedPluginContexts.Select(x => x.PluginId).DefaultIfEmpty(0).Max() + 1);
_loadedPluginContexts.Add(plugin);
plugin.Load();
}
}
}

View File

@@ -18,6 +18,7 @@ using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Core.Capabilities;
using CounterStrikeSharp.API.Core.Commands;
using CounterStrikeSharp.API.Core.Hosting;
using CounterStrikeSharp.API.Core.Logging;
@@ -64,7 +65,7 @@ namespace CounterStrikeSharp.API.Core.Plugin
_hostConfiguration = hostConfiguration;
_path = path;
PluginId = id;
Loader = PluginLoader.CreateFromAssemblyFile(path,
new[]
{
@@ -76,7 +77,7 @@ namespace CounterStrikeSharp.API.Core.Plugin
config.IsUnloadable = true;
config.PreferSharedTypes = true;
});
if (CoreConfig.PluginHotReloadEnabled)
{
_fileWatcher = new FileSystemWatcher
@@ -110,6 +111,7 @@ namespace CounterStrikeSharp.API.Core.Plugin
Loader = eventargs.Loader;
Unload(hotReload: true);
Load(hotReload: true);
Plugin.OnAllPluginsLoaded(hotReload: true);
});
return Task.CompletedTask;
@@ -118,12 +120,12 @@ namespace CounterStrikeSharp.API.Core.Plugin
public void Load(bool hotReload = false)
{
if (State == PluginState.Loaded) return;
using (Loader.EnterContextualReflection())
{
var defaultAssembly = Loader.LoadDefaultAssembly();
Type pluginType = defaultAssembly.GetTypes()
Type pluginType = defaultAssembly.GetExportedTypes()
.FirstOrDefault(t => typeof(IPlugin).IsAssignableFrom(t));
if (pluginType == null) throw new Exception("Unable to find plugin in assembly");

View File

@@ -54,6 +54,10 @@ public partial class CBaseCSGrenade : CCSWeaponBase
[SchemaMember("CBaseCSGrenade", "m_fDropTime")]
public ref float DropTime => ref Schema.GetRef<float>(this.Handle, "CBaseCSGrenade", "m_fDropTime");
// m_fPinPullTime
[SchemaMember("CBaseCSGrenade", "m_fPinPullTime")]
public ref float PinPullTime => ref Schema.GetRef<float>(this.Handle, "CBaseCSGrenade", "m_fPinPullTime");
// m_bJustPulledPin
[SchemaMember("CBaseCSGrenade", "m_bJustPulledPin")]
public ref bool JustPulledPin => ref Schema.GetRef<bool>(this.Handle, "CBaseCSGrenade", "m_bJustPulledPin");

View File

@@ -31,7 +31,7 @@ public partial class CBaseIssue : NativeObject
public string DetailsString
{
get { return Schema.GetString(this.Handle, "CBaseIssue", "m_szDetailsString"); }
set { Schema.SetStringBytes(this.Handle, "CBaseIssue", "m_szDetailsString", value, 260); }
set { Schema.SetStringBytes(this.Handle, "CBaseIssue", "m_szDetailsString", value, 4096); }
}
// m_iNumYesVotes

View File

@@ -62,8 +62,4 @@ public partial class CC4 : CCSWeaponBase
[SchemaMember("CC4", "m_bBombPlanted")]
public ref bool BombPlanted => ref Schema.GetRef<bool>(this.Handle, "CC4", "m_bBombPlanted");
// m_bDroppedFromDeath
[SchemaMember("CC4", "m_bDroppedFromDeath")]
public ref bool DroppedFromDeath => ref Schema.GetRef<bool>(this.Handle, "CC4", "m_bDroppedFromDeath");
}

View File

@@ -450,6 +450,10 @@ public partial class CCSGameRules : CTeamplayRules
[SchemaMember("CCSGameRules", "m_arrSelectedHostageSpawnIndices")]
public NetworkedVector<Int32> SelectedHostageSpawnIndices => Schema.GetDeclaredClass<NetworkedVector<Int32>>(this.Handle, "CCSGameRules", "m_arrSelectedHostageSpawnIndices");
// m_nSpawnPointsRandomSeed
[SchemaMember("CCSGameRules", "m_nSpawnPointsRandomSeed")]
public ref Int32 SpawnPointsRandomSeed => ref Schema.GetRef<Int32>(this.Handle, "CCSGameRules", "m_nSpawnPointsRandomSeed");
// m_bFirstConnected
[SchemaMember("CCSGameRules", "m_bFirstConnected")]
public ref bool FirstConnected => ref Schema.GetRef<bool>(this.Handle, "CCSGameRules", "m_bFirstConnected");
@@ -482,6 +486,10 @@ public partial class CCSGameRules : CTeamplayRules
[SchemaMember("CCSGameRules", "m_numQueuedMatchmakingAccounts")]
public ref UInt32 NumQueuedMatchmakingAccounts => ref Schema.GetRef<UInt32>(this.Handle, "CCSGameRules", "m_numQueuedMatchmakingAccounts");
// m_fAvgPlayerRank
[SchemaMember("CCSGameRules", "m_fAvgPlayerRank")]
public ref float AvgPlayerRank => ref Schema.GetRef<float>(this.Handle, "CCSGameRules", "m_fAvgPlayerRank");
// m_pQueuedMatchmakingReservationString
[SchemaMember("CCSGameRules", "m_pQueuedMatchmakingReservationString")]
public string QueuedMatchmakingReservationString
@@ -686,14 +694,26 @@ public partial class CCSGameRules : CTeamplayRules
[SchemaMember("CCSGameRules", "m_TerroristSpawnPointsMasterList")]
public NetworkedVector<SpawnPoint?> TerroristSpawnPointsMasterList => Schema.GetDeclaredClass<NetworkedVector<SpawnPoint?>>(this.Handle, "CCSGameRules", "m_TerroristSpawnPointsMasterList");
// m_bRespawningAllRespawnablePlayers
[SchemaMember("CCSGameRules", "m_bRespawningAllRespawnablePlayers")]
public ref bool RespawningAllRespawnablePlayers => ref Schema.GetRef<bool>(this.Handle, "CCSGameRules", "m_bRespawningAllRespawnablePlayers");
// m_iNextCTSpawnPoint
[SchemaMember("CCSGameRules", "m_iNextCTSpawnPoint")]
public ref Int32 NextCTSpawnPoint => ref Schema.GetRef<Int32>(this.Handle, "CCSGameRules", "m_iNextCTSpawnPoint");
// m_flCTSpawnPointUsedTime
[SchemaMember("CCSGameRules", "m_flCTSpawnPointUsedTime")]
public ref float CTSpawnPointUsedTime => ref Schema.GetRef<float>(this.Handle, "CCSGameRules", "m_flCTSpawnPointUsedTime");
// m_iNextTerroristSpawnPoint
[SchemaMember("CCSGameRules", "m_iNextTerroristSpawnPoint")]
public ref Int32 NextTerroristSpawnPoint => ref Schema.GetRef<Int32>(this.Handle, "CCSGameRules", "m_iNextTerroristSpawnPoint");
// m_flTerroristSpawnPointUsedTime
[SchemaMember("CCSGameRules", "m_flTerroristSpawnPointUsedTime")]
public ref float TerroristSpawnPointUsedTime => ref Schema.GetRef<float>(this.Handle, "CCSGameRules", "m_flTerroristSpawnPointUsedTime");
// m_CTSpawnPoints
[SchemaMember("CCSGameRules", "m_CTSpawnPoints")]
public NetworkedVector<SpawnPoint?> CTSpawnPoints => Schema.GetDeclaredClass<NetworkedVector<SpawnPoint?>>(this.Handle, "CCSGameRules", "m_CTSpawnPoints");
@@ -878,10 +898,6 @@ public partial class CCSGameRules : CTeamplayRules
[SchemaMember("CCSGameRules", "m_nRoundStartCount")]
public ref byte RoundStartCount => ref Schema.GetRef<byte>(this.Handle, "CCSGameRules", "m_nRoundStartCount");
// m_nRoundStartTicks
[SchemaMember("CCSGameRules", "m_nRoundStartTicks")]
public NetworkedVector<Int32> RoundStartTicks => Schema.GetDeclaredClass<NetworkedVector<Int32>>(this.Handle, "CCSGameRules", "m_nRoundStartTicks");
// m_flLastPerfSampleTime
[SchemaMember("CCSGameRules", "m_flLastPerfSampleTime")]
public ref double LastPerfSampleTime => ref Schema.GetRef<double>(this.Handle, "CCSGameRules", "m_flLastPerfSampleTime");

View File

@@ -294,6 +294,22 @@ public partial class CCSPlayerController : CBasePlayerController
[SchemaMember("CCSPlayerController", "m_vecKills")]
public NetworkedVector<EKillTypes_t> Kills => Schema.GetDeclaredClass<NetworkedVector<EKillTypes_t>>(this.Handle, "CCSPlayerController", "m_vecKills");
// m_bMvpNoMusic
[SchemaMember("CCSPlayerController", "m_bMvpNoMusic")]
public ref bool MvpNoMusic => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerController", "m_bMvpNoMusic");
// m_eMvpReason
[SchemaMember("CCSPlayerController", "m_eMvpReason")]
public ref Int32 MvpReason => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerController", "m_eMvpReason");
// m_iMusicKitID
[SchemaMember("CCSPlayerController", "m_iMusicKitID")]
public ref Int32 MusicKitID => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerController", "m_iMusicKitID");
// m_iMusicKitMVPs
[SchemaMember("CCSPlayerController", "m_iMusicKitMVPs")]
public ref Int32 MusicKitMVPs => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerController", "m_iMusicKitMVPs");
// m_iMVPs
[SchemaMember("CCSPlayerController", "m_iMVPs")]
public ref Int32 MVPs => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerController", "m_iMVPs");

View File

@@ -22,9 +22,9 @@ public partial class CCSPlayerController_InGameMoneyServices : CPlayerController
[SchemaMember("CCSPlayerController_InGameMoneyServices", "m_bReceivesMoneyNextRound")]
public ref bool ReceivesMoneyNextRound => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerController_InGameMoneyServices", "m_bReceivesMoneyNextRound");
// m_iAccountMoneyEarnedForNextRound
[SchemaMember("CCSPlayerController_InGameMoneyServices", "m_iAccountMoneyEarnedForNextRound")]
public ref Int32 AccountMoneyEarnedForNextRound => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerController_InGameMoneyServices", "m_iAccountMoneyEarnedForNextRound");
// m_iMoneyEarnedForNextRound
[SchemaMember("CCSPlayerController_InGameMoneyServices", "m_iMoneyEarnedForNextRound")]
public ref Int32 MoneyEarnedForNextRound => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerController_InGameMoneyServices", "m_iMoneyEarnedForNextRound");
// m_iAccount
[SchemaMember("CCSPlayerController_InGameMoneyServices", "m_iAccount")]

View File

@@ -46,10 +46,6 @@ public partial class CCSPlayerPawn : CCSPlayerPawnBase
[SchemaMember("CCSPlayerPawn", "m_nCharacterDefIndex")]
public ref UInt16 CharacterDefIndex => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawn", "m_nCharacterDefIndex");
// m_hPreviousModel
[SchemaMember("CCSPlayerPawn", "m_hPreviousModel")]
public CStrongHandle<InfoForResourceTypeCModel> PreviousModel => Schema.GetDeclaredClass<CStrongHandle<InfoForResourceTypeCModel>>(this.Handle, "CCSPlayerPawn", "m_hPreviousModel");
// m_bHasFemaleVoice
[SchemaMember("CCSPlayerPawn", "m_bHasFemaleVoice")]
public ref bool HasFemaleVoice => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bHasFemaleVoice");
@@ -78,6 +74,10 @@ public partial class CCSPlayerPawn : CCSPlayerPawnBase
[SchemaMember("CCSPlayerPawn", "m_bInBuyZone")]
public ref bool InBuyZone => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bInBuyZone");
// m_TouchingBuyZones
[SchemaMember("CCSPlayerPawn", "m_TouchingBuyZones")]
public NetworkedVector<CHandle<CBaseEntity>> TouchingBuyZones => Schema.GetDeclaredClass<NetworkedVector<CHandle<CBaseEntity>>>(this.Handle, "CCSPlayerPawn", "m_TouchingBuyZones");
// m_bWasInBuyZone
[SchemaMember("CCSPlayerPawn", "m_bWasInBuyZone")]
public ref bool WasInBuyZone => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bWasInBuyZone");
@@ -122,9 +122,9 @@ public partial class CCSPlayerPawn : CCSPlayerPawnBase
[SchemaMember("CCSPlayerPawn", "m_flHealthShotBoostExpirationTime")]
public ref float HealthShotBoostExpirationTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flHealthShotBoostExpirationTime");
// m_flLandseconds
[SchemaMember("CCSPlayerPawn", "m_flLandseconds")]
public ref float Landseconds => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flLandseconds");
// m_flLandingTimeSeconds
[SchemaMember("CCSPlayerPawn", "m_flLandingTimeSeconds")]
public ref float LandingTimeSeconds => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flLandingTimeSeconds");
// m_aimPunchAngle
[SchemaMember("CCSPlayerPawn", "m_aimPunchAngle")]
@@ -226,4 +226,284 @@ public partial class CCSPlayerPawn : CCSPlayerPawnBase
[SchemaMember("CCSPlayerPawn", "m_bSkipOneHeadConstraintUpdate")]
public ref bool SkipOneHeadConstraintUpdate => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bSkipOneHeadConstraintUpdate");
// m_bLeftHanded
[SchemaMember("CCSPlayerPawn", "m_bLeftHanded")]
public ref bool LeftHanded => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bLeftHanded");
// m_fSwitchedHandednessTime
[SchemaMember("CCSPlayerPawn", "m_fSwitchedHandednessTime")]
public ref float SwitchedHandednessTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_fSwitchedHandednessTime");
// m_flViewmodelOffsetX
[SchemaMember("CCSPlayerPawn", "m_flViewmodelOffsetX")]
public ref float ViewmodelOffsetX => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flViewmodelOffsetX");
// m_flViewmodelOffsetY
[SchemaMember("CCSPlayerPawn", "m_flViewmodelOffsetY")]
public ref float ViewmodelOffsetY => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flViewmodelOffsetY");
// m_flViewmodelOffsetZ
[SchemaMember("CCSPlayerPawn", "m_flViewmodelOffsetZ")]
public ref float ViewmodelOffsetZ => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flViewmodelOffsetZ");
// m_flViewmodelFOV
[SchemaMember("CCSPlayerPawn", "m_flViewmodelFOV")]
public ref float ViewmodelFOV => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flViewmodelFOV");
// m_bIsWalking
[SchemaMember("CCSPlayerPawn", "m_bIsWalking")]
public ref bool IsWalking => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bIsWalking");
// m_fLastGivenDefuserTime
[SchemaMember("CCSPlayerPawn", "m_fLastGivenDefuserTime")]
public ref float LastGivenDefuserTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_fLastGivenDefuserTime");
// m_fLastGivenBombTime
[SchemaMember("CCSPlayerPawn", "m_fLastGivenBombTime")]
public ref float LastGivenBombTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_fLastGivenBombTime");
// m_flDealtDamageToEnemyMostRecentTimestamp
[SchemaMember("CCSPlayerPawn", "m_flDealtDamageToEnemyMostRecentTimestamp")]
public ref float DealtDamageToEnemyMostRecentTimestamp => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flDealtDamageToEnemyMostRecentTimestamp");
// m_iDisplayHistoryBits
[SchemaMember("CCSPlayerPawn", "m_iDisplayHistoryBits")]
public ref UInt32 DisplayHistoryBits => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayerPawn", "m_iDisplayHistoryBits");
// m_flLastAttackedTeammate
[SchemaMember("CCSPlayerPawn", "m_flLastAttackedTeammate")]
public ref float LastAttackedTeammate => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flLastAttackedTeammate");
// m_allowAutoFollowTime
[SchemaMember("CCSPlayerPawn", "m_allowAutoFollowTime")]
public ref float AllowAutoFollowTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_allowAutoFollowTime");
// m_bResetArmorNextSpawn
[SchemaMember("CCSPlayerPawn", "m_bResetArmorNextSpawn")]
public ref bool ResetArmorNextSpawn => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bResetArmorNextSpawn");
// m_nLastKillerIndex
[SchemaMember("CCSPlayerPawn", "m_nLastKillerIndex")]
public CEntityIndex LastKillerIndex => Schema.GetDeclaredClass<CEntityIndex>(this.Handle, "CCSPlayerPawn", "m_nLastKillerIndex");
// m_entitySpottedState
[SchemaMember("CCSPlayerPawn", "m_entitySpottedState")]
public EntitySpottedState_t EntitySpottedState => Schema.GetDeclaredClass<EntitySpottedState_t>(this.Handle, "CCSPlayerPawn", "m_entitySpottedState");
// m_nSpotRules
[SchemaMember("CCSPlayerPawn", "m_nSpotRules")]
public ref Int32 SpotRules => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_nSpotRules");
// m_bIsScoped
[SchemaMember("CCSPlayerPawn", "m_bIsScoped")]
public ref bool IsScoped => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bIsScoped");
// m_bResumeZoom
[SchemaMember("CCSPlayerPawn", "m_bResumeZoom")]
public ref bool ResumeZoom => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bResumeZoom");
// m_bIsDefusing
[SchemaMember("CCSPlayerPawn", "m_bIsDefusing")]
public ref bool IsDefusing => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bIsDefusing");
// m_bIsGrabbingHostage
[SchemaMember("CCSPlayerPawn", "m_bIsGrabbingHostage")]
public ref bool IsGrabbingHostage => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bIsGrabbingHostage");
// m_iBlockingUseActionInProgress
[SchemaMember("CCSPlayerPawn", "m_iBlockingUseActionInProgress")]
public ref CSPlayerBlockingUseAction_t BlockingUseActionInProgress => ref Schema.GetRef<CSPlayerBlockingUseAction_t>(this.Handle, "CCSPlayerPawn", "m_iBlockingUseActionInProgress");
// m_flEmitSoundTime
[SchemaMember("CCSPlayerPawn", "m_flEmitSoundTime")]
public ref float EmitSoundTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flEmitSoundTime");
// m_bInNoDefuseArea
[SchemaMember("CCSPlayerPawn", "m_bInNoDefuseArea")]
public ref bool InNoDefuseArea => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bInNoDefuseArea");
// m_iBombSiteIndex
[SchemaMember("CCSPlayerPawn", "m_iBombSiteIndex")]
public CEntityIndex BombSiteIndex => Schema.GetDeclaredClass<CEntityIndex>(this.Handle, "CCSPlayerPawn", "m_iBombSiteIndex");
// m_nWhichBombZone
[SchemaMember("CCSPlayerPawn", "m_nWhichBombZone")]
public ref Int32 WhichBombZone => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_nWhichBombZone");
// m_bInBombZoneTrigger
[SchemaMember("CCSPlayerPawn", "m_bInBombZoneTrigger")]
public ref bool InBombZoneTrigger => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bInBombZoneTrigger");
// m_bWasInBombZoneTrigger
[SchemaMember("CCSPlayerPawn", "m_bWasInBombZoneTrigger")]
public ref bool WasInBombZoneTrigger => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bWasInBombZoneTrigger");
// m_iShotsFired
[SchemaMember("CCSPlayerPawn", "m_iShotsFired")]
public ref Int32 ShotsFired => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_iShotsFired");
// m_flFlinchStack
[SchemaMember("CCSPlayerPawn", "m_flFlinchStack")]
public ref float FlinchStack => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flFlinchStack");
// m_flVelocityModifier
[SchemaMember("CCSPlayerPawn", "m_flVelocityModifier")]
public ref float VelocityModifier => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flVelocityModifier");
// m_flHitHeading
[SchemaMember("CCSPlayerPawn", "m_flHitHeading")]
public ref float HitHeading => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flHitHeading");
// m_nHitBodyPart
[SchemaMember("CCSPlayerPawn", "m_nHitBodyPart")]
public ref Int32 HitBodyPart => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_nHitBodyPart");
// m_vecTotalBulletForce
[SchemaMember("CCSPlayerPawn", "m_vecTotalBulletForce")]
public Vector TotalBulletForce => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawn", "m_vecTotalBulletForce");
// m_bWaitForNoAttack
[SchemaMember("CCSPlayerPawn", "m_bWaitForNoAttack")]
public ref bool WaitForNoAttack => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bWaitForNoAttack");
// m_ignoreLadderJumpTime
[SchemaMember("CCSPlayerPawn", "m_ignoreLadderJumpTime")]
public ref float IgnoreLadderJumpTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_ignoreLadderJumpTime");
// m_NumEnemiesKilledThisRound
[SchemaMember("CCSPlayerPawn", "m_NumEnemiesKilledThisRound")]
public ref Int32 NumEnemiesKilledThisRound => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_NumEnemiesKilledThisRound");
// m_bKilledByHeadshot
[SchemaMember("CCSPlayerPawn", "m_bKilledByHeadshot")]
public ref bool KilledByHeadshot => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bKilledByHeadshot");
// m_LastHitBox
[SchemaMember("CCSPlayerPawn", "m_LastHitBox")]
public ref Int32 LastHitBox => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_LastHitBox");
// m_LastHealth
[SchemaMember("CCSPlayerPawn", "m_LastHealth")]
public ref Int32 LastHealth => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_LastHealth");
// m_pBot
[SchemaMember("CCSPlayerPawn", "m_pBot")]
public CCSBot? Bot => Schema.GetPointer<CCSBot>(this.Handle, "CCSPlayerPawn", "m_pBot");
// m_bBotAllowActive
[SchemaMember("CCSPlayerPawn", "m_bBotAllowActive")]
public ref bool BotAllowActive => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bBotAllowActive");
// m_thirdPersonHeading
[SchemaMember("CCSPlayerPawn", "m_thirdPersonHeading")]
public QAngle ThirdPersonHeading => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawn", "m_thirdPersonHeading");
// m_flSlopeDropOffset
[SchemaMember("CCSPlayerPawn", "m_flSlopeDropOffset")]
public ref float SlopeDropOffset => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flSlopeDropOffset");
// m_flSlopeDropHeight
[SchemaMember("CCSPlayerPawn", "m_flSlopeDropHeight")]
public ref float SlopeDropHeight => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flSlopeDropHeight");
// m_vHeadConstraintOffset
[SchemaMember("CCSPlayerPawn", "m_vHeadConstraintOffset")]
public Vector HeadConstraintOffset => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawn", "m_vHeadConstraintOffset");
// m_nLastPickupPriority
[SchemaMember("CCSPlayerPawn", "m_nLastPickupPriority")]
public ref Int32 LastPickupPriority => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_nLastPickupPriority");
// m_flLastPickupPriorityTime
[SchemaMember("CCSPlayerPawn", "m_flLastPickupPriorityTime")]
public ref float LastPickupPriorityTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flLastPickupPriorityTime");
// m_ArmorValue
[SchemaMember("CCSPlayerPawn", "m_ArmorValue")]
public ref Int32 ArmorValue => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_ArmorValue");
// m_unCurrentEquipmentValue
[SchemaMember("CCSPlayerPawn", "m_unCurrentEquipmentValue")]
public ref UInt16 CurrentEquipmentValue => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawn", "m_unCurrentEquipmentValue");
// m_unRoundStartEquipmentValue
[SchemaMember("CCSPlayerPawn", "m_unRoundStartEquipmentValue")]
public ref UInt16 RoundStartEquipmentValue => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawn", "m_unRoundStartEquipmentValue");
// m_unFreezetimeEndEquipmentValue
[SchemaMember("CCSPlayerPawn", "m_unFreezetimeEndEquipmentValue")]
public ref UInt16 FreezetimeEndEquipmentValue => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawn", "m_unFreezetimeEndEquipmentValue");
// m_iLastWeaponFireUsercmd
[SchemaMember("CCSPlayerPawn", "m_iLastWeaponFireUsercmd")]
public ref Int32 LastWeaponFireUsercmd => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_iLastWeaponFireUsercmd");
// m_flLastFriendlyFireDamageReductionRatio
[SchemaMember("CCSPlayerPawn", "m_flLastFriendlyFireDamageReductionRatio")]
public ref float LastFriendlyFireDamageReductionRatio => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flLastFriendlyFireDamageReductionRatio");
// m_bIsSpawning
[SchemaMember("CCSPlayerPawn", "m_bIsSpawning")]
public ref bool IsSpawning => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bIsSpawning");
// m_iDeathFlags
[SchemaMember("CCSPlayerPawn", "m_iDeathFlags")]
public ref Int32 DeathFlags => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_iDeathFlags");
// m_bHasDeathInfo
[SchemaMember("CCSPlayerPawn", "m_bHasDeathInfo")]
public ref bool HasDeathInfo => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bHasDeathInfo");
// m_flDeathInfoTime
[SchemaMember("CCSPlayerPawn", "m_flDeathInfoTime")]
public ref float DeathInfoTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flDeathInfoTime");
// m_vecDeathInfoOrigin
[SchemaMember("CCSPlayerPawn", "m_vecDeathInfoOrigin")]
public Vector DeathInfoOrigin => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawn", "m_vecDeathInfoOrigin");
// m_vecPlayerPatchEconIndices
[SchemaMember("CCSPlayerPawn", "m_vecPlayerPatchEconIndices")]
public Span<UInt32> PlayerPatchEconIndices => Schema.GetFixedArray<UInt32>(this.Handle, "CCSPlayerPawn", "m_vecPlayerPatchEconIndices", 5);
// m_GunGameImmunityColor
[SchemaMember("CCSPlayerPawn", "m_GunGameImmunityColor")]
public Color GunGameImmunityColor
{
get { return Schema.GetCustomMarshalledType<Color>(this.Handle, "CCSPlayerPawn", "m_GunGameImmunityColor"); }
set { Schema.SetCustomMarshalledType<Color>(this.Handle, "CCSPlayerPawn", "m_GunGameImmunityColor", value); }
}
// m_grenadeParameterStashTime
[SchemaMember("CCSPlayerPawn", "m_grenadeParameterStashTime")]
public ref float GrenadeParameterStashTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_grenadeParameterStashTime");
// m_bGrenadeParametersStashed
[SchemaMember("CCSPlayerPawn", "m_bGrenadeParametersStashed")]
public ref bool GrenadeParametersStashed => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bGrenadeParametersStashed");
// m_angStashedShootAngles
[SchemaMember("CCSPlayerPawn", "m_angStashedShootAngles")]
public QAngle StashedShootAngles => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawn", "m_angStashedShootAngles");
// m_vecStashedGrenadeThrowPosition
[SchemaMember("CCSPlayerPawn", "m_vecStashedGrenadeThrowPosition")]
public Vector StashedGrenadeThrowPosition => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawn", "m_vecStashedGrenadeThrowPosition");
// m_vecStashedVelocity
[SchemaMember("CCSPlayerPawn", "m_vecStashedVelocity")]
public Vector StashedVelocity => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawn", "m_vecStashedVelocity");
// m_angShootAngleHistory
[SchemaMember("CCSPlayerPawn", "m_angShootAngleHistory")]
public Span<QAngle> ShootAngleHistory => Schema.GetFixedArray<QAngle>(this.Handle, "CCSPlayerPawn", "m_angShootAngleHistory", 2);
// m_vecThrowPositionHistory
[SchemaMember("CCSPlayerPawn", "m_vecThrowPositionHistory")]
public Span<Vector> ThrowPositionHistory => Schema.GetFixedArray<Vector>(this.Handle, "CCSPlayerPawn", "m_vecThrowPositionHistory", 2);
// m_vecVelocityHistory
[SchemaMember("CCSPlayerPawn", "m_vecVelocityHistory")]
public Span<Vector> VelocityHistory => Schema.GetFixedArray<Vector>(this.Handle, "CCSPlayerPawn", "m_vecVelocityHistory", 2);
}

View File

@@ -30,18 +30,6 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_pViewModelServices")]
public CPlayer_ViewModelServices? ViewModelServices => Schema.GetPointer<CPlayer_ViewModelServices>(this.Handle, "CCSPlayerPawnBase", "m_pViewModelServices");
// m_iDisplayHistoryBits
[SchemaMember("CCSPlayerPawnBase", "m_iDisplayHistoryBits")]
public ref UInt32 DisplayHistoryBits => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayerPawnBase", "m_iDisplayHistoryBits");
// m_flLastAttackedTeammate
[SchemaMember("CCSPlayerPawnBase", "m_flLastAttackedTeammate")]
public ref float LastAttackedTeammate => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastAttackedTeammate");
// m_hOriginalController
[SchemaMember("CCSPlayerPawnBase", "m_hOriginalController")]
public CHandle<CCSPlayerController> OriginalController => Schema.GetDeclaredClass<CHandle<CCSPlayerController>>(this.Handle, "CCSPlayerPawnBase", "m_hOriginalController");
// m_blindUntilTime
[SchemaMember("CCSPlayerPawnBase", "m_blindUntilTime")]
public ref float BlindUntilTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_blindUntilTime");
@@ -50,82 +38,14 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_blindStartTime")]
public ref float BlindStartTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_blindStartTime");
// m_allowAutoFollowTime
[SchemaMember("CCSPlayerPawnBase", "m_allowAutoFollowTime")]
public ref float AllowAutoFollowTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_allowAutoFollowTime");
// m_entitySpottedState
[SchemaMember("CCSPlayerPawnBase", "m_entitySpottedState")]
public EntitySpottedState_t EntitySpottedState => Schema.GetDeclaredClass<EntitySpottedState_t>(this.Handle, "CCSPlayerPawnBase", "m_entitySpottedState");
// m_nSpotRules
[SchemaMember("CCSPlayerPawnBase", "m_nSpotRules")]
public ref Int32 SpotRules => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nSpotRules");
// m_iPlayerState
[SchemaMember("CCSPlayerPawnBase", "m_iPlayerState")]
public ref CSPlayerState PlayerState => ref Schema.GetRef<CSPlayerState>(this.Handle, "CCSPlayerPawnBase", "m_iPlayerState");
// m_chickenIdleSoundTimer
[SchemaMember("CCSPlayerPawnBase", "m_chickenIdleSoundTimer")]
public CountdownTimer ChickenIdleSoundTimer => Schema.GetDeclaredClass<CountdownTimer>(this.Handle, "CCSPlayerPawnBase", "m_chickenIdleSoundTimer");
// m_chickenJumpSoundTimer
[SchemaMember("CCSPlayerPawnBase", "m_chickenJumpSoundTimer")]
public CountdownTimer ChickenJumpSoundTimer => Schema.GetDeclaredClass<CountdownTimer>(this.Handle, "CCSPlayerPawnBase", "m_chickenJumpSoundTimer");
// m_vecLastBookmarkedPosition
[SchemaMember("CCSPlayerPawnBase", "m_vecLastBookmarkedPosition")]
public Vector LastBookmarkedPosition => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecLastBookmarkedPosition");
// m_flLastDistanceTraveledNotice
[SchemaMember("CCSPlayerPawnBase", "m_flLastDistanceTraveledNotice")]
public ref float LastDistanceTraveledNotice => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastDistanceTraveledNotice");
// m_flAccumulatedDistanceTraveled
[SchemaMember("CCSPlayerPawnBase", "m_flAccumulatedDistanceTraveled")]
public ref float AccumulatedDistanceTraveled => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flAccumulatedDistanceTraveled");
// m_flLastFriendlyFireDamageReductionRatio
[SchemaMember("CCSPlayerPawnBase", "m_flLastFriendlyFireDamageReductionRatio")]
public ref float LastFriendlyFireDamageReductionRatio => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastFriendlyFireDamageReductionRatio");
// m_bRespawning
[SchemaMember("CCSPlayerPawnBase", "m_bRespawning")]
public ref bool Respawning => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bRespawning");
// m_nLastPickupPriority
[SchemaMember("CCSPlayerPawnBase", "m_nLastPickupPriority")]
public ref Int32 LastPickupPriority => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nLastPickupPriority");
// m_flLastPickupPriorityTime
[SchemaMember("CCSPlayerPawnBase", "m_flLastPickupPriorityTime")]
public ref float LastPickupPriorityTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastPickupPriorityTime");
// m_bIsScoped
[SchemaMember("CCSPlayerPawnBase", "m_bIsScoped")]
public ref bool IsScoped => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bIsScoped");
// m_bIsWalking
[SchemaMember("CCSPlayerPawnBase", "m_bIsWalking")]
public ref bool IsWalking => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bIsWalking");
// m_bResumeZoom
[SchemaMember("CCSPlayerPawnBase", "m_bResumeZoom")]
public ref bool ResumeZoom => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bResumeZoom");
// m_bIsDefusing
[SchemaMember("CCSPlayerPawnBase", "m_bIsDefusing")]
public ref bool IsDefusing => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bIsDefusing");
// m_bIsGrabbingHostage
[SchemaMember("CCSPlayerPawnBase", "m_bIsGrabbingHostage")]
public ref bool IsGrabbingHostage => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bIsGrabbingHostage");
// m_iBlockingUseActionInProgress
[SchemaMember("CCSPlayerPawnBase", "m_iBlockingUseActionInProgress")]
public ref CSPlayerBlockingUseAction_t BlockingUseActionInProgress => ref Schema.GetRef<CSPlayerBlockingUseAction_t>(this.Handle, "CCSPlayerPawnBase", "m_iBlockingUseActionInProgress");
// m_fImmuneToGunGameDamageTime
[SchemaMember("CCSPlayerPawnBase", "m_fImmuneToGunGameDamageTime")]
public ref float ImmuneToGunGameDamageTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_fImmuneToGunGameDamageTime");
@@ -134,14 +54,6 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_bGunGameImmunity")]
public ref bool GunGameImmunity => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bGunGameImmunity");
// m_GunGameImmunityColor
[SchemaMember("CCSPlayerPawnBase", "m_GunGameImmunityColor")]
public Color GunGameImmunityColor
{
get { return Schema.GetCustomMarshalledType<Color>(this.Handle, "CCSPlayerPawnBase", "m_GunGameImmunityColor"); }
set { Schema.SetCustomMarshalledType<Color>(this.Handle, "CCSPlayerPawnBase", "m_GunGameImmunityColor", value); }
}
// m_fMolotovDamageTime
[SchemaMember("CCSPlayerPawnBase", "m_fMolotovDamageTime")]
public ref float MolotovDamageTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_fMolotovDamageTime");
@@ -150,210 +62,18 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_bHasMovedSinceSpawn")]
public ref bool HasMovedSinceSpawn => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bHasMovedSinceSpawn");
// m_bCanMoveDuringFreezePeriod
[SchemaMember("CCSPlayerPawnBase", "m_bCanMoveDuringFreezePeriod")]
public ref bool CanMoveDuringFreezePeriod => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bCanMoveDuringFreezePeriod");
// m_flGuardianTooFarDistFrac
[SchemaMember("CCSPlayerPawnBase", "m_flGuardianTooFarDistFrac")]
public ref float GuardianTooFarDistFrac => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flGuardianTooFarDistFrac");
// m_flNextGuardianTooFarHurtTime
[SchemaMember("CCSPlayerPawnBase", "m_flNextGuardianTooFarHurtTime")]
public ref float NextGuardianTooFarHurtTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flNextGuardianTooFarHurtTime");
// m_flDetectedByEnemySensorTime
[SchemaMember("CCSPlayerPawnBase", "m_flDetectedByEnemySensorTime")]
public ref float DetectedByEnemySensorTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flDetectedByEnemySensorTime");
// m_flDealtDamageToEnemyMostRecentTimestamp
[SchemaMember("CCSPlayerPawnBase", "m_flDealtDamageToEnemyMostRecentTimestamp")]
public ref float DealtDamageToEnemyMostRecentTimestamp => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flDealtDamageToEnemyMostRecentTimestamp");
// m_flLastEquippedHelmetTime
[SchemaMember("CCSPlayerPawnBase", "m_flLastEquippedHelmetTime")]
public ref float LastEquippedHelmetTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastEquippedHelmetTime");
// m_flLastEquippedArmorTime
[SchemaMember("CCSPlayerPawnBase", "m_flLastEquippedArmorTime")]
public ref float LastEquippedArmorTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastEquippedArmorTime");
// m_nHeavyAssaultSuitCooldownRemaining
[SchemaMember("CCSPlayerPawnBase", "m_nHeavyAssaultSuitCooldownRemaining")]
public ref Int32 HeavyAssaultSuitCooldownRemaining => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nHeavyAssaultSuitCooldownRemaining");
// m_bResetArmorNextSpawn
[SchemaMember("CCSPlayerPawnBase", "m_bResetArmorNextSpawn")]
public ref bool ResetArmorNextSpawn => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bResetArmorNextSpawn");
// m_flLastBumpMineBumpTime
[SchemaMember("CCSPlayerPawnBase", "m_flLastBumpMineBumpTime")]
public ref float LastBumpMineBumpTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastBumpMineBumpTime");
// m_flEmitSoundTime
[SchemaMember("CCSPlayerPawnBase", "m_flEmitSoundTime")]
public ref float EmitSoundTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flEmitSoundTime");
// m_iNumSpawns
[SchemaMember("CCSPlayerPawnBase", "m_iNumSpawns")]
public ref Int32 NumSpawns => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iNumSpawns");
// m_iShouldHaveCash
[SchemaMember("CCSPlayerPawnBase", "m_iShouldHaveCash")]
public ref Int32 ShouldHaveCash => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iShouldHaveCash");
// m_bInvalidSteamLogonDelayed
[SchemaMember("CCSPlayerPawnBase", "m_bInvalidSteamLogonDelayed")]
public ref bool InvalidSteamLogonDelayed => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bInvalidSteamLogonDelayed");
// m_flLastAction
[SchemaMember("CCSPlayerPawnBase", "m_flLastAction")]
public ref float LastAction => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastAction");
// m_flNameChangeHistory
[SchemaMember("CCSPlayerPawnBase", "m_flNameChangeHistory")]
public Span<float> NameChangeHistory => Schema.GetFixedArray<float>(this.Handle, "CCSPlayerPawnBase", "m_flNameChangeHistory", 5);
// m_fLastGivenDefuserTime
[SchemaMember("CCSPlayerPawnBase", "m_fLastGivenDefuserTime")]
public ref float LastGivenDefuserTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_fLastGivenDefuserTime");
// m_fLastGivenBombTime
[SchemaMember("CCSPlayerPawnBase", "m_fLastGivenBombTime")]
public ref float LastGivenBombTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_fLastGivenBombTime");
// m_bHasNightVision
[SchemaMember("CCSPlayerPawnBase", "m_bHasNightVision")]
public ref bool HasNightVision => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bHasNightVision");
// m_bNightVisionOn
[SchemaMember("CCSPlayerPawnBase", "m_bNightVisionOn")]
public ref bool NightVisionOn => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bNightVisionOn");
// m_flIdleTimeSinceLastAction
[SchemaMember("CCSPlayerPawnBase", "m_flIdleTimeSinceLastAction")]
public ref float IdleTimeSinceLastAction => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flIdleTimeSinceLastAction");
// m_fNextRadarUpdateTime
[SchemaMember("CCSPlayerPawnBase", "m_fNextRadarUpdateTime")]
public ref float NextRadarUpdateTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_fNextRadarUpdateTime");
// m_flLastMoneyUpdateTime
[SchemaMember("CCSPlayerPawnBase", "m_flLastMoneyUpdateTime")]
public ref float LastMoneyUpdateTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastMoneyUpdateTime");
// m_MenuStringBuffer
[SchemaMember("CCSPlayerPawnBase", "m_MenuStringBuffer")]
public string MenuStringBuffer
{
get { return Schema.GetString(this.Handle, "CCSPlayerPawnBase", "m_MenuStringBuffer"); }
set { Schema.SetStringBytes(this.Handle, "CCSPlayerPawnBase", "m_MenuStringBuffer", value, 1024); }
}
// m_fIntroCamTime
[SchemaMember("CCSPlayerPawnBase", "m_fIntroCamTime")]
public ref float IntroCamTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_fIntroCamTime");
// m_nMyCollisionGroup
[SchemaMember("CCSPlayerPawnBase", "m_nMyCollisionGroup")]
public ref Int32 MyCollisionGroup => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nMyCollisionGroup");
// m_bInNoDefuseArea
[SchemaMember("CCSPlayerPawnBase", "m_bInNoDefuseArea")]
public ref bool InNoDefuseArea => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bInNoDefuseArea");
// m_bKilledByTaser
[SchemaMember("CCSPlayerPawnBase", "m_bKilledByTaser")]
public ref bool KilledByTaser => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bKilledByTaser");
// m_iMoveState
[SchemaMember("CCSPlayerPawnBase", "m_iMoveState")]
public ref Int32 MoveState => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iMoveState");
// m_grenadeParameterStashTime
[SchemaMember("CCSPlayerPawnBase", "m_grenadeParameterStashTime")]
public ref float GrenadeParameterStashTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_grenadeParameterStashTime");
// m_bGrenadeParametersStashed
[SchemaMember("CCSPlayerPawnBase", "m_bGrenadeParametersStashed")]
public ref bool GrenadeParametersStashed => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bGrenadeParametersStashed");
// m_angStashedShootAngles
[SchemaMember("CCSPlayerPawnBase", "m_angStashedShootAngles")]
public QAngle StashedShootAngles => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawnBase", "m_angStashedShootAngles");
// m_vecStashedGrenadeThrowPosition
[SchemaMember("CCSPlayerPawnBase", "m_vecStashedGrenadeThrowPosition")]
public Vector StashedGrenadeThrowPosition => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecStashedGrenadeThrowPosition");
// m_vecStashedVelocity
[SchemaMember("CCSPlayerPawnBase", "m_vecStashedVelocity")]
public Vector StashedVelocity => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecStashedVelocity");
// m_angShootAngleHistory
[SchemaMember("CCSPlayerPawnBase", "m_angShootAngleHistory")]
public Span<QAngle> ShootAngleHistory => Schema.GetFixedArray<QAngle>(this.Handle, "CCSPlayerPawnBase", "m_angShootAngleHistory", 2);
// m_vecThrowPositionHistory
[SchemaMember("CCSPlayerPawnBase", "m_vecThrowPositionHistory")]
public Span<Vector> ThrowPositionHistory => Schema.GetFixedArray<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecThrowPositionHistory", 2);
// m_vecVelocityHistory
[SchemaMember("CCSPlayerPawnBase", "m_vecVelocityHistory")]
public Span<Vector> VelocityHistory => Schema.GetFixedArray<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecVelocityHistory", 2);
// m_bDiedAirborne
[SchemaMember("CCSPlayerPawnBase", "m_bDiedAirborne")]
public ref bool DiedAirborne => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bDiedAirborne");
// m_iBombSiteIndex
[SchemaMember("CCSPlayerPawnBase", "m_iBombSiteIndex")]
public CEntityIndex BombSiteIndex => Schema.GetDeclaredClass<CEntityIndex>(this.Handle, "CCSPlayerPawnBase", "m_iBombSiteIndex");
// m_nWhichBombZone
[SchemaMember("CCSPlayerPawnBase", "m_nWhichBombZone")]
public ref Int32 WhichBombZone => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nWhichBombZone");
// m_bInBombZoneTrigger
[SchemaMember("CCSPlayerPawnBase", "m_bInBombZoneTrigger")]
public ref bool InBombZoneTrigger => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bInBombZoneTrigger");
// m_bWasInBombZoneTrigger
[SchemaMember("CCSPlayerPawnBase", "m_bWasInBombZoneTrigger")]
public ref bool WasInBombZoneTrigger => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bWasInBombZoneTrigger");
// m_iDirection
[SchemaMember("CCSPlayerPawnBase", "m_iDirection")]
public ref Int32 Direction => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iDirection");
// m_iShotsFired
[SchemaMember("CCSPlayerPawnBase", "m_iShotsFired")]
public ref Int32 ShotsFired => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iShotsFired");
// m_ArmorValue
[SchemaMember("CCSPlayerPawnBase", "m_ArmorValue")]
public ref Int32 ArmorValue => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_ArmorValue");
// m_flFlinchStack
[SchemaMember("CCSPlayerPawnBase", "m_flFlinchStack")]
public ref float FlinchStack => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flFlinchStack");
// m_flVelocityModifier
[SchemaMember("CCSPlayerPawnBase", "m_flVelocityModifier")]
public ref float VelocityModifier => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flVelocityModifier");
// m_flHitHeading
[SchemaMember("CCSPlayerPawnBase", "m_flHitHeading")]
public ref float HitHeading => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flHitHeading");
// m_nHitBodyPart
[SchemaMember("CCSPlayerPawnBase", "m_nHitBodyPart")]
public ref Int32 HitBodyPart => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nHitBodyPart");
// m_iHostagesKilled
[SchemaMember("CCSPlayerPawnBase", "m_iHostagesKilled")]
public ref Int32 HostagesKilled => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iHostagesKilled");
// m_vecTotalBulletForce
[SchemaMember("CCSPlayerPawnBase", "m_vecTotalBulletForce")]
public Vector TotalBulletForce => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecTotalBulletForce");
// m_flFlashDuration
[SchemaMember("CCSPlayerPawnBase", "m_flFlashDuration")]
public ref float FlashDuration => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flFlashDuration");
@@ -370,86 +90,10 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_iProgressBarDuration")]
public ref Int32 ProgressBarDuration => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iProgressBarDuration");
// m_bWaitForNoAttack
[SchemaMember("CCSPlayerPawnBase", "m_bWaitForNoAttack")]
public ref bool WaitForNoAttack => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bWaitForNoAttack");
// m_flLowerBodyYawTarget
[SchemaMember("CCSPlayerPawnBase", "m_flLowerBodyYawTarget")]
public ref float LowerBodyYawTarget => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLowerBodyYawTarget");
// m_bStrafing
[SchemaMember("CCSPlayerPawnBase", "m_bStrafing")]
public ref bool Strafing => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bStrafing");
// m_lastStandingPos
[SchemaMember("CCSPlayerPawnBase", "m_lastStandingPos")]
public Vector LastStandingPos => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_lastStandingPos");
// m_ignoreLadderJumpTime
[SchemaMember("CCSPlayerPawnBase", "m_ignoreLadderJumpTime")]
public ref float IgnoreLadderJumpTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_ignoreLadderJumpTime");
// m_ladderSurpressionTimer
[SchemaMember("CCSPlayerPawnBase", "m_ladderSurpressionTimer")]
public CountdownTimer LadderSurpressionTimer => Schema.GetDeclaredClass<CountdownTimer>(this.Handle, "CCSPlayerPawnBase", "m_ladderSurpressionTimer");
// m_lastLadderNormal
[SchemaMember("CCSPlayerPawnBase", "m_lastLadderNormal")]
public Vector LastLadderNormal => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_lastLadderNormal");
// m_lastLadderPos
[SchemaMember("CCSPlayerPawnBase", "m_lastLadderPos")]
public Vector LastLadderPos => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_lastLadderPos");
// m_thirdPersonHeading
[SchemaMember("CCSPlayerPawnBase", "m_thirdPersonHeading")]
public QAngle ThirdPersonHeading => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawnBase", "m_thirdPersonHeading");
// m_flSlopeDropOffset
[SchemaMember("CCSPlayerPawnBase", "m_flSlopeDropOffset")]
public ref float SlopeDropOffset => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flSlopeDropOffset");
// m_flSlopeDropHeight
[SchemaMember("CCSPlayerPawnBase", "m_flSlopeDropHeight")]
public ref float SlopeDropHeight => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flSlopeDropHeight");
// m_vHeadConstraintOffset
[SchemaMember("CCSPlayerPawnBase", "m_vHeadConstraintOffset")]
public Vector HeadConstraintOffset => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vHeadConstraintOffset");
// m_iLastWeaponFireUsercmd
[SchemaMember("CCSPlayerPawnBase", "m_iLastWeaponFireUsercmd")]
public ref Int32 LastWeaponFireUsercmd => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iLastWeaponFireUsercmd");
// m_angEyeAngles
[SchemaMember("CCSPlayerPawnBase", "m_angEyeAngles")]
public QAngle EyeAngles => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawnBase", "m_angEyeAngles");
// m_bVCollisionInitted
[SchemaMember("CCSPlayerPawnBase", "m_bVCollisionInitted")]
public ref bool VCollisionInitted => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bVCollisionInitted");
// m_storedSpawnPosition
[SchemaMember("CCSPlayerPawnBase", "m_storedSpawnPosition")]
public Vector StoredSpawnPosition => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_storedSpawnPosition");
// m_storedSpawnAngle
[SchemaMember("CCSPlayerPawnBase", "m_storedSpawnAngle")]
public QAngle StoredSpawnAngle => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawnBase", "m_storedSpawnAngle");
// m_bIsSpawning
[SchemaMember("CCSPlayerPawnBase", "m_bIsSpawning")]
public ref bool IsSpawning => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bIsSpawning");
// m_bHideTargetID
[SchemaMember("CCSPlayerPawnBase", "m_bHideTargetID")]
public ref bool HideTargetID => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bHideTargetID");
// m_nNumDangerZoneDamageHits
[SchemaMember("CCSPlayerPawnBase", "m_nNumDangerZoneDamageHits")]
public ref Int32 NumDangerZoneDamageHits => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nNumDangerZoneDamageHits");
// m_bHud_MiniScoreHidden
[SchemaMember("CCSPlayerPawnBase", "m_bHud_MiniScoreHidden")]
public ref bool Hud_MiniScoreHidden => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bHud_MiniScoreHidden");
@@ -458,42 +102,6 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_bHud_RadarHidden")]
public ref bool Hud_RadarHidden => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bHud_RadarHidden");
// m_nLastKillerIndex
[SchemaMember("CCSPlayerPawnBase", "m_nLastKillerIndex")]
public CEntityIndex LastKillerIndex => Schema.GetDeclaredClass<CEntityIndex>(this.Handle, "CCSPlayerPawnBase", "m_nLastKillerIndex");
// m_nLastConcurrentKilled
[SchemaMember("CCSPlayerPawnBase", "m_nLastConcurrentKilled")]
public ref Int32 LastConcurrentKilled => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nLastConcurrentKilled");
// m_nDeathCamMusic
[SchemaMember("CCSPlayerPawnBase", "m_nDeathCamMusic")]
public ref Int32 DeathCamMusic => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nDeathCamMusic");
// m_iAddonBits
[SchemaMember("CCSPlayerPawnBase", "m_iAddonBits")]
public ref Int32 AddonBits => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iAddonBits");
// m_iPrimaryAddon
[SchemaMember("CCSPlayerPawnBase", "m_iPrimaryAddon")]
public ref Int32 PrimaryAddon => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iPrimaryAddon");
// m_iSecondaryAddon
[SchemaMember("CCSPlayerPawnBase", "m_iSecondaryAddon")]
public ref Int32 SecondaryAddon => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iSecondaryAddon");
// m_currentDeafnessFilter
[SchemaMember("CCSPlayerPawnBase", "m_currentDeafnessFilter")]
public CUtlStringToken CurrentDeafnessFilter => Schema.GetDeclaredClass<CUtlStringToken>(this.Handle, "CCSPlayerPawnBase", "m_currentDeafnessFilter");
// m_NumEnemiesKilledThisSpawn
[SchemaMember("CCSPlayerPawnBase", "m_NumEnemiesKilledThisSpawn")]
public ref Int32 NumEnemiesKilledThisSpawn => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_NumEnemiesKilledThisSpawn");
// m_NumEnemiesKilledThisRound
[SchemaMember("CCSPlayerPawnBase", "m_NumEnemiesKilledThisRound")]
public ref Int32 NumEnemiesKilledThisRound => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_NumEnemiesKilledThisRound");
// m_NumEnemiesAtRoundStart
[SchemaMember("CCSPlayerPawnBase", "m_NumEnemiesAtRoundStart")]
public ref Int32 NumEnemiesAtRoundStart => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_NumEnemiesAtRoundStart");
@@ -502,76 +110,16 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_wasNotKilledNaturally")]
public ref bool WasNotKilledNaturally => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_wasNotKilledNaturally");
// m_vecPlayerPatchEconIndices
[SchemaMember("CCSPlayerPawnBase", "m_vecPlayerPatchEconIndices")]
public Span<UInt32> PlayerPatchEconIndices => Schema.GetFixedArray<UInt32>(this.Handle, "CCSPlayerPawnBase", "m_vecPlayerPatchEconIndices", 5);
// m_iDeathFlags
[SchemaMember("CCSPlayerPawnBase", "m_iDeathFlags")]
public ref Int32 DeathFlags => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iDeathFlags");
// m_hPet
[SchemaMember("CCSPlayerPawnBase", "m_hPet")]
public CHandle<CChicken> Pet => Schema.GetDeclaredClass<CHandle<CChicken>>(this.Handle, "CCSPlayerPawnBase", "m_hPet");
// m_unCurrentEquipmentValue
[SchemaMember("CCSPlayerPawnBase", "m_unCurrentEquipmentValue")]
public ref UInt16 CurrentEquipmentValue => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawnBase", "m_unCurrentEquipmentValue");
// m_unRoundStartEquipmentValue
[SchemaMember("CCSPlayerPawnBase", "m_unRoundStartEquipmentValue")]
public ref UInt16 RoundStartEquipmentValue => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawnBase", "m_unRoundStartEquipmentValue");
// m_unFreezetimeEndEquipmentValue
[SchemaMember("CCSPlayerPawnBase", "m_unFreezetimeEndEquipmentValue")]
public ref UInt16 FreezetimeEndEquipmentValue => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawnBase", "m_unFreezetimeEndEquipmentValue");
// m_nSurvivalTeamNumber
[SchemaMember("CCSPlayerPawnBase", "m_nSurvivalTeamNumber")]
public ref Int32 SurvivalTeamNumber => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nSurvivalTeamNumber");
// m_bHasDeathInfo
[SchemaMember("CCSPlayerPawnBase", "m_bHasDeathInfo")]
public ref bool HasDeathInfo => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bHasDeathInfo");
// m_flDeathInfoTime
[SchemaMember("CCSPlayerPawnBase", "m_flDeathInfoTime")]
public ref float DeathInfoTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flDeathInfoTime");
// m_vecDeathInfoOrigin
[SchemaMember("CCSPlayerPawnBase", "m_vecDeathInfoOrigin")]
public Vector DeathInfoOrigin => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecDeathInfoOrigin");
// m_bKilledByHeadshot
[SchemaMember("CCSPlayerPawnBase", "m_bKilledByHeadshot")]
public ref bool KilledByHeadshot => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bKilledByHeadshot");
// m_LastHitBox
[SchemaMember("CCSPlayerPawnBase", "m_LastHitBox")]
public ref Int32 LastHitBox => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_LastHitBox");
// m_LastHealth
[SchemaMember("CCSPlayerPawnBase", "m_LastHealth")]
public ref Int32 LastHealth => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_LastHealth");
// m_flLastCollisionCeiling
[SchemaMember("CCSPlayerPawnBase", "m_flLastCollisionCeiling")]
public ref float LastCollisionCeiling => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastCollisionCeiling");
// m_flLastCollisionCeilingChangeTime
[SchemaMember("CCSPlayerPawnBase", "m_flLastCollisionCeilingChangeTime")]
public ref float LastCollisionCeilingChangeTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastCollisionCeilingChangeTime");
// m_pBot
[SchemaMember("CCSPlayerPawnBase", "m_pBot")]
public CCSBot? Bot => Schema.GetPointer<CCSBot>(this.Handle, "CCSPlayerPawnBase", "m_pBot");
// m_bBotAllowActive
[SchemaMember("CCSPlayerPawnBase", "m_bBotAllowActive")]
public ref bool BotAllowActive => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bBotAllowActive");
// m_bCommittingSuicideOnTeamChange
[SchemaMember("CCSPlayerPawnBase", "m_bCommittingSuicideOnTeamChange")]
public ref bool CommittingSuicideOnTeamChange => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bCommittingSuicideOnTeamChange");
// m_hOriginalController
[SchemaMember("CCSPlayerPawnBase", "m_hOriginalController")]
public CHandle<CCSPlayerController> OriginalController => Schema.GetDeclaredClass<CHandle<CCSPlayerController>>(this.Handle, "CCSPlayerPawnBase", "m_hOriginalController");
}

View File

@@ -26,10 +26,6 @@ public partial class CCSPlayer_UseServices : CPlayer_UseServices
[SchemaMember("CCSPlayer_UseServices", "m_flLastUseTimeStamp")]
public ref float LastUseTimeStamp => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_UseServices", "m_flLastUseTimeStamp");
// m_flTimeStartedHoldingUse
[SchemaMember("CCSPlayer_UseServices", "m_flTimeStartedHoldingUse")]
public ref float TimeStartedHoldingUse => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_UseServices", "m_flTimeStartedHoldingUse");
// m_flTimeLastUsedWindow
[SchemaMember("CCSPlayer_UseServices", "m_flTimeLastUsedWindow")]
public ref float TimeLastUsedWindow => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_UseServices", "m_flTimeLastUsedWindow");

View File

@@ -66,6 +66,10 @@ public partial class CCSPlayer_WeaponServices : CPlayer_WeaponServices
[SchemaMember("CCSPlayer_WeaponServices", "m_bDisableAutoDeploy")]
public ref bool DisableAutoDeploy => ref Schema.GetRef<bool>(this.Handle, "CCSPlayer_WeaponServices", "m_bDisableAutoDeploy");
// m_bIsPickingUpGroundWeapon
[SchemaMember("CCSPlayer_WeaponServices", "m_bIsPickingUpGroundWeapon")]
public ref bool IsPickingUpGroundWeapon => ref Schema.GetRef<bool>(this.Handle, "CCSPlayer_WeaponServices", "m_bIsPickingUpGroundWeapon");
// m_nOldShootPositionHistoryCount
[SchemaMember("CCSPlayer_WeaponServices", "m_nOldShootPositionHistoryCount")]
public ref UInt32 OldShootPositionHistoryCount => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayer_WeaponServices", "m_nOldShootPositionHistoryCount");

View File

@@ -194,6 +194,14 @@ public partial class CCSWeaponBase : CBasePlayerWeapon
[SchemaMember("CCSWeaponBase", "m_iOriginalTeamNumber")]
public ref Int32 OriginalTeamNumber => ref Schema.GetRef<Int32>(this.Handle, "CCSWeaponBase", "m_iOriginalTeamNumber");
// m_iMostRecentTeamNumber
[SchemaMember("CCSWeaponBase", "m_iMostRecentTeamNumber")]
public ref Int32 MostRecentTeamNumber => ref Schema.GetRef<Int32>(this.Handle, "CCSWeaponBase", "m_iMostRecentTeamNumber");
// m_bDroppedNearBuyZone
[SchemaMember("CCSWeaponBase", "m_bDroppedNearBuyZone")]
public ref bool DroppedNearBuyZone => ref Schema.GetRef<bool>(this.Handle, "CCSWeaponBase", "m_bDroppedNearBuyZone");
// m_flNextAttackRenderTimeOffset
[SchemaMember("CCSWeaponBase", "m_flNextAttackRenderTimeOffset")]
public ref float NextAttackRenderTimeOffset => ref Schema.GetRef<float>(this.Handle, "CCSWeaponBase", "m_flNextAttackRenderTimeOffset");

View File

@@ -20,11 +20,11 @@ public partial class CDamageRecord : NativeObject
// m_PlayerDamager
[SchemaMember("CDamageRecord", "m_PlayerDamager")]
public CHandle<CCSPlayerPawnBase> PlayerDamager => Schema.GetDeclaredClass<CHandle<CCSPlayerPawnBase>>(this.Handle, "CDamageRecord", "m_PlayerDamager");
public CHandle<CCSPlayerPawn> PlayerDamager => Schema.GetDeclaredClass<CHandle<CCSPlayerPawn>>(this.Handle, "CDamageRecord", "m_PlayerDamager");
// m_PlayerRecipient
[SchemaMember("CDamageRecord", "m_PlayerRecipient")]
public CHandle<CCSPlayerPawnBase> PlayerRecipient => Schema.GetDeclaredClass<CHandle<CCSPlayerPawnBase>>(this.Handle, "CDamageRecord", "m_PlayerRecipient");
public CHandle<CCSPlayerPawn> PlayerRecipient => Schema.GetDeclaredClass<CHandle<CCSPlayerPawn>>(this.Handle, "CDamageRecord", "m_PlayerRecipient");
// m_hPlayerControllerDamager
[SchemaMember("CDamageRecord", "m_hPlayerControllerDamager")]

View File

@@ -114,10 +114,6 @@ public partial class CPlantedC4 : CBaseAnimGraph
[SchemaMember("CPlantedC4", "m_flNextBotBeepTime")]
public ref float NextBotBeepTime => ref Schema.GetRef<float>(this.Handle, "CPlantedC4", "m_flNextBotBeepTime");
// m_bPlantedAfterPickup
[SchemaMember("CPlantedC4", "m_bPlantedAfterPickup")]
public ref bool PlantedAfterPickup => ref Schema.GetRef<bool>(this.Handle, "CPlantedC4", "m_bPlantedAfterPickup");
// m_angCatchUpToPlayerEye
[SchemaMember("CPlantedC4", "m_angCatchUpToPlayerEye")]
public QAngle CatchUpToPlayerEye => Schema.GetDeclaredClass<QAngle>(this.Handle, "CPlantedC4", "m_angCatchUpToPlayerEye");

View File

@@ -22,4 +22,8 @@ public partial class CWeaponTaser : CCSWeaponBaseGun
[SchemaMember("CWeaponTaser", "m_fFireTime")]
public ref float FireTime => ref Schema.GetRef<float>(this.Handle, "CWeaponTaser", "m_fFireTime");
// m_nLastAttackTick
[SchemaMember("CWeaponTaser", "m_nLastAttackTick")]
public ref Int32 LastAttackTick => ref Schema.GetRef<Int32>(this.Handle, "CWeaponTaser", "m_nLastAttackTick");
}

View File

@@ -25,5 +25,6 @@ public enum PulseValueType_t : uint
PVAL_CURSOR_FLOW = 0xD,
PVAL_ANY = 0xE,
PVAL_SCHEMA_ENUM = 0xF,
PVAL_COUNT = 0x10,
PVAL_PANORAMA_PANEL_HANDLE = 0x10,
PVAL_COUNT = 0x11,
}

View File

@@ -28,7 +28,7 @@ public enum SoundFlags_t : uint
SOUND_CONTEXT_DANGER_APPROACH = 0x2000000,
SOUND_CONTEXT_ALLIES_ONLY = 0x4000000,
SOUND_CONTEXT_PANIC_NPCS = 0x8000000,
ALL_CONTEXTS = 0xFFFFFFFF,
ALL_CONTEXTS = 0xFFF00000,
ALL_SCENTS = 0x0,
ALL_SOUNDS = 0xFFFFF,
}

View File

@@ -11,4 +11,5 @@ public enum WeaponSwitchReason_t : uint
eDrawn = 0x0,
eEquipped = 0x1,
eUserInitiatedSwitchToLast = 0x2,
eUserInitiatedSwitchHands = 0x3,
}

View File

@@ -1,62 +1,73 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateCompatibilitySuppressionFile>true</GenerateCompatibilitySuppressionFile>
<EnablePackageValidation>true</EnablePackageValidation>
<NoWarn>$(NoWarn);CS1591;CP0003</NoWarn>
<Nullable>enable</Nullable>
<GenerateCompatibilitySuppressionFile>true</GenerateCompatibilitySuppressionFile>
<Authors>Roflmuffin</Authors>
<Description>Official server side runtime assembly for CounterStrikeSharp</Description>
<PackageProjectUrl>http://docs.cssharp.dev/</PackageProjectUrl>
<RepositoryUrl>https://github.com/roflmuffin/CounterStrikeSharp</RepositoryUrl>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<PropertyGroup>
<ApiCompatValidateAssemblies>true</ApiCompatValidateAssemblies>
<ApiCompatContractAssembly>.\ApiCompat\v151.dll</ApiCompatContractAssembly>
</PropertyGroup>
<ItemGroup>
<None Remove="Modules\Commands\CommandInfo" />
<None Remove="Modules\Disabled\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="McMaster.NETCore.Plugins" Version="1.4.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.DotNet.ApiCompat.Task" Version="7.0.404" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Scrutor" Version="4.2.2" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Core\Schema\" />
<Folder Include="Modules\Errors" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Modules\Disabled\**" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="Modules\Disabled\**" />
</ItemGroup>
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<!-- <Target Name="PreBuild" BeforeTargets="PreBuildEvent">-->
<!-- <Exec Command="dotnet run &#45;&#45;project ../../tooling/CodeGen.Natives" />-->
<!-- </Target>-->
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateCompatibilitySuppressionFile>true</GenerateCompatibilitySuppressionFile>
<EnablePackageValidation>true</EnablePackageValidation>
<NoWarn>$(NoWarn);CS1591;CP0003</NoWarn>
<Nullable>enable</Nullable>
<Authors>Roflmuffin</Authors>
<Description>Official server side runtime assembly for CounterStrikeSharp</Description>
<PackageProjectUrl>http://docs.cssharp.dev/</PackageProjectUrl>
<RepositoryUrl>https://github.com/roflmuffin/CounterStrikeSharp</RepositoryUrl>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<SourceControlInformationFeatureSupported>true</SourceControlInformationFeatureSupported>
<!-- <GenerateCompatibilitySuppressionFile>true</GenerateCompatibilitySuppressionFile> -->
</PropertyGroup>
<PropertyGroup>
<ApiCompatValidateAssemblies>true</ApiCompatValidateAssemblies>
<ApiCompatContractAssembly>.\ApiCompat\v202.dll</ApiCompatContractAssembly>
</PropertyGroup>
<ItemGroup>
<None Remove="Modules\Commands\CommandInfo"/>
<None Remove="Modules\Disabled\**"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="McMaster.NETCore.Plugins" Version="1.4.0"/>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0"/>
<PackageReference Include="Microsoft.DotNet.ApiCompat.Task" Version="8.0.203"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.3"/>
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0"/>
<PackageReference Include="Scrutor" Version="4.2.2"/>
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0"/>
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0"/>
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0"/>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0"/>
</ItemGroup>
<ItemGroup>
<Folder Include="Core\Schema\"/>
<Folder Include="Modules\Errors"/>
</ItemGroup>
<ItemGroup>
<Compile Remove="Modules\Disabled\**"/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="Modules\Disabled\**"/>
</ItemGroup>
<PropertyGroup/>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<Target Name="SetSourceRevisionId" BeforeTargets="InitializeSourceControlInformation">
<Exec
Command="git describe --long --always --exclude=* --abbrev=7"
ConsoleToMSBuild="True"
IgnoreExitCode="False"
>
<Output PropertyName="SourceRevisionId" TaskParameter="ConsoleOutput"/>
</Exec>
</Target>
<!-- <Target Name="PreBuild" BeforeTargets="PreBuildEvent">-->
<!-- <Exec Command="dotnet run &#45;&#45;project ../../tooling/CodeGen.Natives" />-->
<!-- </Target>-->
</Project>

View File

@@ -1,5 +1,7 @@
// Global using directives
global using System;
global using System.Linq;
global using System.IO;
global using System.Collections.Generic;
global using CounterStrikeSharp.API.Core;

View File

@@ -132,7 +132,6 @@ namespace CounterStrikeSharp.API.Modules.Admin
foreach (var adminDef in adminsFromFile.Values)
{
adminDef.InitalizeFlags();
Console.WriteLine($"Domains: {adminDef.Flags.Count}");
if (SteamID.TryParse(adminDef.Identity, out var steamId))
{

View File

@@ -23,6 +23,10 @@ namespace CounterStrikeSharp.API.Modules.Commands
{
public delegate void CommandCallback(CCSPlayerController? player, CommandInfo commandInfo);
/// <summary>
/// Command listener callback.
/// <returns>If returning <see cref="HookResult.Handled"/> or higher, will prevent the command from executing.</returns>
/// </summary>
public delegate HookResult CommandListenerCallback(CCSPlayerController? player, CommandInfo commandInfo);
public CCSPlayerController? CallingPlayer { get; }

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using CounterStrikeSharp.API.Modules.Entities;
@@ -12,7 +13,7 @@ public class Target
private string Raw { get; }
private string Slug { get; }
private static readonly Dictionary<string, TargetType> TargetTypeMap = new(StringComparer.OrdinalIgnoreCase)
public static readonly IReadOnlyDictionary<string, TargetType> TargetTypeMap = new Dictionary<string, TargetType>(StringComparer.OrdinalIgnoreCase)
{
{ "@all", TargetType.GroupAll },
{ "@bots", TargetType.GroupBots },
@@ -24,7 +25,7 @@ public class Target
{ "@ct", TargetType.TeamCt },
{ "@t", TargetType.TeamT },
{ "@spec", TargetType.TeamSpec }
};
}.ToFrozenDictionary();
private static bool ConstTargetType(string target, out TargetType targetType)

View File

@@ -18,34 +18,37 @@ namespace CounterStrikeSharp.API.Modules.Entities.Constants
{
public enum CollisionGroup
{
COLLISION_GROUP_NONE = 0,
COLLISION_GROUP_DEBRIS, // Collides with nothing but world and static stuff
COLLISION_GROUP_DEBRIS_TRIGGER, // Same as debris, but hits triggers
COLLISION_GROUP_INTERACTIVE_DEBRIS, // Collides with everything except other interactive debris or debris
COLLISION_GROUP_INTERACTIVE, // Collides with everything except interactive debris or debris
COLLISION_GROUP_NONE = 0,
COLLISION_GROUP_NEVER,
COLLISION_GROUP_TRIGGER,
COLLISION_GROUP_CONDITIONALLY_SOLID,
COLLISION_GROUP_DEFAULT,
COLLISION_GROUP_DEBRIS, // Collides with nothing but world and static stuff
COLLISION_GROUP_INTERACTIVE_DEBRIS, // Collides with everything except other interactive debris or debris
COLLISION_GROUP_INTERACTIVE, // Collides with everything except interactive debris or debris
COLLISION_GROUP_PLAYER,
COLLISION_GROUP_BREAKABLE_GLASS,
COLLISION_GROUP_VEHICLE,
COLLISION_GROUP_PLAYER_MOVEMENT, // For HL2, same as Collision_Group_Player, for
// TF2, this filters out other players and CBaseObjects
COLLISION_GROUP_NPC, // Generic NPC group
COLLISION_GROUP_IN_VEHICLE, // for any entity inside a vehicle
COLLISION_GROUP_WEAPON, // for any weapons that need collision detection
COLLISION_GROUP_VEHICLE_CLIP, // vehicle clip brush to restrict vehicle movement
COLLISION_GROUP_PROJECTILE, // Projectiles!
COLLISION_GROUP_DOOR_BLOCKER, // Blocks entities not permitted to get near moving doors
COLLISION_GROUP_PASSABLE_DOOR, // Doors that the player shouldn't collide with
COLLISION_GROUP_DISSOLVING, // Things that are dissolving are in this group
COLLISION_GROUP_PUSHAWAY, // Nonsolid on client and server, pushaway in player code
COLLISION_GROUP_PLAYER_MOVEMENT, // For HL2, same as Collision_Group_Player, for
COLLISION_GROUP_NPC_ACTOR, // Used so NPCs in scripts ignore the player.
COLLISION_GROUP_NPC_SCRIPTED, // USed for NPCs in scripts that should not collide with each other
// TF2, this filters out other players and CBaseObjects
COLLISION_GROUP_NPC, // Generic NPC group
COLLISION_GROUP_IN_VEHICLE, // for any entity inside a vehicle
COLLISION_GROUP_WEAPON, // for any weapons that need collision detection
COLLISION_GROUP_VEHICLE_CLIP, // vehicle clip brush to restrict vehicle movement
COLLISION_GROUP_PROJECTILE, // Projectiles!
COLLISION_GROUP_DOOR_BLOCKER, // Blocks entities not permitted to get near moving doors
COLLISION_GROUP_PASSABLE_DOOR, // Doors that the player shouldn't collide with
COLLISION_GROUP_DISSOLVING, // Things that are dissolving are in this group
COLLISION_GROUP_PUSHAWAY, // Nonsolid on client and server, pushaway in player code
COLLISION_GROUP_NPC_ACTOR, // Used so NPCs in scripts ignore the player.
COLLISION_GROUP_NPC_SCRIPTED, // USed for NPCs in scripts that should not collide with each other
COLLISION_GROUP_PZ_CLIP,
COLLISION_GROUP_DEBRIS_BLOCK_PROJECTILE, // Only collides with bullets
COLLISION_GROUP_PROPS,
LAST_SHARED_COLLISION_GROUP
}
}
}

Some files were not shown because too many files have changed in this diff Show More