mirror of
https://github.com/roflmuffin/CounterStrikeSharp.git
synced 2025-12-06 08:03:12 -08:00
Compare commits
176 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22f5c06c49 | ||
|
|
073728b4ce | ||
|
|
6511a0098a | ||
|
|
f50fb783bb | ||
|
|
49e8ab0e27 | ||
|
|
4be0634625 | ||
|
|
7025b62615 | ||
|
|
462ca52229 | ||
|
|
d7e23e8282 | ||
|
|
3ddfa71e3f | ||
|
|
688b226bcf | ||
|
|
0d23387347 | ||
|
|
68e6ffaebe | ||
|
|
2f8f370cd3 | ||
|
|
169d43e31d | ||
|
|
0ce4a2903c | ||
|
|
33b46eb214 | ||
|
|
a27ba3b005 | ||
|
|
57286c9990 | ||
|
|
ae808c05c8 | ||
|
|
c9f8e477d3 | ||
|
|
2398ba0a5d | ||
|
|
e45c20481d | ||
|
|
fe321ee93d | ||
|
|
be19103556 | ||
|
|
64cb26b86d | ||
|
|
637224dc55 | ||
|
|
3aca7c37f1 | ||
|
|
87f38d72ee | ||
|
|
5daf94791f | ||
|
|
c50213c442 | ||
|
|
c02d31cb2e | ||
|
|
98cbca44d4 | ||
|
|
4cf88fc03e | ||
|
|
f1dff6d4d3 | ||
|
|
414a59a36d | ||
|
|
f1c108087b | ||
|
|
47ddf42c11 | ||
|
|
ded133f1db | ||
|
|
bbc621acdc | ||
|
|
f7784c26c6 | ||
|
|
2da5448c8e | ||
|
|
e406b78044 | ||
|
|
3839831ea9 | ||
|
|
54ad6c0b79 | ||
|
|
7c2cc8a7f6 | ||
|
|
e99d27ca30 | ||
|
|
44d3c51bc7 | ||
|
|
f72e6d5daf | ||
|
|
c8bccb07e0 | ||
|
|
2c0640700a | ||
|
|
0f71e1aebe | ||
|
|
ac38ec249b | ||
|
|
cff24f4321 | ||
|
|
f05cc5e043 | ||
|
|
bd1105d752 | ||
|
|
9b4ee727c7 | ||
|
|
38d248defe | ||
|
|
6b4306948b | ||
|
|
3fee00e8c4 | ||
|
|
d22af142cb | ||
|
|
c1176a3192 | ||
|
|
3c321be5a0 | ||
|
|
466da1b193 | ||
|
|
ba860a92d2 | ||
|
|
461fc0ea67 | ||
|
|
6349c11d07 | ||
|
|
b2046b21c4 | ||
|
|
3c6be481c5 | ||
|
|
0a6fe0946d | ||
|
|
79297511e3 | ||
|
|
c6d3988902 | ||
|
|
8a063f4fb6 | ||
|
|
6cf124bfb6 | ||
|
|
1f904a52a7 | ||
|
|
32c99b2e49 | ||
|
|
5c9d38b2b0 | ||
|
|
b54f5c3dee | ||
|
|
761380dff6 | ||
|
|
71ae253e5e | ||
|
|
c2f212df51 | ||
|
|
ad7f7bd365 | ||
|
|
a0fcb7817e | ||
|
|
cdb7a6ed17 | ||
|
|
38e29531c3 | ||
|
|
5f95969980 | ||
|
|
42dd270b78 | ||
|
|
b807c3eda8 | ||
|
|
3ede4c366c | ||
|
|
49cc91e373 | ||
|
|
8a795de9fa | ||
|
|
e36d2e07e4 | ||
|
|
cdd2a8275e | ||
|
|
2b31f519eb | ||
|
|
2c7f896189 | ||
|
|
5a354a25e3 | ||
|
|
74ce0d295a | ||
|
|
9c8f25f721 | ||
|
|
4b1a2c427e | ||
|
|
8f59fd5b97 | ||
|
|
cbeac50e4a | ||
|
|
eba7d9c313 | ||
|
|
23828153eb | ||
|
|
0e3698b370 | ||
|
|
bb38b1cb1a | ||
|
|
10f472ec85 | ||
|
|
28ce183cdc | ||
|
|
dddf24d0f3 | ||
|
|
fce68cb160 | ||
|
|
a82faeb5c8 | ||
|
|
ce3ff449b9 | ||
|
|
aa40d81a86 | ||
|
|
5644921873 | ||
|
|
3860ca1662 | ||
|
|
b79fd19c85 | ||
|
|
b7ea025b03 | ||
|
|
5ac173df51 | ||
|
|
c82a58f5ab | ||
|
|
1806919559 | ||
|
|
f8451c2818 | ||
|
|
a87bd25b48 | ||
|
|
9c5468e5ba | ||
|
|
f826be664f | ||
|
|
7f5103d9ee | ||
|
|
877b7c5a4a | ||
|
|
24363d6352 | ||
|
|
2eaf7c2d8c | ||
|
|
8b486ecf7e | ||
|
|
54cc93e0f8 | ||
|
|
a695eec4fa | ||
|
|
e207be2fbf | ||
|
|
eea64519a6 | ||
|
|
13ec19e412 | ||
|
|
3240a5e582 | ||
|
|
cafc4e237f | ||
|
|
02d5191e74 | ||
|
|
aec696abc0 | ||
|
|
c01aeec14b | ||
|
|
41e7bee85a | ||
|
|
9834271956 | ||
|
|
fb5967d102 | ||
|
|
928bc3f74d | ||
|
|
6a7d7dba4f | ||
|
|
11e5e9972d | ||
|
|
9a221b4ebb | ||
|
|
e270bdfd44 | ||
|
|
f591fe58d0 | ||
|
|
052cb4e14e | ||
|
|
bc3bec4aa8 | ||
|
|
20bab7f4a8 | ||
|
|
c7eac71109 | ||
|
|
e3d2370e2e | ||
|
|
142242744c | ||
|
|
0eebffd860 | ||
|
|
25ca5dbe0c | ||
|
|
7cae4be96d | ||
|
|
83bc1a95fb | ||
|
|
71c694b52e | ||
|
|
a452d79ba3 | ||
|
|
dfc9859806 | ||
|
|
f99f58402a | ||
|
|
6317559bd2 | ||
|
|
ad6e1ca2e2 | ||
|
|
2564ef9f39 | ||
|
|
83a341d3cf | ||
|
|
534fc42444 | ||
|
|
41355d05fa | ||
|
|
d9da15be83 | ||
|
|
75e2f6e8aa | ||
|
|
37b34e1d41 | ||
|
|
5ce04649fd | ||
|
|
7b7202fe8a | ||
|
|
cadb817ed2 | ||
|
|
211516cce5 | ||
|
|
ab211a42e6 | ||
|
|
696ecadee4 |
@@ -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: Never
|
||||
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
|
||||
|
||||
19
.devcontainer/linux/devcontainer.json
Normal file
19
.devcontainer/linux/devcontainer.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "SteamRT Sniper SDK",
|
||||
"image": "registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest",
|
||||
"updateContentCommand": "git submodule update --init --recursive",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"ms-dotnettools.csdevkit",
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cpptools-extension-pack",
|
||||
"GitHub.copilot",
|
||||
"jeff-hykin.better-cpp-syntax"
|
||||
]
|
||||
}
|
||||
},
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/dotnet": "8.0"
|
||||
}
|
||||
}
|
||||
14
.editorconfig
Normal file
14
.editorconfig
Normal 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,*.yaml,*.yml}]
|
||||
indent_size = 2
|
||||
13
.github/dependabot.yaml
vendored
Normal file
13
.github/dependabot.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
version: 2
|
||||
updates:
|
||||
# Update the submodule in libraries/hl2sdk-cs2 every day
|
||||
- package-ecosystem: "gitsubmodule"
|
||||
directory: "/"
|
||||
allow:
|
||||
- dependency-name: "libraries/hl2sdk-cs2"
|
||||
- dependency-name: "libraries/metamod-source"
|
||||
- dependency-name: "libraries/Protobufs"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
commit-message:
|
||||
prefix: "chore(deps)"
|
||||
21
.github/workflows/actionlint.yaml
vendored
Normal file
21
.github/workflows/actionlint.yaml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: actionlint
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
paths:
|
||||
- ".github/actions/**"
|
||||
- ".github/workflows/**"
|
||||
|
||||
jobs:
|
||||
actionlint:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 3
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: actionlint
|
||||
uses: reviewdog/action-actionlint@v1
|
||||
with:
|
||||
reporter: github-pr-review
|
||||
fail_on_error: true
|
||||
270
.github/workflows/build-and-publish.yml
vendored
Normal file
270
.github/workflows/build-and-publish.yml
vendored
Normal file
@@ -0,0 +1,270 @@
|
||||
name: Build & Publish
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
|
||||
# Remove default permissions of GITHUB_TOKEN for security
|
||||
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
|
||||
permissions: {}
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "docfx/**"
|
||||
branches: ["main"]
|
||||
tags:
|
||||
- "v*"
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
gitversion_semver: ${{ steps.gitversion.outputs.semVer }}
|
||||
gitversion_fullsemver: ${{ steps.gitversion.outputs.fullSemVer }}
|
||||
gitversion_assemblysemver: ${{ steps.gitversion.outputs.assemblySemVer }}
|
||||
gitversion_informationalversion: ${{ steps.gitversion.outputs.informationalVersion }}
|
||||
steps:
|
||||
- name: Install GitVersion
|
||||
uses: gittools/actions/gitversion/setup@v1
|
||||
with:
|
||||
versionSpec: 6.0.x
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Execute GitVersion
|
||||
id: gitversion
|
||||
uses: gittools/actions/gitversion/execute@v1
|
||||
with:
|
||||
useConfigFile: true
|
||||
|
||||
build_windows:
|
||||
needs: setup
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Prepare env
|
||||
shell: bash
|
||||
run: |
|
||||
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
echo "SEMVER=${{ needs.setup.outputs.gitversion_semver }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Visual Studio environment
|
||||
shell: cmd
|
||||
run: |
|
||||
:: See https://github.com/microsoft/vswhere/wiki/Find-VC
|
||||
for /f "usebackq delims=*" %%i in (`vswhere -latest -property installationPath`) do (
|
||||
call "%%i"\Common7\Tools\vsdevcmd.bat -arch=x64 -host_arch=x64
|
||||
)
|
||||
|
||||
:: Loop over all environment variables and make them global.
|
||||
for /f "delims== tokens=1,2" %%a in ('set') do (
|
||||
echo>>"%GITHUB_ENV%" %%a=%%b
|
||||
)
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ..
|
||||
cmake --build . --config ${{env.BUILD_TYPE}} -- /m:16
|
||||
|
||||
- name: Clean build directory
|
||||
run: |
|
||||
mkdir -p build/addons/counterstrikesharp/bin/win64
|
||||
mv build/${{env.BUILD_TYPE}}/*.dll build/addons/counterstrikesharp/bin/win64
|
||||
mkdir build/output/
|
||||
mv build/addons build/output
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: counterstrikesharp-windows-${{ needs.setup.outputs.gitversion_semver }}
|
||||
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:
|
||||
image: registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest
|
||||
steps:
|
||||
- name: Prepare env
|
||||
shell: bash
|
||||
run: |
|
||||
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
echo "SEMVER=${{ needs.setup.outputs.gitversion_semver }}" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ..
|
||||
cmake --build . --config ${{env.BUILD_TYPE}} -- -j16
|
||||
|
||||
- name: Clean build directory
|
||||
run: |
|
||||
mkdir build/output/
|
||||
mv build/addons build/output
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: counterstrikesharp-linux-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: build/output/
|
||||
|
||||
build_managed:
|
||||
needs: setup
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Prepare env
|
||||
shell: bash
|
||||
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
|
||||
# We don't need expensive submodules for the managed side.
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build runtime v${{ needs.setup.outputs.gitversion_semver }}
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: "8.0.x"
|
||||
|
||||
- name: Install dependencies
|
||||
run: dotnet restore managed/CounterStrikeSharp.sln
|
||||
|
||||
- name: Run tests
|
||||
run: dotnet test --logger trx --results-directory "TestResults-${{ needs.setup.outputs.gitversion_semver }}" managed/CounterStrikeSharp.API.Tests/CounterStrikeSharp.API.Tests.csproj
|
||||
|
||||
- name: Upload dotnet test results
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-results-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: TestResults-${{ needs.setup.outputs.gitversion_semver }}
|
||||
if: ${{ always() }}
|
||||
|
||||
- name: Publish artifacts
|
||||
run: |
|
||||
dotnet publish -c Release \
|
||||
/p:Version=${{ needs.setup.outputs.gitversion_semver }} \
|
||||
/p:AssemblyVersion=${{ needs.setup.outputs.gitversion_assemblySemver }} \
|
||||
/p:InformationalVersion=${{ needs.setup.outputs.gitversion_informationalversion }} \
|
||||
managed/CounterStrikeSharp.API
|
||||
|
||||
dotnet pack -c Release \
|
||||
/p:Version=${{ needs.setup.outputs.gitversion_semver }} \
|
||||
/p:AssemblyVersion=${{ needs.setup.outputs.gitversion_assemblySemver }} \
|
||||
/p:InformationalVersion=${{ needs.setup.outputs.gitversion_informationalversion }} \
|
||||
managed/CounterStrikeSharp.API
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: counterstrikesharp-api-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: managed/CounterStrikeSharp.API/bin/Release
|
||||
|
||||
publish:
|
||||
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'roflmuffin/CounterStrikeSharp' }}
|
||||
permissions:
|
||||
contents: write
|
||||
needs: ["setup", "build_linux", "build_windows", "build_managed"]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Prepare env
|
||||
shell: bash
|
||||
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: counterstrikesharp-windows-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: build/windows
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: counterstrikesharp-linux-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: build/linux
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: counterstrikesharp-api-${{ needs.setup.outputs.gitversion_semver }}
|
||||
path: build/api
|
||||
|
||||
# TODO: This stuff should really be in a matrix
|
||||
- name: Add API to Artifacts
|
||||
run: |
|
||||
mkdir -p build/linux/addons/counterstrikesharp/api
|
||||
mkdir -p 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-linux-${{ needs.setup.outputs.gitversion_semver }}.zip *)
|
||||
(cd build/windows && zip -qq -r ../../counterstrikesharp-windows-${{ needs.setup.outputs.gitversion_semver }}.zip *)
|
||||
|
||||
- name: Add dotnet runtime
|
||||
run: |
|
||||
mkdir -p build/linux/addons/counterstrikesharp/dotnet
|
||||
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
|
||||
|
||||
mkdir -p build/windows/addons/counterstrikesharp/dotnet
|
||||
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-linux-${{ needs.setup.outputs.gitversion_semver }}.zip *)
|
||||
(cd build/windows && zip -qq -r ../../counterstrikesharp-with-runtime-windows-${{ needs.setup.outputs.gitversion_semver }}.zip *)
|
||||
|
||||
- name: Generate a changelog
|
||||
uses: orhun/git-cliff-action@v4
|
||||
id: git-cliff
|
||||
with:
|
||||
config: cliff.toml
|
||||
args: --current -s footer
|
||||
|
||||
- name: Release
|
||||
id: release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
append_body: true
|
||||
body: |
|
||||
${{ steps.git-cliff.outputs.content }}
|
||||
|
||||
Please refer to [CHANGELOG.md](https://github.com/roflmuffin/CounterStrikeSharp/blob/${{ github.ref_name }}/CHANGELOG.md) for details.
|
||||
files: |
|
||||
counterstrikesharp-windows-${{ needs.setup.outputs.gitversion_semver }}.zip
|
||||
counterstrikesharp-with-runtime-windows-${{ needs.setup.outputs.gitversion_semver }}.zip
|
||||
counterstrikesharp-linux-${{ needs.setup.outputs.gitversion_semver }}.zip
|
||||
counterstrikesharp-with-runtime-linux-${{ needs.setup.outputs.gitversion_semver }}.zip
|
||||
|
||||
- name: Publish NuGet package
|
||||
run: |
|
||||
dotnet nuget push build/api/CounterStrikeSharp.API.${{ needs.setup.outputs.gitversion_semver }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
||||
dotnet nuget push build/api/CounterStrikeSharp.API.${{ needs.setup.outputs.gitversion_semver }}.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.setup.outputs.gitversion_semver }}](${{ steps.release.outputs.url }})
|
||||
|
||||
${{ steps.git-cliff.outputs.content }}
|
||||
|
||||
Please refer to [CHANGELOG.md](https://github.com/roflmuffin/CounterStrikeSharp/blob/${{ github.ref_name }}/CHANGELOG.md) for details.
|
||||
248
.github/workflows/cmake-single-platform.yml
vendored
248
.github/workflows/cmake-single-platform.yml
vendored
@@ -1,248 +0,0 @@
|
||||
name: Build & Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "docfx/**"
|
||||
branches: ["main", "dev"]
|
||||
pull_request:
|
||||
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: |
|
||||
:: See https://github.com/microsoft/vswhere/wiki/Find-VC
|
||||
for /f "usebackq delims=*" %%i in (`vswhere -latest -property installationPath`) do (
|
||||
call "%%i"\Common7\Tools\vsdevcmd.bat -arch=x64 -host_arch=x64
|
||||
)
|
||||
|
||||
:: Loop over all environment variables and make them global.
|
||||
for /f "delims== tokens=1,2" %%a in ('set') do (
|
||||
echo>>"%GITHUB_ENV%" %%a=%%b
|
||||
)
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ..
|
||||
cmake --build . --config ${{env.BUILD_TYPE}} -- /m:16
|
||||
|
||||
- name: Clean build directory
|
||||
run: |
|
||||
mkdir -p build/addons/counterstrikesharp/bin/win64
|
||||
mv build/${{env.BUILD_TYPE}}/*.dll build/addons/counterstrikesharp/bin/win64
|
||||
mkdir build/output/
|
||||
mv build/addons build/output
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: counterstrikesharp-build-windows-${{ env.GITHUB_SHA_SHORT }}
|
||||
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:
|
||||
image: registry.gitlab.steamos.cloud/steamrt/sniper/sdk: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
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ..
|
||||
cmake --build . --config ${{env.BUILD_TYPE}} -- -j16
|
||||
|
||||
- name: Clean build directory
|
||||
run: |
|
||||
mkdir build/output/
|
||||
mv build/addons build/output
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: counterstrikesharp-build-linux-${{ env.GITHUB_SHA_SHORT }}
|
||||
path: build/output/
|
||||
|
||||
build_managed:
|
||||
needs: setup
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-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
|
||||
|
||||
# We don't need expensive submodules for the managed side.
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Build runtime v${{ env.BUILD_NUMBER }}
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: "8.0.x"
|
||||
|
||||
- name: Install dependencies
|
||||
run: dotnet restore managed/CounterStrikeSharp.sln
|
||||
|
||||
- name: Run tests
|
||||
run: dotnet test --logger trx --results-directory "TestResults-${{ env.GITHUB_SHA_SHORT }}" managed/CounterStrikeSharp.API.Tests/CounterStrikeSharp.API.Tests.csproj
|
||||
|
||||
- name: Upload dotnet test results
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-results-${{ env.GITHUB_SHA_SHORT }}
|
||||
path: TestResults-${{ env.GITHUB_SHA_SHORT }}
|
||||
if: ${{ always() }}
|
||||
|
||||
- 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
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: counterstrikesharp-build-api-${{ env.GITHUB_SHA_SHORT }}
|
||||
path: managed/CounterStrikeSharp.API/bin/Release
|
||||
|
||||
publish:
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||
permissions:
|
||||
contents: write
|
||||
needs: ["setup", "build_linux", "build_windows", "build_managed"]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Prepare env
|
||||
shell: bash
|
||||
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: counterstrikesharp-build-windows-${{ env.GITHUB_SHA_SHORT }}
|
||||
path: build/windows
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: counterstrikesharp-build-linux-${{ env.GITHUB_SHA_SHORT }}
|
||||
path: build/linux
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: counterstrikesharp-build-api-${{ env.GITHUB_SHA_SHORT }}
|
||||
path: build/api
|
||||
|
||||
# TODO: This stuff should really be in a matrix
|
||||
- name: Add API to Artifacts
|
||||
run: |
|
||||
mkdir -p build/linux/addons/counterstrikesharp/api
|
||||
mkdir -p 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.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/c1371dc2-eed2-47be-9af3-ae060dbe3c7d/bd509e0a87629764ed47608466d183e6/aspnetcore-runtime-8.0.3-linux-x64.tar.gz \
|
||||
| tar xvz -C build/linux/addons/counterstrikesharp/dotnet
|
||||
|
||||
mkdir -p build/windows/addons/counterstrikesharp/dotnet
|
||||
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.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.setup.outputs.buildnumber }}
|
||||
files: |
|
||||
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.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.setup.outputs.buildnumber }}) at ${{ steps.release.outputs.url }}"
|
||||
25
.github/workflows/lint-code.yaml
vendored
Normal file
25
.github/workflows/lint-code.yaml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: Code format checks
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/**'
|
||||
- 'src/**'
|
||||
- '.clang-format'
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/**'
|
||||
- 'src/**'
|
||||
- '.clang-format'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint code with clang-format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: jidicula/clang-format-action@4726374d1aa3c6aecf132e5197e498979588ebc8
|
||||
with:
|
||||
clang-format-version: '20'
|
||||
check-path: 'src'
|
||||
exclude-regex: '(sdk|\.proto)'
|
||||
11
.github/workflows/publish-docs.yml
vendored
11
.github/workflows/publish-docs.yml
vendored
@@ -2,6 +2,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -22,10 +23,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Dotnet Setup
|
||||
uses: actions/setup-dotnet@v3
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.x
|
||||
|
||||
@@ -34,13 +35,13 @@ jobs:
|
||||
- run: docfx docfx/docfx.json
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v3
|
||||
uses: actions/configure-pages@v4
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v2
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: "docfx/_site"
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v2
|
||||
uses: actions/deploy-pages@v4
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,8 +2,8 @@
|
||||
.cmake/
|
||||
cmake-build-*/
|
||||
.kdev4/
|
||||
.vscode/
|
||||
generated/
|
||||
!**/protobuf/generated/
|
||||
|
||||
# configure_file auto generated.
|
||||
configs/addons/metamod/counterstrikesharp.vdf
|
||||
@@ -12,6 +12,7 @@ libraries/mono/
|
||||
|
||||
CMakeSettings.json
|
||||
|
||||
build-*/
|
||||
build/
|
||||
build_test/
|
||||
|
||||
|
||||
4
.vscode/settings.json
vendored
Normal file
4
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"editor.defaultFormatter": null,
|
||||
"editor.formatOnSave": true
|
||||
}
|
||||
1373
CHANGELOG.md
Normal file
1373
CHANGELOG.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,8 @@ project(counterstrikesharp C CXX ASM)
|
||||
|
||||
include("makefiles/shared.cmake")
|
||||
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
|
||||
add_subdirectory(libraries/spdlog)
|
||||
add_subdirectory(libraries/dyncall)
|
||||
add_subdirectory(libraries/funchook)
|
||||
@@ -13,7 +15,10 @@ add_subdirectory(libraries/DynoHook)
|
||||
set_property(TARGET dynohook PROPERTY DYNO_ARCH_X86 64)
|
||||
set_property(TARGET funchook-static PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
SET(SOURCE_FILES
|
||||
include("makefiles/protobuf.cmake")
|
||||
|
||||
set(SOURCE_FILES
|
||||
libraries/hl2sdk-cs2/public/tier0/memoverride.cpp
|
||||
src/mm_plugin.cpp
|
||||
src/mm_plugin.h
|
||||
libraries/hl2sdk-cs2/tier1/convar.cpp
|
||||
@@ -53,8 +58,6 @@ SET(SOURCE_FILES
|
||||
src/core/tick_scheduler.cpp
|
||||
src/scripting/autonative.h
|
||||
src/scripting/natives/natives_engine.cpp
|
||||
src/core/engine_trace.h
|
||||
src/core/engine_trace.cpp
|
||||
src/scripting/natives/natives_callbacks.cpp
|
||||
src/core/managers/player_manager.h
|
||||
src/core/managers/player_manager.cpp
|
||||
@@ -70,7 +73,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
|
||||
@@ -81,6 +83,7 @@ SET(SOURCE_FILES
|
||||
src/scripting/natives/natives_schema.cpp
|
||||
src/scripting/natives/natives_entities.cpp
|
||||
src/scripting/natives/natives_voice.cpp
|
||||
src/scripting/natives/natives_metamod.cpp
|
||||
src/core/managers/entity_manager.cpp
|
||||
src/core/managers/entity_manager.h
|
||||
src/core/managers/chat_manager.cpp
|
||||
@@ -88,74 +91,48 @@ SET(SOURCE_FILES
|
||||
src/core/managers/server_manager.cpp
|
||||
src/core/managers/server_manager.h
|
||||
src/scripting/natives/natives_server.cpp
|
||||
src/scripting/natives/natives_usermessages.cpp
|
||||
libraries/nlohmann/json.hpp
|
||||
src/core/managers/voice_manager.cpp
|
||||
src/core/managers/voice_manager.h
|
||||
src/core/managers/usermessage_manager.cpp
|
||||
src/core/managers/usermessage_manager.h
|
||||
src/scripting/natives/natives_dynamichooks.cpp
|
||||
src/core/game_system.h
|
||||
src/core/game_system.cpp
|
||||
src/core/UserMessage.h
|
||||
src/core/UserMessage.cpp
|
||||
src/core/recipientfilters.h
|
||||
)
|
||||
|
||||
|
||||
if (LINUX)
|
||||
# memoverride.cpp is not usable on CMake Windows, cuz CMake default link libraries (seems) always link ucrt.lib
|
||||
set(SOURCE_FILES
|
||||
${SOURCE_FILES}
|
||||
libraries/hl2sdk-cs2/public/tier0/memoverride.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
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)
|
||||
set(PROTOC_EXECUTABLE ${CMAKE_CURRENT_SOURCE_DIR}/libraries/hl2sdk-cs2/devtools/bin/linux/protoc)
|
||||
elseif(WIN32)
|
||||
set(PROTOC_EXECUTABLE ${CMAKE_CURRENT_SOURCE_DIR}/libraries/hl2sdk-cs2/devtools/bin/protoc.exe)
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT protobuf_output_stamp
|
||||
COMMAND ${PROTOC_EXECUTABLE} --proto_path=thirdparty/protobuf-3.21.8/src --proto_path=common --cpp_out=common common/network_connection.proto
|
||||
COMMENT "Generating protobuf file"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/libraries/hl2sdk-cs2
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
SET(SOURCE_FILES ${SOURCE_FILES} protobuf_output_stamp)
|
||||
|
||||
# Sources
|
||||
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${NATIVES_SOURCES} ${CONVERSIONS_SOURCES} ${CONVERSIONS_HEADERS})
|
||||
|
||||
target_include_directories(
|
||||
${PROJECT_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cs2_sdk
|
||||
${PROJECT_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cs2_sdk
|
||||
)
|
||||
|
||||
if (LINUX)
|
||||
if(LINUX)
|
||||
include("makefiles/linux.base.cmake")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
PREFIX ""
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/addons/counterstrikesharp/bin/linuxsteamrt64"
|
||||
PREFIX ""
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/addons/counterstrikesharp/bin/linuxsteamrt64"
|
||||
)
|
||||
elseif(WIN32)
|
||||
include("makefiles/windows.base.cmake")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
PREFIX ""
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/addons/counterstrikesharp/bin/win64"
|
||||
PREFIX ""
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/addons/counterstrikesharp/bin/win64"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
# Libraries
|
||||
target_link_libraries(${PROJECT_NAME} ${COUNTER_STRIKE_SHARP_LINK_LIBRARIES})
|
||||
target_link_libraries(${PROJECT_NAME} ${COUNTER_STRIKE_SHARP_LINK_LIBRARIES} Protobufs)
|
||||
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT_NAME} PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_SOURCE_DIR}/configs ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
TARGET ${PROJECT_NAME} PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_SOURCE_DIR}/configs ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
103
CONTRIBUTING.md
Normal file
103
CONTRIBUTING.md
Normal 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
|
||||
1
GitVersion.yml
Normal file
1
GitVersion.yml
Normal file
@@ -0,0 +1 @@
|
||||
workflow: GitHubFlow/v1
|
||||
30
README.md
30
README.md
@@ -1,15 +1,19 @@
|
||||
# CounterStrikeSharp
|
||||
<div align=right>Table of Contents ↗️</div>
|
||||
|
||||
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.
|
||||
<h1 align=center><code>CounterStrikeSharp</code></h1>
|
||||
|
||||
<div align=center>
|
||||
<a href=https://github.com/roflmuffin/CounterStrikeSharp/releases><img src=https://img.shields.io/github/v/release/roflmuffin/CounterStrikeSharp?style=flat-square&label=latest></a>
|
||||
<a href=https://github.com/roflmuffin/CounterStrikeSharp/releases><img src=https://img.shields.io/github/release-date/roflmuffin/CounterStrikeSharp?style=flat-square&label=last%20release></a>
|
||||
<a href=https://github.com/roflmuffin/CounterStrikeSharp/releases><img src=https://img.shields.io/github/downloads/roflmuffin/CounterStrikeSharp/total.svg?style=flat-square alt=downloads></a>
|
||||
<a href=https://discord.gg/eAZU3guKWU><img src=https://img.shields.io/discord/1160907911501991946?logo=discord&cacheSeconds=3500&style=flat-square alt="chat on discord"></a>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
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)
|
||||
|
||||
## History
|
||||
|
||||
This project is an ongoing migration of a previous project (titled [VSP.NET](https://github.com/roflmuffin/vspdotnet)) whereby a scripting layer was added to a Valve Server Plugin for CSGO.
|
||||
|
||||
Due to the architectural changes of CS2, the plugin is being rebuilt on the ground up, to support Linux 64-bit, something which was previously impossible.
|
||||
|
||||
## Install
|
||||
|
||||
Download the latest build from [here](https://github.com/roflmuffin/CounterStrikeSharp/releases). (Download the with runtime version if this is your first time installing).
|
||||
@@ -18,14 +22,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 +36,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
|
||||
@@ -81,7 +83,7 @@ public class HelloWorldPlugin : BasePlugin
|
||||
return HookResult.Continue;
|
||||
}
|
||||
|
||||
[ConsoleCommand("issue_warning", "Issue warning to player")]
|
||||
[ConsoleCommand("css_issue_warning", "Issue warning to player")]
|
||||
public void OnCommand(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
Logger.LogWarning("Player shouldn't be doing that");
|
||||
|
||||
85
cliff.toml
Normal file
85
cliff.toml
Normal file
@@ -0,0 +1,85 @@
|
||||
# git-cliff ~ configuration file
|
||||
# https://git-cliff.org/docs/configuration
|
||||
|
||||
[remote.github]
|
||||
owner = "roflmuffin"
|
||||
repo = "CounterStrikeSharp"
|
||||
# token = ""
|
||||
|
||||
[changelog]
|
||||
# A Tera template to be rendered for each release in the changelog.
|
||||
# See https://keats.github.io/tera/docs/#introduction
|
||||
body = """
|
||||
## What's Changed
|
||||
|
||||
{%- if version %} in {{ version }}{%- endif -%}
|
||||
{% for commit in commits %}
|
||||
* {{ commit.message | split(pat="\n") | first | trim }}\
|
||||
{% if commit.remote.username and commit.remote.username != remote.github.owner %} by \
|
||||
[@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }}) \
|
||||
{%- endif -%}
|
||||
{% if commit.remote.pr_number %} in \
|
||||
[#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }})\
|
||||
{%- endif %}
|
||||
{%- if commit.id %} ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url()}}/commit/{{ commit.id }})){%- endif -%}
|
||||
|
||||
{%- endfor -%}
|
||||
|
||||
{%- if github -%}
|
||||
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
|
||||
{% raw %}\n{% endraw -%}
|
||||
## New Contributors
|
||||
{%- endif %}\
|
||||
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
|
||||
* [@{{ contributor.username }}](https://github.com/{{ contributor.username }}) made their first contribution
|
||||
{%- if contributor.pr_number %} in \
|
||||
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
|
||||
{%- endif %}
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
|
||||
{% if version %}
|
||||
|
||||
{% else -%}
|
||||
{% raw %}\n{% endraw %}
|
||||
{% endif %}
|
||||
|
||||
{%- macro remote_url() -%}
|
||||
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
|
||||
{%- endmacro -%}
|
||||
"""
|
||||
# Remove leading and trailing whitespaces from the changelog's body.
|
||||
trim = true
|
||||
# A Tera template to be rendered as the changelog's footer.
|
||||
# See https://keats.github.io/tera/docs/#introduction
|
||||
footer = """
|
||||
<!-- generated by git-cliff -->
|
||||
"""
|
||||
# An array of regex based postprocessors to modify the changelog.
|
||||
# Replace the placeholder `<REPO>` with a URL.
|
||||
postprocessors = []
|
||||
|
||||
[git]
|
||||
# Parse commits according to the conventional commits specification.
|
||||
# See https://www.conventionalcommits.org
|
||||
conventional_commits = false
|
||||
# Exclude commits that do not match the conventional commits specification.
|
||||
filter_unconventional = true
|
||||
# Split commits on newlines, treating each line as an individual commit.
|
||||
split_commits = false
|
||||
# An array of regex based parsers to modify commit messages prior to further processing.
|
||||
commit_preprocessors = [
|
||||
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
|
||||
{ pattern = '\[no ci\]', replace = "" }
|
||||
]
|
||||
commit_parsers = [
|
||||
{ message = "^release:", skip = true }
|
||||
]
|
||||
# Exclude commits that are not matched by any commit parser.
|
||||
filter_commits = false
|
||||
# Order releases topologically instead of chronologically.
|
||||
topo_order = false
|
||||
# Order of commits in each group/release within the changelog.
|
||||
# Allowed values: newest, oldest
|
||||
sort_commits = "newest"
|
||||
tag_pattern = "v[0-9]+\\.[0-9]+\\.[0-9]+"
|
||||
@@ -4,5 +4,7 @@
|
||||
"FollowCS2ServerGuidelines": true,
|
||||
"PluginHotReloadEnabled": true,
|
||||
"PluginAutoLoadEnabled": true,
|
||||
"ServerLanguage": "en"
|
||||
"ServerLanguage": "en",
|
||||
"UnlockConCommands": true,
|
||||
"UnlockConVars": true
|
||||
}
|
||||
@@ -2,190 +2,237 @@
|
||||
"UTIL_ClientPrintAll": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x48\\x89\\x5C\\x24\\x08\\x48\\x89\\x6C\\x24\\x10\\x48\\x89\\x74\\x24\\x18\\x57\\x48\\x81\\xEC\\x70\\x01\\x2A\\x2A\\x8B\\xE9",
|
||||
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x49\\x89\\xD7\\x41\\x56\\x49\\x89\\xF6\\x41\\x55\\x41\\x89\\xFD"
|
||||
"windows": "48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 81 EC 70 01 ? ? 8B E9",
|
||||
"linux": "55 48 89 E5 41 57 49 89 D7 41 56 49 89 F6 41 55 41 89 FD"
|
||||
}
|
||||
},
|
||||
"ClientPrint": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x48\\x85\\xC9\\x0F\\x84\\x2A\\x2A\\x2A\\x2A\\x48\\x8B\\xC4\\x48\\x89\\x58\\x18",
|
||||
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x49\\x89\\xCF\\x41\\x56\\x49\\x89\\xD6\\x41\\x55\\x41\\x89\\xF5\\x41\\x54\\x4C\\x8D\\xA5\\xA0\\xFE\\xFF\\xFF"
|
||||
"windows": "48 85 C9 0F 84 ? ? ? ? 48 89 5C 24 ? 55",
|
||||
"linux": "55 48 89 E5 41 57 49 89 CF 41 56 49 89 D6 41 55 41 89 F5 41 54 4C 8D A5 A0 FE FF FF"
|
||||
}
|
||||
},
|
||||
"CCSPlayerController_SwitchTeam": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x40\\x56\\x57\\x48\\x81\\xEC\\x2A\\x2A\\x2A\\x2A\\x48\\x8B\\xF9\\x8B\\xF2\\x8B\\xCA",
|
||||
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x55\\x49\\x89\\xFD\\x89\\xF7"
|
||||
"windows": "40 56 57 48 81 EC ? ? ? ? 48 8B F9 8B F2 8B CA",
|
||||
"linux": "55 48 89 E5 41 55 49 89 FD 89 F7"
|
||||
}
|
||||
},
|
||||
"CCSPlayerController_ChangeTeam": {
|
||||
"offsets": {
|
||||
"windows": 93,
|
||||
"linux": 92
|
||||
"windows": 100,
|
||||
"linux": 99
|
||||
}
|
||||
},
|
||||
"CCSPlayerController_Respawn": {
|
||||
"offsets": {
|
||||
"windows": 244,
|
||||
"linux": 246
|
||||
"windows": 257,
|
||||
"linux": 259
|
||||
}
|
||||
},
|
||||
"CBasePlayerController_SetPawn": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x44\\x88\\x4C\\x24\\x20\\x55\\x57\\x41\\x54\\x41\\x56\\x41\\x57\\x48\\x8D\\x6C\\x24\\x2A\\x48\\x81\\xEC\\x2A",
|
||||
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x89\\xF3\\x48\\x81\\xEC\\xC8\\x00\\x00\\x00"
|
||||
"windows": "48 89 74 24 ? 55 41 54 41 55 41 56 41 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 4C 8B F9",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 49 89 FD 41 54 45 89 C4"
|
||||
}
|
||||
},
|
||||
"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": "48 ? ? 55 53 56 57 41 ? 48 ? ? ? 48 ? ? ? ? ? ? 4C 89 68",
|
||||
"linux": "55 48 89 E5 41 56 41 55 41 54 53 48 89 FB 48 83 EC 40 E8"
|
||||
}
|
||||
},
|
||||
"CGameEventManager_Init": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "40 53 48 83 EC 20 48 8B 01 48 8B D9 FF 50 10",
|
||||
"linux": "55 48 89 E5 41 54 49 89 FC 48 83 EC 08 48 8B 07 FF 50 18"
|
||||
}
|
||||
},
|
||||
"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": "48 89 5C 24 ? 48 89 74 24 ? 55 57 41 ? 41 ? 41 ? 48 ? ? ? ? 48 ? ? ? ? ? ? 4D ? ? 48",
|
||||
"linux": "55 48 89 E5 41 57 41 56 4D 89 C6 41 55 49 89 D5 41 54 49 89 F4"
|
||||
}
|
||||
},
|
||||
"UTIL_Remove": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x48\\x85\\xC9\\x74\\x2A\\x48\\x8B\\xD1\\x48\\x8B\\x0D\\x2A\\x2A\\x2A\\x2A",
|
||||
"linux": "\\x48\\x89\\xFE\\x48\\x85\\xFF\\x74\\x2A\\x48\\x8D\\x05\\x2A\\x2A\\x2A\\x2A\\x48"
|
||||
"windows": "48 85 C9 74 ? 48 8B D1 48 8B 0D ? ? ? ?",
|
||||
"linux": "48 89 FE 48 85 FF 74 ? 48 8D 05 ? ? ? ? 48"
|
||||
}
|
||||
},
|
||||
"Host_Say": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x44\\x89\\x4C\\x24\\x20\\x44\\x88\\x44\\x24\\x18",
|
||||
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x49\\x89\\xFF\\x41\\x56\\x41\\x55\\x41\\x54\\x4D\\x89\\xC4"
|
||||
"windows": "44 89 4C 24 20 44 88 44 24 18",
|
||||
"linux": "55 48 89 E5 41 57 41 56 49 89 F6 41 55 4D 89 C5"
|
||||
}
|
||||
},
|
||||
"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": "48 89 5C 24 ? 48 89 7C 24 ? 55 48 8B EC 48 83 EC 50 48 8B F9 4C 8B C2",
|
||||
"linux": "55 48 89 F2 48 89 E5 41 54 49 89 FC 48 8D 7D E0 48 83 EC ? 48 8D 05 ? ? ? ? 48 8B 30 48 8B 06"
|
||||
}
|
||||
},
|
||||
"CCSPlayer_WeaponServices_CanUse": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x48\\x89\\x5C\\x24\\x10\\x48\\x89\\x6C\\x24\\x18\\x56\\x57\\x41\\x56\\x48\\x83\\xEC\\x30\\x80\\xB9\\xA0\\x00\\x00\\x00\\x00",
|
||||
"linux": "\\x48\\x85\\xF6\\x0F\\x84\\x2A\\x2A\\x2A\\x2A\\x55\\x31\\xC9\\x48\\x89\\xE5\\x41\\x55\\x49\\x89\\xFD"
|
||||
"windows": "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 8B 01 48 8B F2",
|
||||
"linux": "55 48 8D 15 ? ? ? ? 48 89 E5 41 55 49 89 F5 41 54 49 89 FC 53 48 83 EC ? 48 8B 07 48 8B 80 ? ? ? ? 48 39 D0 0F 85 ? ? ? ? 80 BF"
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_CanAcquire": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "44 89 44 24 ? 48 89 54 24 ? 48 89 4C 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 8B EC",
|
||||
"linux": "55 48 89 E5 41 57 41 56 48 8D 45 ? 41 55 41 54 53 48 89 CB"
|
||||
}
|
||||
},
|
||||
"GetCSWeaponDataFromKey": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 8B FA 8B F1 48 85 D2 0F 84",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 89 FE 41 55 41 54 45"
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_GiveNamedItem": {
|
||||
"offsets": {
|
||||
"windows": 19,
|
||||
"linux": 20
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_DropActivePlayerWeapon": {
|
||||
"offsets": {
|
||||
"windows": 18,
|
||||
"linux": 19
|
||||
"windows": 20,
|
||||
"linux": 21
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_RemoveWeapons": {
|
||||
"offsets": {
|
||||
"windows": 19,
|
||||
"linux": 20
|
||||
}
|
||||
"offsets": {
|
||||
"windows": 21,
|
||||
"linux": 22
|
||||
}
|
||||
},
|
||||
"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": "48 8B C4 4C 89 48 ? 48 89 48 ? 55 41 55",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 49 89 FC 53 48 81 EC 88 00 00 00 48 8D 05 ? ? ? ?"
|
||||
}
|
||||
},
|
||||
"CCSGameRules_FindPickerEntity": {
|
||||
"offsets": {
|
||||
"windows": 27,
|
||||
"linux": 28
|
||||
}
|
||||
},
|
||||
"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": "48 83 EC 48 C6 44 24 30 00",
|
||||
"linux": "48 8D 05 ? ? ? ? 55 48 89 FA"
|
||||
}
|
||||
},
|
||||
"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": "48 89 5C 24 10 57 48 83 EC 30 48 8B DA 48 8B F9 48 85 C9",
|
||||
"linux": "48 85 FF 74 ? 55 48 89 E5 41 56"
|
||||
}
|
||||
},
|
||||
"CBaseEntity_EmitSoundFilter": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 48 89 7C 24 20 41 56 48 83 EC 30 48 8B EA",
|
||||
"linux": "55 48 89 E5 41 56 49 89 D6 41 55 41 89 F5 41 54 48"
|
||||
}
|
||||
},
|
||||
"CEntityInstance_AcceptInput": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x48\\x89\\x5C\\x24\\x10\\x48\\x89\\x74\\x24\\x18\\x57\\x48\\x83\\xEC\\x40\\x49\\x8B\\xF0",
|
||||
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x49\\x89\\xFF\\x41\\x56\\x48\\x8D\\x7D\\xC0"
|
||||
"windows": "48 89 5C 24 10 48 89 74 24 18 57 48 83 EC 40 49 8B F0",
|
||||
"linux": "55 48 89 E5 41 57 49 89 FF 41 56 48 8D 7D C0"
|
||||
}
|
||||
},
|
||||
"CEntitySystem_AddEntityIOEvent": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 ? 48 89 74 24 ? 57 48 ? ? ? 49 ? ? 48 ? ? 48 ? ? 74",
|
||||
"linux": "55 41 BA FF FF FF FF"
|
||||
}
|
||||
},
|
||||
"LegacyGameEventListener": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x48\\x8B\\x15\\x2A\\x2A\\x2A\\x2A\\x48\\x85\\xD2\\x74\\x2A\\x85\\xC9\\x74",
|
||||
"linux": "\\x48\\x8B\\x05\\x2A\\x2A\\x2A\\x2A\\x48\\x85\\xC0\\x74\\x2A\\x83\\xFF\\x3F\\x76\\x2A\\x31\\xC0"
|
||||
"windows": "48 8B 15 ? ? ? ? 48 85 D2 74 ? 85 C9 74",
|
||||
"linux": "48 8B 05 ? ? ? ? 48 85 C0 74 ? 85 FF"
|
||||
}
|
||||
},
|
||||
"CBasePlayerPawn_CommitSuicide": {
|
||||
"offsets": {
|
||||
"windows": 360,
|
||||
"linux": 360
|
||||
"windows": 380,
|
||||
"linux": 380
|
||||
}
|
||||
},
|
||||
"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": "48 ? ? 0F 84 ? ? ? ? 48 89 5C 24 ? 57 48 ? ? ? 48 ? ? 48 ? ? E8",
|
||||
"linux": "55 48 89 ? 41 ? 49 89 ? 41 ? 49 89 ? E8 ? ? ? ? 49 39"
|
||||
}
|
||||
},
|
||||
"CBaseEntity_Teleport": {
|
||||
"offsets": {
|
||||
"windows": 149,
|
||||
"linux": 148
|
||||
"windows": 157,
|
||||
"linux": 156
|
||||
}
|
||||
},
|
||||
"CBaseEntity_TakeDamageOld": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x40\\x56\\x57\\x48\\x83\\xEC\\x58\\x48\\x8B\\x41\\x10",
|
||||
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x83\\xEC\\x38\\x4C\\x8D\\x2D\\x2A\\x2A\\x2A\\x2A\\x49\\x8B\\x7D\\x00\\x48\\x85\\xFF\\x0F\\x84\\x2A\\x2A\\x2A\\x2A"
|
||||
"windows": "48 89 74 24 ? 57 48 81 EC 80 00 00 00 48 8B 41",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 49 89 FC 53 48 83 EC 58 4C 8D 3D"
|
||||
}
|
||||
},
|
||||
"CBaseTrigger_StartTouch": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x41\\x56\\x41\\x57\\x48\\x83\\xEC\\x58\\x48\\x8B\\x01",
|
||||
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x56\\x49\\x89\\xF6\\x41\\x55\\x49\\x89\\xFD\\x41\\x54\\x53\\xBB"
|
||||
"windows": "40 57 41 57 48 83 EC 28 48 8B 01",
|
||||
"linux": "55 48 89 E5 41 56 49 89 F6 41 55 49 89 FD 41 54 53 BB"
|
||||
}
|
||||
},
|
||||
"CBaseTrigger_EndTouch": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x40\\x53\\x57\\x41\\x55\\x48\\x83\\xEC\\x40",
|
||||
"linux": "\\x55\\xBA\\xFF\\xFF\\xFF\\xFF\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x49\\x89\\xF5\\x41"
|
||||
"windows": "40 53 41 55 48 83 EC 28",
|
||||
"linux": "55 BA FF FF FF FF 48 89 E5 41 57 41 56 41 55 49 89 F5 41"
|
||||
}
|
||||
},
|
||||
"StateChanged": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x40\\x55\\x53\\x56\\x41\\x55\\x41\\x57\\x48\\x8D\\x6C\\x24\\xB0",
|
||||
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x53\\x89\\xD3"
|
||||
"windows": "40 55 53 56 41 56 41 57 48 8D 6C 24 ? 48 81 EC 70 01 00 00",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 53 89 D3"
|
||||
}
|
||||
},
|
||||
"NetworkStateChanged": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "\\x4C\\x8B\\xC9\\x48\\x8B\\x09\\x48\\x85\\xC9\\x74\\x2A\\x48\\x8B\\x41\\x10",
|
||||
"linux": "\\x4C\\x8B\\x07\\x4D\\x85\\xC0\\x74\\x2A\\x49\\x8B\\x40\\x10"
|
||||
"windows": "4C 8B C9 48 8B 09 48 85 C9 74 ? 48 8B 41 10",
|
||||
"linux": "4C 8B 07 4D 85 C0 74 ? 49 8B 40 10"
|
||||
}
|
||||
},
|
||||
"GameEntitySystem": {
|
||||
@@ -203,21 +250,27 @@
|
||||
"CEntityIOOutput_FireOutputInternal": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"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"
|
||||
"windows": "4C 89 4C 24 20 53 55 57 41 54 41 56 48 81 EC",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 49 89 D4 53 48 89 F3 48 83 EC 58"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
"windows": "48 8B 3D ? ? ? ? 48 85 FF 0F 84 ? ? ? ? BE",
|
||||
"linux": "4C 8B 35 ? ? ? ? 4D 85 F6 75 ? E9"
|
||||
}
|
||||
},
|
||||
"CEntityResourceManifest_AddResource": {
|
||||
"offsets": {
|
||||
"windows": 2,
|
||||
"linux": 2
|
||||
"linux": 0
|
||||
}
|
||||
},
|
||||
"CheckTransmitPlayerSlot": {
|
||||
"offsets": {
|
||||
"windows": 584,
|
||||
"linux": 584
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,320 +0,0 @@
|
||||
ActionType_t
|
||||
AimMatrixBlendMode
|
||||
AmmoFlags_t
|
||||
AmmoPosition_t
|
||||
AnimationProcessingType_t
|
||||
AnimationSnapshotType_t
|
||||
AnimationType_t
|
||||
AnimLoopMode_t
|
||||
AnimNodeNetworkMode
|
||||
AnimParamButton_t
|
||||
AnimParamNetworkSetting
|
||||
AnimParamType_t
|
||||
AnimPoseControl
|
||||
AnimScriptType
|
||||
AnimValueSource
|
||||
AnimVectorSource
|
||||
attributeprovidertypes_t
|
||||
BaseExplosionTypes_t
|
||||
BBoxVolumeType_t
|
||||
BeamClipStyle_t
|
||||
BeamType_t
|
||||
BeginDeathLifeStateTransition_t
|
||||
BinaryNodeChildOption
|
||||
BinaryNodeTiming
|
||||
Blend2DMode
|
||||
BlendKeyType
|
||||
BloomBlendMode_t
|
||||
BlurFilterType_t
|
||||
BoneMaskBlendSpace
|
||||
BoneTransformSpace_t
|
||||
BrushSolidities_e
|
||||
C4LightEffect_t
|
||||
CAnimationGraphVisualizerPrimitiveType
|
||||
CanPlaySequence_t
|
||||
ChatIgnoreType_t
|
||||
ChickenActivity
|
||||
ChoiceBlendMethod
|
||||
ChoiceChangeMethod
|
||||
ChoiceMethod
|
||||
Class_T
|
||||
CLogicBranchList__LogicBranchListenerLastState_t
|
||||
ClosestPointTestType_t
|
||||
CNmBoneMask__WeightInfo_t
|
||||
CommandEntitySpecType_t
|
||||
CommandExecMode_t
|
||||
CompMatPropertyMutatorConditionType_t
|
||||
CompMatPropertyMutatorType_t
|
||||
CompositeMaterialInputContainerSourceType_t
|
||||
CompositeMaterialInputLooseVariableType_t
|
||||
CompositeMaterialInputTextureType_t
|
||||
CompositeMaterialMatchFilterType_t
|
||||
CompositeMaterialVarSystemVar_t
|
||||
CRR_Response__ResponseEnum_t
|
||||
CSPlayerBlockingUseAction_t
|
||||
CSPlayerState
|
||||
CSWeaponCategory
|
||||
CSWeaponMode
|
||||
CSWeaponSilencerType
|
||||
CSWeaponState_t
|
||||
CSWeaponType
|
||||
DamageTypes_t
|
||||
DampingSpeedFunction
|
||||
DebugOverlayBits_t
|
||||
Detail2Combo_t
|
||||
DetailCombo_t
|
||||
DisableShadows_t
|
||||
Disposition_t
|
||||
doorCheck_e
|
||||
DoorState_t
|
||||
EDemoBoneSelectionMode
|
||||
EInButtonState
|
||||
EKillTypes_t
|
||||
ELayoutNodeType
|
||||
EntFinderMethod_t
|
||||
EntityDisolveType_t
|
||||
EntityDormancyType_t
|
||||
EntityIOTargetType_t
|
||||
EntitySubclassScope_t
|
||||
EOverrideBlockLOS_t
|
||||
EStyleNodeType
|
||||
Explosions
|
||||
FacingMode
|
||||
FieldNetworkOption
|
||||
fieldtype_t
|
||||
filter_t
|
||||
FixAngleSet_t
|
||||
FlexOpCode_t
|
||||
FootFallTagFoot_t
|
||||
FootLockSubVisualization
|
||||
FootPinningTimingSource
|
||||
FootstepLandedFootSoundType_t
|
||||
ForcedCrouchState_t
|
||||
FuncDoorSpawnPos_t
|
||||
FuseVariableAccess_t
|
||||
FuseVariableType_t
|
||||
GameAnimEventIndex_t
|
||||
gear_slot_t
|
||||
GrenadeType_t
|
||||
HierarchyType_t
|
||||
HitboxLerpType_t
|
||||
HitGroup_t
|
||||
HorizJustification_e
|
||||
Hull_t
|
||||
IChoreoServices__ChoreoState_t
|
||||
IChoreoServices__ScriptState_t
|
||||
IKChannelMode
|
||||
IkEndEffectorType
|
||||
IKSolverType
|
||||
IKTargetCoordinateSystem
|
||||
IKTargetSource
|
||||
IkTargetType
|
||||
InheritableBoolType_t
|
||||
InputBitMask_t
|
||||
InputLayoutVariation_t
|
||||
ItemFlagTypes_t
|
||||
JiggleBoneSimSpace
|
||||
JointAxis_t
|
||||
JointMotion_t
|
||||
JumpCorrectionMethod
|
||||
LatchDirtyPermission_t
|
||||
LayoutPositionType_e
|
||||
LessonPanelLayoutFileTypes_t
|
||||
LifeState_t
|
||||
loadout_slot_t
|
||||
MaterialProxyType_t
|
||||
Materials
|
||||
MatterialAttributeTagType_t
|
||||
MedalRank_t
|
||||
MeshDrawPrimitiveFlags_t
|
||||
MissingParentInheritBehavior_t
|
||||
ModelBoneFlexComponent_t
|
||||
ModelConfigAttachmentType_t
|
||||
ModelSkeletonData_t__BoneFlags_t
|
||||
ModifyDamageReturn_t
|
||||
MoodType_t
|
||||
MorphBundleType_t
|
||||
MorphFlexControllerRemapType_t
|
||||
MoveCollide_t
|
||||
MoveLinearAuthoredPos_t
|
||||
MovementGait_t
|
||||
MoveMountingAmount_t
|
||||
MoveType_t
|
||||
NavAttributeEnum
|
||||
NavDirType
|
||||
navproperties_t
|
||||
NmFootPhase_t
|
||||
NmFootPhaseCondition_t
|
||||
NmFrameSnapEventMode_t
|
||||
NmTransitionRule_t
|
||||
NmTransitionRuleCondition_t
|
||||
NPCFollowFormation_t
|
||||
NPCLookType_t
|
||||
ObjectTypeFlags_t
|
||||
ObserverInterpState_t
|
||||
ObserverMode_t
|
||||
OnFrame
|
||||
ParticleAlphaReferenceType_t
|
||||
ParticleAttachment_t
|
||||
ParticleAttrBoxFlags_t
|
||||
ParticleCollisionMode_t
|
||||
ParticleColorBlendMode_t
|
||||
ParticleColorBlendType_t
|
||||
ParticleControlPointAxis_t
|
||||
ParticleDepthFeatheringMode_t
|
||||
ParticleDetailLevel_t
|
||||
ParticleDirectionNoiseType_t
|
||||
ParticleEndcapMode_t
|
||||
ParticleFalloffFunction_t
|
||||
ParticleFloatBiasType_t
|
||||
ParticleFloatInputMode_t
|
||||
ParticleFloatMapType_t
|
||||
ParticleFloatRandomMode_t
|
||||
ParticleFloatType_t
|
||||
ParticleFogType_t
|
||||
ParticleHitboxBiasType_t
|
||||
ParticleHitboxDataSelection_t
|
||||
ParticleImpulseType_t
|
||||
ParticleLightBehaviorChoiceList_t
|
||||
ParticleLightFogLightingMode_t
|
||||
ParticleLightingQuality_t
|
||||
ParticleLightnintBranchBehavior_t
|
||||
ParticleLightTypeChoiceList_t
|
||||
ParticleLightUnitChoiceList_t
|
||||
ParticleModelType_t
|
||||
ParticleOmni2LightTypeChoiceList_t
|
||||
ParticleOrientationChoiceList_t
|
||||
ParticleOrientationSetMode_t
|
||||
ParticleOutputBlendMode_t
|
||||
ParticleParentSetMode_t
|
||||
ParticlePinDistance_t
|
||||
ParticlePostProcessPriorityGroup_t
|
||||
ParticleRotationLockType_t
|
||||
ParticleSelection_t
|
||||
ParticleSequenceCropOverride_t
|
||||
ParticleSetMethod_t
|
||||
ParticleSortingChoiceList_t
|
||||
ParticleTextureLayerBlendType_t
|
||||
ParticleTopology_t
|
||||
ParticleTraceMissBehavior_t
|
||||
ParticleTraceSet_t
|
||||
ParticleTransformType_t
|
||||
ParticleVecType_t
|
||||
ParticleVRHandChoiceList_t
|
||||
PerformanceMode_t
|
||||
PermModelInfo_t__FlagEnum
|
||||
PetGroundType_t
|
||||
PFNoiseModifier_t
|
||||
PFNoiseTurbulence_t
|
||||
PFNoiseType_t
|
||||
PFuncVisualizationType_t
|
||||
PlayerAnimEvent_t
|
||||
PlayerConnectedState
|
||||
PointTemplateClientOnlyEntityBehavior_t
|
||||
PointTemplateOwnerSpawnGroupType_t
|
||||
PointWorldTextJustifyHorizontal_t
|
||||
PointWorldTextJustifyVertical_t
|
||||
PointWorldTextReorientMode_t
|
||||
PoseType_t
|
||||
PreviewCharacterMode
|
||||
PreviewEOMCelebration
|
||||
PreviewWeaponState
|
||||
PropDoorRotatingOpenDirection_e
|
||||
PropDoorRotatingSpawnPos_t
|
||||
PulseCursorCancelPriority_t
|
||||
PulseCursorExecResult_t
|
||||
PulseInstructionCode_t
|
||||
PulseMethodCallMode_t
|
||||
PulseTestEnumColor_t
|
||||
PulseTestEnumShape_t
|
||||
PulseValueType_t
|
||||
QuestProgress__Reason
|
||||
RagdollPoseControl
|
||||
RenderBufferFlags_t
|
||||
RenderFx_t
|
||||
RenderMode_t
|
||||
RenderMultisampleType_t
|
||||
RenderPrimitiveType_t
|
||||
RenderSlotType_t
|
||||
ResetCycleOption
|
||||
RumbleEffect_t
|
||||
ScalarExpressionType_t
|
||||
SceneOnPlayerDeath_t
|
||||
ScriptedConflictResponse_t
|
||||
ScriptedMoveTo_t
|
||||
ScriptedMoveType_t
|
||||
ScriptedOnDeath_t
|
||||
SelectorTagBehavior_t
|
||||
SeqCmd_t
|
||||
SeqPoseSetting_t
|
||||
SequenceFinishNotifyState_t
|
||||
ShadowType_t
|
||||
ShakeCommand_t
|
||||
ShardSolid_t
|
||||
ShatterDamageCause
|
||||
ShatterGlassStressType
|
||||
ShatterPanelMode
|
||||
SimpleConstraintSoundProfile__SimpleConstraintsSoundProfileKeypoints_t
|
||||
SnapshotIndexType_t
|
||||
SolidType_t
|
||||
SolveIKChainAnimNodeDebugSetting
|
||||
SosActionSortType_t
|
||||
SosActionStopType_t
|
||||
SosEditItemType_t
|
||||
SosGroupType_t
|
||||
SoundEventStartType_t
|
||||
SoundFlags_t
|
||||
soundlevel_t
|
||||
SpawnDebugOverrideState_t
|
||||
SpawnDebugRestrictionOverrideState_t
|
||||
SpawnPointCoopEnemy__BotDefaultBehavior_t
|
||||
SpriteCardPerParticleScale_t
|
||||
SpriteCardShaderType_t
|
||||
SpriteCardTextureChannel_t
|
||||
SpriteCardTextureType_t
|
||||
StanceOverrideMode
|
||||
StanceType_t
|
||||
StandardLightingAttenuationStyle_t
|
||||
StateActionBehavior
|
||||
StepPhase
|
||||
SubclassVDataChangeType_t
|
||||
SurroundingBoundsType_t
|
||||
TakeDamageFlags_t
|
||||
TextureRepetitionMode_t
|
||||
ThreeState_t
|
||||
TimelineCompression_t
|
||||
TOGGLE_STATE
|
||||
Touch_t
|
||||
TrackOrientationType_t
|
||||
TRAIN_CODE
|
||||
TrainOrientationType_t
|
||||
TrainVelocityType_t
|
||||
ValueRemapperHapticsType_t
|
||||
ValueRemapperInputType_t
|
||||
ValueRemapperMomentumType_t
|
||||
ValueRemapperOutputType_t
|
||||
ValueRemapperRatchetType_t
|
||||
VectorExpressionType_t
|
||||
VectorFloatExpressionType_t
|
||||
VelocityMetricMode
|
||||
VertJustification_e
|
||||
ViewFadeMode_t
|
||||
VMixChannelOperation_t
|
||||
VMixFilterSlope_t
|
||||
VMixFilterType_t
|
||||
VMixLFOShape_t
|
||||
VMixPannerType_t
|
||||
VMixProcessorType_t
|
||||
VMixSubgraphSwitchInterpolationType_t
|
||||
vote_create_failed_t
|
||||
VPhysXAggregateData_t__VPhysXFlagEnum_t
|
||||
VPhysXBodyPart_t__VPhysXFlagEnum_t
|
||||
VPhysXConstraintParams_t__EnumFlags0_t
|
||||
VPhysXJoint_t__Flags_t
|
||||
WaterLevel_t
|
||||
WeaponAttackType_t
|
||||
WeaponSound_t
|
||||
WeaponSwitchReason_t
|
||||
WorldTextPanelHorizontalAlign_t
|
||||
WorldTextPanelOrientation_t
|
||||
WorldTextPanelVerticalAlign_t
|
||||
@@ -54,6 +54,9 @@ The specific subclass of `GameEvent` will provide strongly typed parameters from
|
||||
|
||||
These event properties are mutable so you can update them as normal and they will update in the event instance.
|
||||
|
||||
> [!CAUTION]
|
||||
> `GameEvent` instances and their properties will cease to exist after the event listener function is called, which means that you will encounter errors when accessing properties in timers and functions like `Server.NextFrame()`. You should store the value of properties in variables before calling functions like `Server.NextFrame()` so you can read the data safely.
|
||||
|
||||
## Preventing Broadcast
|
||||
|
||||
You can modify a game event so that it does not get broadcast to clients by modifying the `bool info.DontBroadcast` property. e.g.
|
||||
|
||||
99
docfx/docs/guides/auto-build-and-deploy.md
Normal file
99
docfx/docs/guides/auto-build-and-deploy.md
Normal file
@@ -0,0 +1,99 @@
|
||||
---
|
||||
title: Automatically build/deploy your changes
|
||||
description: Automatically build and deploy plugin changes to a remote development server as you work.
|
||||
---
|
||||
|
||||
# Automatically build and deploy your changes
|
||||
|
||||
<sup>Adapted from the
|
||||
[original guide](https://github.com/uFloppyDisk/create-cssharp-plugin/blob/c8fca43f86a61a5e874624f2f3ed39c5271c9a55/templates/standard-plugin/docs/auto-live-hot-reloading.md).
|
||||
</sup>
|
||||
|
||||
During development of your plugin, you may find yourself repeating a workflow
|
||||
similar to the following:
|
||||
1. Make a change to your plugin
|
||||
2. Run your build task (ex. `dotnet build`)
|
||||
3. Upload plugin DLLs to your server using an FTP client
|
||||
4. Alt-tab to the game
|
||||
5. Test your changes
|
||||
6. Repeat
|
||||
|
||||
Iterating on your plugin this way is painfully slow and impacts your productivity.
|
||||
Below, you will find a guide and recommendations on how to setup your dev environment
|
||||
to watch for file changes and automatically update plugin files on your server as you work.
|
||||
By following this guide, your new workflow should look like this:
|
||||
1. Make a change to your plugin
|
||||
2. Alt-tab to the game
|
||||
3. Test your changes
|
||||
4. Repeat
|
||||
|
||||
> [!CAUTION]
|
||||
> Exercise caution when developing your plugin while using this workflow.
|
||||
> Build time errors are mostly caught by .NET SDK before files are committed
|
||||
> but incomplete implementation may lead to issues such as server crashes.
|
||||
> Avoid using this workflow on a production server meant for players.
|
||||
|
||||
## Setup
|
||||
|
||||
#### 1. Build plugin on file changes
|
||||
|
||||
The `dotnet` CLI, included with the .NET SDK, offers a convenient command for
|
||||
automatically watching for source file changes. If you have access to the `dotnet`
|
||||
CLI, run the following command to start watching your source code.
|
||||
```shell
|
||||
dotnet watch build --project path/to/projectName.csproj
|
||||
```
|
||||
<sup>By default, `dotnet watch` executes the `dotnet run` command on file changes
|
||||
so specifying `build` as the first argument is required.</sup>
|
||||
|
||||
Your plugin will now build automatically on file change. By default, your builds
|
||||
should be placed in `bin/<config>/<framework>` in the same directory as your `.csproj`.
|
||||
|
||||
```txt
|
||||
projectDirectory
|
||||
├── projectName.csproj
|
||||
├── bin
|
||||
│ └── Debug
|
||||
│ └── net8.0
|
||||
│ └── PLUGIN BUILDS HERE
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> You can have your plugin build to a more convenient location by setting the
|
||||
> `<OutDir>` build property in your `.csproj` file.
|
||||
> Example: `<OutDir>./build/$(MSBuildProjectName)</OutDir>`
|
||||
|
||||
|
||||
#### 2. Setup automatic uploads
|
||||
|
||||
##### Using WinSCP (Windows only)
|
||||
Once connected to your server:
|
||||
1. Go to the `Commands` tab at the top of the WinSCP window
|
||||
and click `Keep Remote Directory up to Date`.
|
||||
2. Select the plugin build directory containing your DLLs.
|
||||
3. Select the plugin destination.
|
||||
(`csgo/addons/counterstrikesharp/plugins/<projectName>`)
|
||||
4. Click `Start`
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **For WSL users:**
|
||||
> Applications running on Windows, such as WinSCP, cannot watch your Linux subsystem for file
|
||||
> changes. Try using [this workaround](#using-winscp-while-developing-in-wsl) or consider
|
||||
> moving development to Windows.
|
||||
|
||||
##### Using `lsyncd` (Linux)
|
||||
> **TODO:** in-depth guide for setting up lsyncd
|
||||
|
||||
Learn more about `lsyncd`: https://github.com/lsyncd/lsyncd
|
||||
|
||||
___
|
||||
|
||||
#### Using WinSCP while developing in WSL
|
||||
Run the following watch command in place of the one mentioned in
|
||||
[Step 1](#1-build-plugin-on-file-changes) to build to a directory in your Windows filesystem
|
||||
```shell
|
||||
dotnet watch build --project path/to/<projectName>.csproj --property:OutDir=/mnt/<drive-letter>/some/path/<projectName>`
|
||||
```
|
||||
and have [WinSCP in Step 2](#2-setup-automatic-uploads) watch that path instead.
|
||||
|
||||
[Learn about Windows filesystem mounts in WSL](https://blogs.windows.com/windowsdeveloper/2016/07/22/fun-with-the-windows-subsystem-for-linux/#Working%20with%20Windows%20files:~:text=Working%20with%20Windows%20files)
|
||||
@@ -10,7 +10,7 @@ In this guide you will learn how to install CounterStrikeSharp onto your vanilla
|
||||
If you're more of a visual person, here is a <a href="https://www.youtube.com/watch?v=FlsKzStHJuY" target="_blank">Youtube video</a> that covers everything.
|
||||
|
||||
## Prerequisites
|
||||
- <a href="https://www.sourcemm.net/downloads.php/?branch=master" target="_blank">Metamod: Source 2.X Dev Build</a>
|
||||
- <a href="https://www.metamodsource.net/downloads.php/?branch=master" target="_blank">Metamod: Source 2.X Dev Build</a>
|
||||
- <a href="https://github.com/roflmuffin/CounterStrikeSharp/releases" target="_blank">CounterStrikeSharp With Runtime</a>
|
||||
|
||||
## Installing Metamod
|
||||
|
||||
@@ -6,3 +6,9 @@
|
||||
|
||||
- name: Dependency Injection
|
||||
href: dependency-injection.md
|
||||
|
||||
- name: Referencing Players
|
||||
href: referencing-players.md
|
||||
|
||||
- name: Automatically build and deploy your changes
|
||||
href: auto-build-and-deploy.md
|
||||
|
||||
@@ -28,7 +28,6 @@ receive a ban.
|
||||
> [!NOTE]
|
||||
> Disable this option at your own risk.
|
||||
|
||||
|
||||
## PluginHotReloadEnabled
|
||||
|
||||
When enabled, plugins are automatically reloaded when their .dll file is updated.
|
||||
@@ -39,4 +38,12 @@ When enabled, plugins are automatically loaded from the plugins directory on ser
|
||||
|
||||
## 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".
|
||||
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".
|
||||
|
||||
## UnlockConCommands
|
||||
|
||||
When enabled, will remove the `FCVAR_HIDDEN`,`FCVAR_DEVELOPMENTONLY`, `FCVAR_MISSING0`, `FCVAR_MISSING1`, `FCVAR_MISSING2`, `FCVAR_MISSING3` flags from all console commands.
|
||||
|
||||
## UnlockConVars
|
||||
|
||||
When enabled, will remove the `FCVAR_HIDDEN`,`FCVAR_DEVELOPMENTONLY`, `FCVAR_MISSING0`, `FCVAR_MISSING1`, `FCVAR_MISSING2`, `FCVAR_MISSING3` flags from all console variables.
|
||||
|
||||
@@ -1,5 +1,2 @@
|
||||
- name: Core Configuration
|
||||
href: core-configuration.md
|
||||
|
||||
- name: Referencing Players
|
||||
href: referencing-players.md
|
||||
href: core-configuration.md
|
||||
5
docfx/examples/WithUserMessages.md
Normal file
5
docfx/examples/WithUserMessages.md
Normal file
@@ -0,0 +1,5 @@
|
||||
[!INCLUDE [WithUserMessages](../../examples/WithUserMessages/README.md)]
|
||||
|
||||
<a href="https://github.com/roflmuffin/CounterStrikeSharp/tree/main/examples/WithUserMessages" class="btn btn-secondary">View project on Github <i class="bi bi-github"></i></a>
|
||||
|
||||
[!code-csharp[](../../examples/WithUserMessages/WithUserMessagesPlugin.cs)]
|
||||
@@ -19,6 +19,8 @@ items:
|
||||
href: WithSharedTypes.md
|
||||
- name: Translations
|
||||
href: WithTranslations.md
|
||||
- name: User Messages
|
||||
href: WithUserMessages.md
|
||||
- name: Voice Overrides
|
||||
href: WithVoiceOverrides.md
|
||||
- name: Warcraft Plugin
|
||||
|
||||
37
eng/formatting/download-tools.ps1
Normal file
37
eng/formatting/download-tools.ps1
Normal 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"
|
||||
60
eng/formatting/download-tools.sh
Normal file
60
eng/formatting/download-tools.sh
Normal 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
29
eng/formatting/format.sh
Normal 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
71
eng/install/install.ps1
Normal 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
72
eng/install/install.sh
Executable 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
|
||||
2
examples/WithCheckTransmit/README.md
Normal file
2
examples/WithCheckTransmit/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# With CheckTransmit
|
||||
This example shows how to work with the `CheckTransmit` listener.
|
||||
13
examples/WithCheckTransmit/WithCheckTransmit.csproj
Normal file
13
examples/WithCheckTransmit/WithCheckTransmit.csproj
Normal file
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\managed\CounterStrikeSharp.API\CounterStrikeSharp.API.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
115
examples/WithCheckTransmit/WithCheckTransmitPlugin.cs
Normal file
115
examples/WithCheckTransmit/WithCheckTransmitPlugin.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace WithCheckTransmit;
|
||||
|
||||
[MinimumApiVersion(276)]
|
||||
public class WithCheckTransmitPlugin : BasePlugin
|
||||
{
|
||||
public override string ModuleName => "Example: With CheckTransmit";
|
||||
public override string ModuleVersion => "1.0.0";
|
||||
public override string ModuleAuthor => "CounterStrikeSharp & Contributors";
|
||||
public override string ModuleDescription => "A simple plugin that uses the CheckTransmit listener!";
|
||||
|
||||
private Dictionary<int, bool> ShouldSeeDoors = new Dictionary<int, bool>();
|
||||
|
||||
public override void Load(bool hotReload)
|
||||
{
|
||||
// This command is related to the following example.
|
||||
AddCommand("nodoors", "Toggle door transmit", (player, info) =>
|
||||
{
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (ShouldSeeDoors.ContainsKey(player.Slot))
|
||||
{
|
||||
ShouldSeeDoors[player.Slot] = !ShouldSeeDoors[player.Slot];
|
||||
} else
|
||||
{
|
||||
ShouldSeeDoors.Add(player.Slot, false);
|
||||
}
|
||||
|
||||
info.ReplyToCommand($"You should {(ShouldSeeDoors[player.Slot] ? "see" : "not see")} doors");
|
||||
});
|
||||
|
||||
// In this example, we will hide every door for players that have enabled the option with the command 'nodoors'
|
||||
RegisterListener<Listeners.CheckTransmit>((CCheckTransmitInfoList infoList) =>
|
||||
{
|
||||
// Get the list of the currently available doors (prop_door_rotating)
|
||||
IEnumerable<CPropDoorRotating> doors = Utilities.FindAllEntitiesByDesignerName<CPropDoorRotating>("prop_door_rotating");
|
||||
|
||||
// Do nothing if there is none.
|
||||
if (!doors.Any())
|
||||
return;
|
||||
|
||||
// Go through every received info
|
||||
foreach ((CCheckTransmitInfo info, CCSPlayerController? player) in infoList)
|
||||
{
|
||||
// If no player is found, we can continue
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
// Otherwise, lets do the work:
|
||||
|
||||
// Check if we should clear or not:
|
||||
|
||||
// If we have no data saved for this player, then we should not continue
|
||||
if (!ShouldSeeDoors.ContainsKey(player.Slot))
|
||||
continue;
|
||||
|
||||
// If this value is true, then this player should see doors
|
||||
if (ShouldSeeDoors[player.Slot])
|
||||
continue;
|
||||
|
||||
// Otherwise, lets remove the door entity indexes from the info list so they won't be transmitted
|
||||
foreach (CPropDoorRotating door in doors)
|
||||
{
|
||||
info.TransmitEntities.Remove(door);
|
||||
}
|
||||
|
||||
// NOTE: this is a barebone example, saving data and doing sanity checks is up to you.
|
||||
}
|
||||
});
|
||||
|
||||
// In this example, we will hide other players in the same team as the player.
|
||||
// NOTE: 'Hiding' players requires extra work to do, killing non-transmitted players results in crash.
|
||||
RegisterListener<Listeners.CheckTransmit>((CCheckTransmitInfoList infoList) =>
|
||||
{
|
||||
// Get the list of the current players, we only work with this value later on
|
||||
List<CCSPlayerController> players = Utilities.GetPlayers();
|
||||
|
||||
// Go through every received info
|
||||
foreach ((CCheckTransmitInfo info, CCSPlayerController? player) in infoList)
|
||||
{
|
||||
// If no player is found, we can continue
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
// Otherwise, lets do the work:
|
||||
|
||||
// as an example, lets hide everyone for this player who is in the same team.
|
||||
IEnumerable<CCSPlayerController> targetPlayers = players.Where(p =>
|
||||
// is the player and its pawn valid
|
||||
p.IsValid && p.Pawn.IsValid &&
|
||||
|
||||
// we shouldn't hide ourselves
|
||||
p.Slot != player.Slot &&
|
||||
|
||||
// is the player is in the same team
|
||||
p.Team == player.Team &&
|
||||
|
||||
// is alive
|
||||
p.PlayerPawn.Value?.LifeState == (byte)LifeState_t.LIFE_ALIVE
|
||||
);
|
||||
|
||||
foreach (CCSPlayerController targetPlayer in targetPlayers)
|
||||
{
|
||||
// Calling 'Remove' will clear the entity index of the target player pawn from the transmission list
|
||||
// so it won't be transmitted for the 'player'.
|
||||
info.TransmitEntities.Remove(targetPlayer.Pawn);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,38 +1,60 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace WithConfig;
|
||||
|
||||
public class SampleConfig : BasePluginConfig
|
||||
{
|
||||
[JsonPropertyName("ChatPrefix")] public string ChatPrefix { get; set; } = "My Cool Plugin";
|
||||
|
||||
[JsonPropertyName("ChatInterval")] public float ChatInterval { get; set; } = 60;
|
||||
}
|
||||
|
||||
[MinimumApiVersion(80)]
|
||||
public class WithConfigPlugin : BasePlugin, IPluginConfig<SampleConfig>
|
||||
{
|
||||
public override string ModuleName => "Example: With Config";
|
||||
public override string ModuleVersion => "1.0.0";
|
||||
|
||||
public SampleConfig Config { get; set; }
|
||||
|
||||
public void OnConfigParsed(SampleConfig config)
|
||||
{
|
||||
// Do manual verification of the config and override any invalid values
|
||||
if (config.ChatInterval > 60)
|
||||
{
|
||||
config.ChatInterval = 60;
|
||||
}
|
||||
|
||||
if (config.ChatPrefix.Length > 25)
|
||||
{
|
||||
throw new Exception($"Invalid value has been set to config value 'ChatPrefix': {config.ChatPrefix}");
|
||||
}
|
||||
|
||||
// Once we've validated the config, we can set it to the instance
|
||||
Config = config;
|
||||
}
|
||||
}
|
||||
using System.Text.Json.Serialization;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
using CounterStrikeSharp.API.Core.Attributes.Registration;
|
||||
using CounterStrikeSharp.API.Modules.Admin;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Config;
|
||||
using CounterStrikeSharp.API.Modules.Extensions;
|
||||
|
||||
namespace WithConfig;
|
||||
|
||||
public class SampleConfig : BasePluginConfig
|
||||
{
|
||||
[JsonPropertyName("ChatPrefix")] public string ChatPrefix { get; set; } = "My Cool Plugin";
|
||||
|
||||
[JsonPropertyName("ChatInterval")] public float ChatInterval { get; set; } = 60;
|
||||
}
|
||||
|
||||
[MinimumApiVersion(80)]
|
||||
public class WithConfigPlugin : BasePlugin, IPluginConfig<SampleConfig>
|
||||
{
|
||||
public override string ModuleName => "Example: With Config";
|
||||
public override string ModuleVersion => "1.0.0";
|
||||
|
||||
public SampleConfig Config { get; set; }
|
||||
|
||||
public void OnConfigParsed(SampleConfig config)
|
||||
{
|
||||
// Do manual verification of the config and override any invalid values
|
||||
if (config.ChatInterval > 60)
|
||||
{
|
||||
config.ChatInterval = 60;
|
||||
}
|
||||
|
||||
if (config.ChatPrefix.Length > 25)
|
||||
{
|
||||
throw new Exception($"Invalid value has been set to config value 'ChatPrefix': {config.ChatPrefix}");
|
||||
}
|
||||
|
||||
// Once we've validated the config, we can set it to the instance
|
||||
Config = config;
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_reload_config", "Reloads the plugin config")]
|
||||
public void OnReloadConfig(CCSPlayerController? player, CommandInfo commandInfo)
|
||||
{
|
||||
commandInfo.ReplyToCommand("Chat Interval before reload: " + Config.ChatInterval);
|
||||
Config.Reload();
|
||||
commandInfo.ReplyToCommand("Chat Interval after reload: " + Config.ChatInterval);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_reset_config", "Resets the plugin config")]
|
||||
public void OnResetConfig(CCSPlayerController? player, CommandInfo commandInfo)
|
||||
{
|
||||
commandInfo.ReplyToCommand("Chat Interval before reset: " + Config.ChatInterval);
|
||||
Config.ChatInterval = 60;
|
||||
Config.Update();
|
||||
commandInfo.ReplyToCommand("Chat Interval after reset: " + Config.ChatInterval);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
@@ -22,18 +22,29 @@ public class WithTranslationsPlugin : BasePlugin
|
||||
// A global `Localizer` is provided on the plugin instance.
|
||||
// You can also use dependency injection to inject `IStringLocalizer` in your own services.
|
||||
Logger.LogInformation("This message is in the server language: {Message}", Localizer["test.translation"]);
|
||||
|
||||
|
||||
// IStringLocalizer can accept standard string format arguments.
|
||||
// "This number has 2 decimal places {0:n2}" -> "This number has 2 decimal places 123.55"
|
||||
Logger.LogInformation(Localizer["test.format", 123.551]);
|
||||
|
||||
|
||||
// This message has colour codes
|
||||
Server.PrintToChatAll(Localizer["test.colors"]);
|
||||
|
||||
// This message has colour codes and formatted values
|
||||
Server.PrintToChatAll(Localizer["test.colors.withformat", 123.551]);
|
||||
|
||||
// This prints the message to all players in their respective language
|
||||
PrintToAllPlayersLocalized("test.format", 123.456);
|
||||
}
|
||||
|
||||
|
||||
void PrintToAllPlayersLocalized(string key, params object[] args)
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers().Where(x => x.IsValid))
|
||||
{
|
||||
player.PrintToChat(Localizer.ForPlayer(player, key, args));
|
||||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_replylanguage", "Test Translations")]
|
||||
public void OnCommandReplyLanguage(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
|
||||
2
examples/WithUserMessages/README.md
Normal file
2
examples/WithUserMessages/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# With User Messages
|
||||
This is example shows how you can hook, interrupt and send User Messages.
|
||||
12
examples/WithUserMessages/WithUserMessages.csproj
Normal file
12
examples/WithUserMessages/WithUserMessages.csproj
Normal file
@@ -0,0 +1,12 @@
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
84
examples/WithUserMessages/WithUserMessagesPlugin.cs
Normal file
84
examples/WithUserMessages/WithUserMessagesPlugin.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
using CounterStrikeSharp.API.Core.Attributes.Registration;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.UserMessages;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace WithUserMessages;
|
||||
|
||||
[MinimumApiVersion(80)]
|
||||
public class WithUserMessagesPlugin : BasePlugin
|
||||
{
|
||||
public override string ModuleName => "Example: With User Messages";
|
||||
public override string ModuleVersion => "1.0.0";
|
||||
public override string ModuleAuthor => "CounterStrikeSharp & Contributors";
|
||||
public override string ModuleDescription => "A simple plugin that hooks and sends User Messages";
|
||||
|
||||
public override void Load(bool hotReload)
|
||||
{
|
||||
// Hooks can be added using the user message ID. In this case it's the ID for `CMsgTEFireBullets`.
|
||||
HookUserMessage(452, um =>
|
||||
{
|
||||
// Sets all weapon sounds to the sound of a silenced usp.
|
||||
um.SetUInt("weapon_id", 0);
|
||||
um.SetInt("sound_type", 9);
|
||||
um.SetUInt("item_def_index", 61);
|
||||
|
||||
return HookResult.Continue;
|
||||
}, HookMode.Pre);
|
||||
|
||||
HookUserMessage(118, um =>
|
||||
{
|
||||
var author = um.ReadString("param1");
|
||||
var message = um.ReadString("param2");
|
||||
Logger.LogInformation("Chat message from {Author}: {Message}", author, message);
|
||||
|
||||
for (var i = 0; i < um.Recipients.Count; i++)
|
||||
{
|
||||
Logger.LogInformation("Recipient {Index}: {Name}", i, um.Recipients[i].PlayerName);
|
||||
}
|
||||
|
||||
if (message.Contains("stop"))
|
||||
{
|
||||
return HookResult.Stop;
|
||||
}
|
||||
|
||||
if (message.Contains("skip"))
|
||||
{
|
||||
um.Recipients.Clear();
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_shake")]
|
||||
public void OnCommandShake(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
if (player == null) return;
|
||||
|
||||
// UserMessage.FromPartialName is a helper method that creates a UserMessage object from a partial network name.
|
||||
// In this case, it will resolve to `CUserMessageShake`.
|
||||
var message = UserMessage.FromPartialName("Shake");
|
||||
|
||||
message.SetFloat("duration", 2);
|
||||
message.SetFloat("amplitude", 5);
|
||||
message.SetFloat("frequency", 10f);
|
||||
message.SetInt("command", 0);
|
||||
|
||||
if (command.GetArg(1) == "all")
|
||||
{
|
||||
message.Recipients.AddAllPlayers();
|
||||
}
|
||||
else
|
||||
{
|
||||
message.Recipients.Add(player);
|
||||
}
|
||||
|
||||
message.Send();
|
||||
|
||||
// You can also use an overload of `Send` to send the message to a specific player without manually creating a recipient filter.
|
||||
// message.Send(player);
|
||||
}
|
||||
}
|
||||
Submodule libraries/Protobufs updated: 686a0628e6...53da9bc320
Submodule libraries/hl2sdk-cs2 updated: 43bfe744a1...bc59586979
Submodule libraries/metamod-source updated: e857fbe90c...6091f15217
@@ -1,6 +1,4 @@
|
||||
#set(_ITERATOR_DEBUG_LEVEL 2)
|
||||
add_definitions(-D_LINUX -DPOSIX -DLINUX -DGNUC -DCOMPILER_GCC -DPLATFORM_64BITS)
|
||||
|
||||
add_definitions(-D_LINUX -DPOSIX -DLINUX -DGNUC -DCOMPILER_GCC -DPLATFORM_64BITS -D_FILE_OFFSET_BITS=64 -D_GLIBCXX_USE_CXX11_ABI=0)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Dstrnicmp=strncasecmp -D_snprintf=snprintf")
|
||||
@@ -16,16 +14,19 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof -Wno-reorder")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -msse -fno-strict-aliasing")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-threadsafe-statics -v -fvisibility=default")
|
||||
|
||||
SET(
|
||||
COUNTER_STRIKE_SHARP_LINK_LIBRARIES
|
||||
${SOURCESDK_LIB}/linux64/libtier0.so
|
||||
${SOURCESDK_LIB}/linux64/tier1.a
|
||||
${SOURCESDK_LIB}/linux64/interfaces.a
|
||||
${SOURCESDK_LIB}/linux64/mathlib.a
|
||||
spdlog
|
||||
dynload_s
|
||||
dyncall_s
|
||||
distorm
|
||||
funchook-static
|
||||
dynohook
|
||||
)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs=libprotobuf.a")
|
||||
|
||||
set(
|
||||
COUNTER_STRIKE_SHARP_LINK_LIBRARIES
|
||||
${SOURCESDK_LIB}/linux64/libtier0.so
|
||||
${SOURCESDK_LIB}/linux64/tier1.a
|
||||
${SOURCESDK_LIB}/linux64/interfaces.a
|
||||
${SOURCESDK_LIB}/linux64/mathlib.a
|
||||
spdlog
|
||||
dynload_s
|
||||
dyncall_s
|
||||
distorm
|
||||
funchook-static
|
||||
dynohook
|
||||
)
|
||||
|
||||
59
makefiles/protobuf.cmake
Normal file
59
makefiles/protobuf.cmake
Normal file
@@ -0,0 +1,59 @@
|
||||
# Credit for this protobuf generation cmake file goes to Poggicek.
|
||||
# Based on their work at https://github.com/Poggicek/StickerInspect
|
||||
|
||||
set(PROTO_TARGETS
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/network_connection.proto
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/networkbasetypes.proto
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/cs_gameevents.proto
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/engine_gcmessages.proto
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/gcsdk_gcmessages.proto
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/cstrike15_gcmessages.proto
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/cstrike15_usermessages.proto
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/netmessages.proto
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/steammessages.proto
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/usermessages.proto
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/gameevents.proto
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/clientmessages.proto
|
||||
${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo/te.proto
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
set(PROTOC_EXECUTABLE ${PROJECT_SOURCE_DIR}/libraries/hl2sdk-cs2/devtools/bin/linux/protoc)
|
||||
elseif(WIN32)
|
||||
set(PROTOC_EXECUTABLE ${PROJECT_SOURCE_DIR}/libraries/hl2sdk-cs2/devtools/bin/protoc.exe)
|
||||
endif()
|
||||
|
||||
foreach(PROTO_TARGET ${PROTO_TARGETS})
|
||||
get_filename_component(PROTO_FILENAME ${PROTO_TARGET} NAME_WLE)
|
||||
list(APPEND PROTO_OUTPUT ${PROTO_FILENAME}.pb.cc ${PROTO_FILENAME}.pb.h)
|
||||
list(APPEND PROTO_INPUT ${PROTO_FILENAME}.proto)
|
||||
get_filename_component(PROTO_PATH ${PROTO_TARGET} DIRECTORY)
|
||||
list(APPEND PROTO_PATHS "--proto_path=${PROTO_PATH}")
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES PROTO_PATHS)
|
||||
list(TRANSFORM PROTO_OUTPUT PREPEND ${CMAKE_CURRENT_BINARY_DIR}/protobufcompiler/)
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/protobufcompiler)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${PROTO_OUTPUT}
|
||||
COMMAND "${PROTOC_EXECUTABLE}" -I ${PROJECT_SOURCE_DIR}/libraries/hl2sdk-cs2/thirdparty/protobuf-3.21.8/src --proto_path=${PROJECT_SOURCE_DIR}/libraries/Protobufs/csgo ${PROTO_PATHS} --cpp_out=${CMAKE_CURRENT_BINARY_DIR}/protobufcompiler ${PROTO_INPUT}
|
||||
COMMENT "Generating protobuf file"
|
||||
)
|
||||
|
||||
add_library(Protobufs STATIC
|
||||
${PROTO_OUTPUT}
|
||||
)
|
||||
|
||||
target_include_directories(Protobufs
|
||||
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/protobufcompiler
|
||||
PUBLIC ${PROJECT_SOURCE_DIR}/libraries/hl2sdk-cs2/thirdparty/protobuf-3.21.8/src
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(Protobufs PUBLIC ${PROJECT_SOURCE_DIR}/libraries/hl2sdk-cs2/lib/public/win64/2015/libprotobuf.lib)
|
||||
elseif(UNIX)
|
||||
target_link_libraries(Protobufs PUBLIC ${PROJECT_SOURCE_DIR}/libraries/hl2sdk-cs2/lib/linux64/release/libprotobuf.a)
|
||||
endif()
|
||||
set_target_properties(Protobufs PROPERTIES LINKER_LANGUAGE CXX)
|
||||
set_target_properties(Protobufs PROPERTIES FOLDER SDK)
|
||||
@@ -1,8 +1,8 @@
|
||||
if (UNIX AND NOT APPLE)
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(LINUX TRUE)
|
||||
endif()
|
||||
|
||||
if (WIN32 AND NOT MSVC)
|
||||
if(WIN32 AND NOT MSVC)
|
||||
message(FATAL "MSVC restricted.")
|
||||
endif()
|
||||
|
||||
@@ -11,23 +11,23 @@ set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING
|
||||
FORCE
|
||||
)
|
||||
|
||||
# TODO: Use C++20 instead.
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
if (LINUX)
|
||||
if(LINUX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
endif()
|
||||
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
||||
|
||||
set(LIBRARIES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libraries)
|
||||
set(SOURCESDK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libraries/hl2sdk-cs2)
|
||||
set(METAMOD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libraries/metamod-source)
|
||||
|
||||
set(SOURCESDK ${SOURCESDK_DIR}/${BRANCH})
|
||||
set(SOURCESDK_LIB ${SOURCESDK}/lib)
|
||||
|
||||
add_definitions(-DMETA_IS_SOURCE2)
|
||||
add_definitions(-DMETA_IS_SOURCE2 -D_ITERATOR_DEBUG_LEVEL=0)
|
||||
|
||||
if(DEFINED ENV{GITHUB_SHA_SHORT})
|
||||
add_definitions(-DGITHUB_SHA="$ENV{GITHUB_SHA_SHORT}")
|
||||
@@ -35,10 +35,14 @@ else()
|
||||
add_definitions(-DGITHUB_SHA="Local")
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{BUILD_NUMBER})
|
||||
add_definitions(-DBUILD_NUMBER="$ENV{BUILD_NUMBER}")
|
||||
if(DEFINED ENV{SEMVER})
|
||||
add_definitions(-DSEMVER="$ENV{SEMVER}")
|
||||
else()
|
||||
add_definitions(-DBUILD_NUMBER="0")
|
||||
add_definitions(-DSEMVER="Local")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0)
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
@@ -54,7 +58,7 @@ include_directories(
|
||||
${SOURCESDK}/public/tier1
|
||||
${SOURCESDK}/public/entity2
|
||||
${SOURCESDK}/public/game/server
|
||||
${SOURCESDK}/public/entity2
|
||||
${SOURCESDK}/public/schemasystem
|
||||
${METAMOD_DIR}/core
|
||||
${METAMOD_DIR}/core/sourcehook
|
||||
libraries/dyncall/dynload
|
||||
@@ -67,4 +71,6 @@ include_directories(
|
||||
libraries
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/metamod/configure_metamod.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/metamod/configure_metamod.cmake)
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ add_definitions(
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4819 /wd4828 /wd5033 /permissive- /utf-8 /wd4005 /MP")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt")
|
||||
|
||||
set(COUNTER_STRIKE_SHARP_LINK_LIBRARIES
|
||||
${SOURCESDK_LIB}/public/win64/tier0.lib
|
||||
@@ -18,4 +19,4 @@ set(COUNTER_STRIKE_SHARP_LINK_LIBRARIES
|
||||
distorm
|
||||
funchook-static
|
||||
dynohook
|
||||
)
|
||||
)
|
||||
|
||||
Binary file not shown.
BIN
managed/CounterStrikeSharp.API/ApiCompat/v202.dll
Normal file
BIN
managed/CounterStrikeSharp.API/ApiCompat/v202.dll
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,9 @@
|
||||
|
||||
using System;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.UserMessages;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core
|
||||
{
|
||||
@@ -204,6 +206,18 @@ namespace CounterStrikeSharp.API.Core
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReplicateConvar(int clientslot, string convarname, string convarvalue){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(clientslot);
|
||||
ScriptContext.GlobalScriptContext.Push(convarname);
|
||||
ScriptContext.GlobalScriptContext.Push(convarvalue);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xC8728BEC);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static T DynamicHookGetReturn<T>(IntPtr hook, int datatype){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
@@ -335,6 +349,16 @@ 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 void IssueServerCommand(string command){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
@@ -558,6 +582,17 @@ namespace CounterStrikeSharp.API.Core
|
||||
}
|
||||
}
|
||||
|
||||
public static void DisconnectClient(int slot, int reason){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(slot);
|
||||
ScriptContext.GlobalScriptContext.Push(reason);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x799EE9C3);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static IntPtr GetEntityFromIndex(int index){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
@@ -714,6 +749,52 @@ namespace CounterStrikeSharp.API.Core
|
||||
}
|
||||
}
|
||||
|
||||
public static void AcceptInput(IntPtr pthis, string inputname, IntPtr activator, IntPtr caller, string value, int outputid){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(pthis);
|
||||
ScriptContext.GlobalScriptContext.Push(inputname);
|
||||
ScriptContext.GlobalScriptContext.Push(activator);
|
||||
ScriptContext.GlobalScriptContext.Push(caller);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.Push(outputid);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x259E084C);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddEntityIoEvent(IntPtr ptarget, string inputname, IntPtr activator, IntPtr caller, string value, float delay, int outputid){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(ptarget);
|
||||
ScriptContext.GlobalScriptContext.Push(inputname);
|
||||
ScriptContext.GlobalScriptContext.Push(activator);
|
||||
ScriptContext.GlobalScriptContext.Push(caller);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.Push(delay);
|
||||
ScriptContext.GlobalScriptContext.Push(outputid);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x4CFDE98A);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static uint EmitSoundFilter(ulong filtermask, uint ent, string sound, float volume, float pitch){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(filtermask);
|
||||
ScriptContext.GlobalScriptContext.Push(ent);
|
||||
ScriptContext.GlobalScriptContext.Push(sound);
|
||||
ScriptContext.GlobalScriptContext.Push(volume);
|
||||
ScriptContext.GlobalScriptContext.Push(pitch);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x43C4A2B3);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (uint)ScriptContext.GlobalScriptContext.GetResult(typeof(uint));
|
||||
}
|
||||
}
|
||||
|
||||
public static void HookEvent(string name, InputArgument callback, bool ispost){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
@@ -1106,6 +1187,17 @@ namespace CounterStrikeSharp.API.Core
|
||||
}
|
||||
}
|
||||
|
||||
public static IntPtr MetaFactory(string interfacename){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(interfacename);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x61521EF3);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (IntPtr)ScriptContext.GlobalScriptContext.GetResult(typeof(IntPtr));
|
||||
}
|
||||
}
|
||||
|
||||
public static short GetSchemaOffset(string classname, string propname){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
@@ -1212,6 +1304,375 @@ namespace CounterStrikeSharp.API.Core
|
||||
}
|
||||
}
|
||||
|
||||
public static void HookUsermessage(int messageid, InputArgument callback, HookMode mode){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(messageid);
|
||||
ScriptContext.GlobalScriptContext.Push((InputArgument)callback);
|
||||
ScriptContext.GlobalScriptContext.Push(mode);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x76C63A83);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnhookUsermessage(int messageid, InputArgument callback, HookMode mode){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(messageid);
|
||||
ScriptContext.GlobalScriptContext.Push((InputArgument)callback);
|
||||
ScriptContext.GlobalScriptContext.Push(mode);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x63B0AC38);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool PbHasfield(UserMessage message, string name){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xC971FB70);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (bool)ScriptContext.GlobalScriptContext.GetResult(typeof(bool));
|
||||
}
|
||||
}
|
||||
|
||||
public static int PbReadint(UserMessage message, string name, int index){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(index);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x5FA8BDC9);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (int)ScriptContext.GlobalScriptContext.GetResult(typeof(int));
|
||||
}
|
||||
}
|
||||
|
||||
public static long PbReadint64(UserMessage message, string name, int index){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(index);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xECCF528B);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (long)ScriptContext.GlobalScriptContext.GetResult(typeof(long));
|
||||
}
|
||||
}
|
||||
|
||||
public static float PbReadfloat(UserMessage message, string name, int index){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(index);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xED208CEA);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (float)ScriptContext.GlobalScriptContext.GetResult(typeof(float));
|
||||
}
|
||||
}
|
||||
|
||||
public static bool PbReadbool(UserMessage message, string name, int index){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(index);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x54C0D7F4);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (bool)ScriptContext.GlobalScriptContext.GetResult(typeof(bool));
|
||||
}
|
||||
}
|
||||
|
||||
public static string PbReadstring(UserMessage message, string name, int index){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(index);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x66CACEEF);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (string)ScriptContext.GlobalScriptContext.GetResult(typeof(string));
|
||||
}
|
||||
}
|
||||
|
||||
public static int PbGetrepeatedfieldcount(UserMessage message, string name){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xDE4E1549);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (int)ScriptContext.GlobalScriptContext.GetResult(typeof(int));
|
||||
}
|
||||
}
|
||||
|
||||
public static void PbSetint(UserMessage message, string name, int value, int index){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.Push(index);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x99BBC059);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void PbSetint64(UserMessage message, string name, long value, int index){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.Push(index);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xF7AD351B);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void PbSetfloat(UserMessage message, string name, float value, int index){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.Push(index);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xF7FDEB7A);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void PbSetbool(UserMessage message, string name, bool value, int index){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.Push(index);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xD1342864);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void PbSetstring(UserMessage message, string name, string value, int index){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.Push(index);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x15C78B7F);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void PbAddint(UserMessage message, string name, int value){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x66CD6A1A);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void PbAddint64(UserMessage message, string name, object value){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x4FD05AD8);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void PbAddfloat(UserMessage message, string name, float value){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x5117B239);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void PbAddbool(UserMessage message, string name, bool value){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x40827C47);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void PbAddstring(UserMessage message, string name, string value){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(value);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x8DFD739C);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void PbRemoverepeatedfieldvalue(UserMessage message, string name, int index){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.Push(index);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x1721FCB1);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static string PbGetdebugstring(UserMessage message){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x913FB7BA);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (string)ScriptContext.GlobalScriptContext.GetResult(typeof(string));
|
||||
}
|
||||
}
|
||||
|
||||
public static ulong UsermessageGetrecipients(UserMessage message){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x70CDDEBE);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (ulong)ScriptContext.GlobalScriptContext.GetResult(typeof(ulong));
|
||||
}
|
||||
}
|
||||
|
||||
public static void UsermessageSetrecipients(UserMessage message, ulong recipients){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.Push(recipients);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xB4ED43AA);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static int UsermessageFindmessageidbyname(string name){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x22CD6C9F);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (int)ScriptContext.GlobalScriptContext.GetResult(typeof(int));
|
||||
}
|
||||
}
|
||||
|
||||
public static IntPtr UsermessageCreate(string name){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(name);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xE8E83344);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (IntPtr)ScriptContext.GlobalScriptContext.GetResult(typeof(IntPtr));
|
||||
}
|
||||
}
|
||||
|
||||
public static IntPtr UsermessageCreatebyid(int id){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(id);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xBC758632);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (IntPtr)ScriptContext.GlobalScriptContext.GetResult(typeof(IntPtr));
|
||||
}
|
||||
}
|
||||
|
||||
public static void UsermessageSend(UserMessage message){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0x24EB6B3C);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static void UsermessageDelete(UserMessage message){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xE10465D9);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public static int UsermessageGetid(UserMessage message){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xC17BA71B);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (int)ScriptContext.GlobalScriptContext.GetResult(typeof(int));
|
||||
}
|
||||
}
|
||||
|
||||
public static string UsermessageGetname(UserMessage message){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xEFE0FD1);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (string)ScriptContext.GlobalScriptContext.GetResult(typeof(string));
|
||||
}
|
||||
}
|
||||
|
||||
public static string UsermessageGettype(UserMessage message){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
ScriptContext.GlobalScriptContext.Push(message);
|
||||
ScriptContext.GlobalScriptContext.SetIdentifier(0xEF4842E);
|
||||
ScriptContext.GlobalScriptContext.Invoke();
|
||||
ScriptContext.GlobalScriptContext.CheckErrors();
|
||||
return (string)ScriptContext.GlobalScriptContext.GetResult(typeof(string));
|
||||
}
|
||||
}
|
||||
|
||||
public static IntPtr VectorNew(){
|
||||
lock (ScriptContext.GlobalScriptContext.Lock) {
|
||||
ScriptContext.GlobalScriptContext.Reset();
|
||||
|
||||
@@ -156,17 +156,10 @@ namespace CounterStrikeSharp.API.Core
|
||||
break;
|
||||
}
|
||||
|
||||
// If our arugment doesn't end in ".dll" - try and construct a path similar to PluginName/PluginName.dll.
|
||||
// If our argument doesn't end in ".dll" - try and construct a path similar to PluginName/PluginName.dll.
|
||||
// We'll assume we have a full path if we have ".dll".
|
||||
var path = info.GetArg(2);
|
||||
if (!path.EndsWith(".dll"))
|
||||
{
|
||||
path = Path.Combine(_scriptHostConfiguration.RootPath, $"plugins/{path}/{path}.dll");
|
||||
}
|
||||
else
|
||||
{
|
||||
path = Path.Combine(_scriptHostConfiguration.RootPath, path);
|
||||
}
|
||||
path = Path.Combine(_scriptHostConfiguration.RootPath, !path.EndsWith(".dll") ? $"plugins/{path}/{path}.dll" : path);
|
||||
|
||||
var plugin = _pluginContextQueryHandler.FindPluginByModulePath(path);
|
||||
|
||||
@@ -204,7 +197,13 @@ namespace CounterStrikeSharp.API.Core
|
||||
}
|
||||
|
||||
var pluginIdentifier = info.GetArg(2);
|
||||
IPluginContext? plugin = _pluginContextQueryHandler.FindPluginByIdOrName(pluginIdentifier);
|
||||
string path;
|
||||
path = Path.Combine(_scriptHostConfiguration.RootPath,
|
||||
!pluginIdentifier.EndsWith(".dll") ? $"plugins/{pluginIdentifier}/{pluginIdentifier}.dll" : pluginIdentifier);
|
||||
|
||||
var plugin = _pluginContextQueryHandler.FindPluginByIdOrName(pluginIdentifier)
|
||||
?? _pluginContextQueryHandler.FindPluginByModulePath(path);
|
||||
|
||||
if (plugin == null)
|
||||
{
|
||||
info.ReplyToCommand($"Could not unload plugin \"{pluginIdentifier}\"");
|
||||
@@ -249,7 +248,7 @@ namespace CounterStrikeSharp.API.Core
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnLangCommand(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
if (player == null) return;
|
||||
@@ -305,4 +304,4 @@ namespace CounterStrikeSharp.API.Core
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core.Attributes.Registration;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class ListenerHandlerAttribute<T> : Attribute
|
||||
where T: Delegate
|
||||
{
|
||||
}
|
||||
@@ -30,6 +30,7 @@ using CounterStrikeSharp.API.Modules.Timers;
|
||||
using CounterStrikeSharp.API.Modules.Config;
|
||||
using CounterStrikeSharp.API.Modules.Cvars;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.UserMessages;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -115,16 +116,10 @@ namespace CounterStrikeSharp.API.Core
|
||||
|
||||
public readonly Dictionary<Delegate, CallbackSubscriber> Handlers =
|
||||
new Dictionary<Delegate, CallbackSubscriber>();
|
||||
|
||||
public readonly Dictionary<Delegate, CallbackSubscriber> CommandHandlers =
|
||||
new Dictionary<Delegate, CallbackSubscriber>();
|
||||
|
||||
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>();
|
||||
|
||||
@@ -134,6 +129,8 @@ namespace CounterStrikeSharp.API.Core
|
||||
internal readonly Dictionary<Delegate, EntityIO.EntityOutputCallback> EntitySingleOutputHooks =
|
||||
new Dictionary<Delegate, EntityIO.EntityOutputCallback>();
|
||||
|
||||
public readonly List<CommandDefinition> CommandDefinitions = new List<CommandDefinition>();
|
||||
|
||||
public readonly List<Timer> Timers = new List<Timer>();
|
||||
|
||||
public delegate HookResult GameEventHandler<T>(T @event, GameEventInfo info) where T : GameEvent;
|
||||
@@ -159,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;
|
||||
@@ -179,14 +192,22 @@ namespace CounterStrikeSharp.API.Core
|
||||
public void AddCommand(string name, string description, CommandInfo.CommandCallback handler)
|
||||
{
|
||||
var definition = new CommandDefinition(name, description, handler);
|
||||
CommandDefinitions.Add(definition);
|
||||
CommandManager.RegisterCommand(definition);
|
||||
}
|
||||
|
||||
private void AddCommand(CommandDefinition definition)
|
||||
{
|
||||
CommandDefinitions.Add(definition);
|
||||
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) =>
|
||||
@@ -202,19 +223,27 @@ 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))
|
||||
var definition = CommandDefinitions.FirstOrDefault(
|
||||
definition => definition.Name == name && definition.Callback == handler);
|
||||
|
||||
if (definition != null)
|
||||
{
|
||||
var subscriber = CommandHandlers[handler];
|
||||
|
||||
NativeAPI.RemoveCommand(name, subscriber.GetInputArgument());
|
||||
|
||||
FunctionReference.Remove(subscriber.GetReferenceIdentifier());
|
||||
CommandHandlers.Remove(handler);
|
||||
CommandDefinitions.Remove(definition);
|
||||
CommandManager.RemoveCommand(definition);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a command listener.
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="AddCommandListener"/>
|
||||
public void RemoveCommandListener(string name, CommandInfo.CommandListenerCallback handler, HookMode mode)
|
||||
{
|
||||
if (CommandListeners.ContainsKey(handler))
|
||||
@@ -228,39 +257,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<Listeners.OnTick>(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();
|
||||
@@ -291,6 +305,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;
|
||||
@@ -300,6 +342,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);
|
||||
@@ -307,7 +357,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);
|
||||
@@ -342,20 +396,26 @@ 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"/> and <see cref="ListenerHandlerAttribute{T}"/> attribute.
|
||||
/// </summary>
|
||||
/// <param name="instance">The instance of the object where the event handlers are defined.</param>
|
||||
public void RegisterAttributeHandlers(object instance)
|
||||
{
|
||||
var eventHandlers = instance.GetType()
|
||||
.GetMethods()
|
||||
var methods = instance.GetType().GetMethods();
|
||||
|
||||
var eventHandlers = methods
|
||||
.Where(method => method.GetCustomAttribute<GameEventHandlerAttribute>() != null)
|
||||
.Where(method =>
|
||||
method.GetParameters().FirstOrDefault()?.ParameterType.IsSubclassOf(typeof(GameEvent)) == true)
|
||||
.ToArray();
|
||||
|
||||
var listenerHandlers = methods
|
||||
.Where(method => method.GetCustomAttribute(typeof(ListenerHandlerAttribute<>)) != null)
|
||||
.ToArray();
|
||||
|
||||
var method = typeof(BasePlugin).GetMethod("RegisterEventHandlerInternal", BindingFlags.NonPublic |
|
||||
var registerEvent = typeof(BasePlugin).GetMethod(nameof(RegisterEventHandlerInternal), BindingFlags.NonPublic |
|
||||
BindingFlags.Instance)!;
|
||||
var registerListener = GetType().GetMethod(nameof(RegisterListener))!;
|
||||
|
||||
foreach (var eventHandler in eventHandlers)
|
||||
{
|
||||
@@ -367,11 +427,29 @@ namespace CounterStrikeSharp.API.Core
|
||||
var actionType = typeof(GameEventHandler<>).MakeGenericType(parameterType);
|
||||
var action = Delegate.CreateDelegate(actionType, instance, eventHandler);
|
||||
|
||||
var generic = method.MakeGenericMethod(parameterType);
|
||||
generic.Invoke(this, new object[] { eventName, action, hookMode == HookMode.Post });
|
||||
var registerEventGeneric = registerEvent.MakeGenericMethod(parameterType);
|
||||
registerEventGeneric.Invoke(this, [eventName, action, hookMode == HookMode.Post]);
|
||||
}
|
||||
|
||||
foreach (var listnerHandler in listenerHandlers)
|
||||
{
|
||||
var attribute = listnerHandler.GetCustomAttribute(typeof(ListenerHandlerAttribute<>))!;
|
||||
var listenerType = attribute.GetType().GetGenericArguments().First();
|
||||
|
||||
if (listenerType.GetCustomAttribute<ListenerNameAttribute>() == null)
|
||||
throw new ArgumentException("Listener of type T is invalid and does not have a name attribute",
|
||||
listenerType.Name);
|
||||
|
||||
var listenerDelegate = Delegate.CreateDelegate(listenerType, instance, listnerHandler);
|
||||
|
||||
registerListener.MakeGenericMethod(listenerType).Invoke(this, [listenerDelegate]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <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()
|
||||
@@ -399,6 +477,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()
|
||||
@@ -453,6 +535,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,
|
||||
@@ -461,7 +549,29 @@ namespace CounterStrikeSharp.API.Core
|
||||
NativeAPI.HookEntityOutput(classname, outputName, subscriber.GetInputArgument(), mode);
|
||||
EntityOutputHooks[handler] = subscriber;
|
||||
}
|
||||
|
||||
public void HookUserMessage(int messageId, UserMessage.UserMessageHandler handler, HookMode mode = HookMode.Pre)
|
||||
{
|
||||
var subscriber = new CallbackSubscriber(handler, handler,
|
||||
() => UnhookUserMessage(messageId, handler));
|
||||
|
||||
NativeAPI.HookUsermessage(messageId, subscriber.GetInputArgument(), mode);
|
||||
Handlers[handler] = subscriber;
|
||||
}
|
||||
|
||||
public void UnhookUserMessage(int messageId, UserMessage.UserMessageHandler handler, HookMode mode = HookMode.Pre)
|
||||
{
|
||||
if (!Handlers.TryGetValue(handler, out var subscriber)) return;
|
||||
|
||||
NativeAPI.UnhookUsermessage(messageId, subscriber.GetInputArgument(), mode);
|
||||
FunctionReference.Remove(subscriber.GetReferenceIdentifier());
|
||||
Handlers.Remove(handler);
|
||||
}
|
||||
|
||||
/// <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;
|
||||
@@ -471,6 +581,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
|
||||
@@ -494,6 +610,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);
|
||||
@@ -521,21 +641,12 @@ namespace CounterStrikeSharp.API.Core
|
||||
{
|
||||
subscriber.Dispose();
|
||||
}
|
||||
|
||||
foreach (var subscriber in CommandHandlers.Values)
|
||||
{
|
||||
subscriber.Dispose();
|
||||
}
|
||||
|
||||
foreach (var subscriber in CommandListeners.Values)
|
||||
{
|
||||
subscriber.Dispose();
|
||||
}
|
||||
|
||||
foreach (var kv in ConvarChangeHandlers)
|
||||
{
|
||||
}
|
||||
|
||||
foreach (var subscriber in Listeners.Values)
|
||||
{
|
||||
subscriber.Dispose();
|
||||
@@ -546,6 +657,11 @@ namespace CounterStrikeSharp.API.Core
|
||||
subscriber.Dispose();
|
||||
}
|
||||
|
||||
foreach (var definition in CommandDefinitions)
|
||||
{
|
||||
CommandManager.RemoveCommand(definition);
|
||||
}
|
||||
|
||||
foreach (var timer in Timers)
|
||||
{
|
||||
timer.Kill();
|
||||
@@ -554,4 +670,4 @@ namespace CounterStrikeSharp.API.Core
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,8 +70,13 @@ public class CommandManager : ICommandManager
|
||||
|
||||
if (_commandDefinitions.TryGetValue(name, out var handler))
|
||||
{
|
||||
foreach (var command in handler)
|
||||
foreach (var command in handler.ToList())
|
||||
{
|
||||
if (!handler.Contains(command))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var methodInfo = command.Callback?.GetMethodInfo();
|
||||
|
||||
// We do not need to do permission checks on commands executed from the server console.
|
||||
|
||||
@@ -46,15 +46,21 @@ namespace CounterStrikeSharp.API.Core
|
||||
|
||||
[JsonPropertyName("FollowCS2ServerGuidelines")]
|
||||
public bool FollowCS2ServerGuidelines { get; set; } = true;
|
||||
|
||||
|
||||
[JsonPropertyName("PluginHotReloadEnabled")]
|
||||
public bool PluginHotReloadEnabled { get; set; } = true;
|
||||
|
||||
|
||||
[JsonPropertyName("PluginAutoLoadEnabled")]
|
||||
public bool PluginAutoLoadEnabled { get; set; } = true;
|
||||
|
||||
|
||||
[JsonPropertyName("ServerLanguage")]
|
||||
public string ServerLanguage { get; set; } = "en";
|
||||
|
||||
[JsonPropertyName("UnlockConCommands")]
|
||||
public bool UnlockConCommands { get; set; } = true;
|
||||
|
||||
[JsonPropertyName("UnlockConVars")]
|
||||
public bool UnlockConVars { get; set; } = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -97,14 +103,18 @@ namespace CounterStrikeSharp.API.Core
|
||||
/// When enabled, plugins are automatically reloaded when their .dll file is updated.
|
||||
/// </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 static bool UnlockConCommands => _coreConfig.UnlockConCommands;
|
||||
|
||||
public static bool UnlockConVars => _coreConfig.UnlockConVars;
|
||||
|
||||
}
|
||||
|
||||
public partial class CoreConfig : IStartupService
|
||||
@@ -140,28 +150,29 @@ namespace CounterStrikeSharp.API.Core
|
||||
ReloadCoreConfigCommand));
|
||||
_commandsRegistered = true;
|
||||
}
|
||||
|
||||
if (!File.Exists(_coreConfigPath))
|
||||
|
||||
if (File.Exists(_coreConfigPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = JsonSerializer.Deserialize<CoreConfigData>(File.ReadAllText(_coreConfigPath),
|
||||
new JsonSerializerOptions() { ReadCommentHandling = JsonCommentHandling.Skip });
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
_coreConfig = data;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to load core configuration, fallback values will be used");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"Core configuration could not be found at path \"{CoreConfigPath}\", fallback values will be used.",
|
||||
_coreConfigPath);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var data = JsonSerializer.Deserialize<CoreConfigData>(File.ReadAllText(_coreConfigPath),
|
||||
new JsonSerializerOptions() { ReadCommentHandling = JsonCommentHandling.Skip });
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
_coreConfig = data;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to load core configuration, fallback values will be used");
|
||||
}
|
||||
|
||||
var serverCulture = CultureInfo.GetCultures(CultureTypes.AllCultures)
|
||||
@@ -181,13 +192,13 @@ namespace CounterStrikeSharp.API.Core
|
||||
serverCulture = CultureInfo.InvariantCulture;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CultureInfo.DefaultThreadCurrentUICulture = serverCulture;
|
||||
CultureInfo.DefaultThreadCurrentCulture = serverCulture;
|
||||
CultureInfo.CurrentUICulture = serverCulture;
|
||||
CultureInfo.CurrentCulture = serverCulture;
|
||||
|
||||
|
||||
_logger.LogInformation("Successfully loaded core configuration");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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>
|
||||
@@ -61,12 +67,15 @@ namespace CounterStrikeSharp.API.Core
|
||||
/// <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);
|
||||
|
||||
@@ -163,5 +163,18 @@ namespace CounterStrikeSharp.API.Core
|
||||
/// <param name="manifest">Resource Manifest</param>
|
||||
[ListenerName("OnServerPrecacheResources")]
|
||||
public delegate void OnServerPrecacheResources(ResourceManifest manifest);
|
||||
|
||||
/// <summary>
|
||||
/// Called when checking transmit on entities.
|
||||
/// </summary>
|
||||
/// <param name="infoList">Transmit info list</param>
|
||||
[ListenerName("CheckTransmit")]
|
||||
public delegate void CheckTransmit([CastFrom(typeof(nint))]CCheckTransmitInfoList infoList);
|
||||
|
||||
/// <summary>
|
||||
/// Called when all metamod plugins are loaded.
|
||||
/// </summary>
|
||||
[ListenerName("OnMetamodAllPluginsLoaded")]
|
||||
public delegate void OnMetamodAllPluginsLoaded();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,21 @@ 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)
|
||||
/// <exception cref="ArgumentNullException">No valid argument</exception>
|
||||
public void Teleport(Vector? position = null, QAngle? angles = null, Vector? velocity = null)
|
||||
{
|
||||
Guard.IsValidEntity(this);
|
||||
|
||||
VirtualFunction.CreateVoid<IntPtr, IntPtr, IntPtr, IntPtr>(Handle, GameData.GetOffset("CBaseEntity_Teleport"))(
|
||||
Handle, position.Handle, angles.Handle, velocity.Handle);
|
||||
if (position == null && angles == null && velocity == null)
|
||||
throw new ArgumentNullException("No valid argument");
|
||||
|
||||
nint _position = position?.Handle ?? 0;
|
||||
nint _angles = angles?.Handle ?? 0;
|
||||
nint _velocity = velocity?.Handle ?? 0;
|
||||
nint _handle = Handle;
|
||||
|
||||
VirtualFunction.CreateVoid<IntPtr, IntPtr, IntPtr, IntPtr>(_handle, GameData.GetOffset("CBaseEntity_Teleport"))(_handle, _position,
|
||||
_angles, _velocity);
|
||||
}
|
||||
|
||||
/// <exception cref="InvalidOperationException">Entity is not valid</exception>
|
||||
@@ -39,6 +48,27 @@ 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));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Emit a soundevent to all players.
|
||||
/// </summary>
|
||||
/// <param name="soundEventName">The name of the soundevent to emit.</param>
|
||||
/// <param name="recipients">The recipients of the soundevent.</param>
|
||||
/// <param name="volume">The volume of the soundevent.</param>
|
||||
/// <param name="pitch">The pitch of the soundevent.</param>
|
||||
/// <returns>The sound event guid.</returns>
|
||||
public uint EmitSound(string soundEventName, RecipientFilter? recipients = null, float volume = 1f, float pitch = 0)
|
||||
{
|
||||
Guard.IsValidEntity(this);
|
||||
|
||||
if (recipients == null)
|
||||
{
|
||||
recipients = new RecipientFilter();
|
||||
recipients.AddAllPlayers();
|
||||
}
|
||||
|
||||
return NativeAPI.EmitSoundFilter(recipients.GetRecipientMask(), this.Index, soundEventName, volume, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
@@ -28,4 +29,33 @@ public partial class CCSGameRules
|
||||
{
|
||||
VirtualFunctions.TerminateRound(Handle, roundEndReason, delay, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public T? FindPickerEntity<T>(CBasePlayerController player)
|
||||
where T : CBaseEntity
|
||||
{
|
||||
VirtualFunctionWithReturn<CCSGameRules, CBasePlayerController, CBaseEntity?> CCSGameRules_FindPickerEntity = new (Handle, GameData.GetOffset("CCSGameRules_FindPickerEntity"));
|
||||
CBaseEntity? entity = CCSGameRules_FindPickerEntity.Invoke(this, player);
|
||||
|
||||
if (entity == null || !entity.IsValid)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return entity.As<T>();
|
||||
}
|
||||
|
||||
public CCSPlayerController? GetClientAimTarget(CCSPlayerController player)
|
||||
{
|
||||
CCSPlayerPawn? pawn = FindPickerEntity<CCSPlayerPawn>(player);
|
||||
|
||||
if (pawn == null || !pawn.IsValid)
|
||||
return null;
|
||||
|
||||
if (pawn.DesignerName == "player")
|
||||
{
|
||||
return pawn.OriginalController.Value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
|
||||
using CounterStrikeSharp.API.Modules.Cvars;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.ValveConstants.Protobuf;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
@@ -16,17 +16,17 @@ 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);
|
||||
|
||||
return PlayerPawn.Value?.ItemServices?.As<CCSPlayer_ItemServices>().GiveNamedItem<T>(item);
|
||||
}
|
||||
|
||||
public IntPtr GiveNamedItem(CsItem item)
|
||||
{
|
||||
string? itemString = EnumUtils.GetEnumMemberAttributeValue(item);
|
||||
if (string.IsNullOrWhiteSpace(itemString))
|
||||
@@ -61,6 +61,14 @@ public partial class CCSPlayerController
|
||||
VirtualFunctions.ClientPrint(Handle, HudDestination.Center, message, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/// <exception cref="InvalidOperationException">Entity is not valid</exception>
|
||||
public void PrintToCenterAlert(string message)
|
||||
{
|
||||
Guard.IsValidEntity(this);
|
||||
|
||||
VirtualFunctions.ClientPrint(Handle, HudDestination.Alert, message, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public void PrintToCenterHtml(string message) => PrintToCenterHtml(message, 5);
|
||||
|
||||
/// <exception cref="InvalidOperationException">Entity is not valid</exception>
|
||||
@@ -85,17 +93,13 @@ public partial class CCSPlayerController
|
||||
public void DropActiveWeapon()
|
||||
{
|
||||
Guard.IsValidEntity(this);
|
||||
if (!PlayerPawn.IsValid) return;
|
||||
if (PlayerPawn.Value == null) return;
|
||||
if (!PlayerPawn.Value.IsValid) return;
|
||||
if (PlayerPawn.Value.ItemServices == null) return;
|
||||
if (PlayerPawn.Value.WeaponServices == null) return;
|
||||
if (!PlayerPawn.Value.WeaponServices.ActiveWeapon.IsValid) return;
|
||||
|
||||
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);
|
||||
var itemServices = PlayerPawn.Value?.ItemServices?.As<CCSPlayer_ItemServices>();
|
||||
var activeWeapon = PlayerPawn.Value?.WeaponServices?.ActiveWeapon.Value;
|
||||
|
||||
if (activeWeapon == null || itemServices == null) return;
|
||||
|
||||
itemServices.DropActivePlayerWeapon(activeWeapon);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -105,13 +109,8 @@ public partial class CCSPlayerController
|
||||
public void RemoveWeapons()
|
||||
{
|
||||
Guard.IsValidEntity(this);
|
||||
if (!PlayerPawn.IsValid) return;
|
||||
if (PlayerPawn.Value == null) return;
|
||||
if (!PlayerPawn.Value.IsValid) return;
|
||||
if (PlayerPawn.Value.ItemServices == null) return;
|
||||
|
||||
CCSPlayer_ItemServices itemServices = new CCSPlayer_ItemServices(PlayerPawn.Value.ItemServices.Handle);
|
||||
itemServices.RemoveWeapons();
|
||||
PlayerPawn.Value?.ItemServices?.As<CCSPlayer_ItemServices>().RemoveWeapons();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -123,11 +122,8 @@ public partial class CCSPlayerController
|
||||
public void CommitSuicide(bool explode, bool force)
|
||||
{
|
||||
Guard.IsValidEntity(this);
|
||||
if (!PlayerPawn.IsValid) return;
|
||||
if (PlayerPawn.Value == null) return;
|
||||
if (!PlayerPawn.Value.IsValid) return;
|
||||
|
||||
PlayerPawn.Value.CommitSuicide(explode, force);
|
||||
PlayerPawn.Value?.CommitSuicide(explode, force);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -137,9 +133,7 @@ public partial class CCSPlayerController
|
||||
public void Respawn()
|
||||
{
|
||||
Guard.IsValidEntity(this);
|
||||
if (!PlayerPawn.IsValid) return;
|
||||
if (PlayerPawn.Value == null) return;
|
||||
if (!PlayerPawn.Value.IsValid) return;
|
||||
|
||||
// The Call To Arms update appears to have invalidated the need for CCSPlayerPawn_Respawn.
|
||||
SetPawn(PlayerPawn.Value);
|
||||
@@ -247,6 +241,15 @@ public partial class CCSPlayerController
|
||||
NativeAPI.IssueClientCommand(Slot, command);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disconnects a player from the server with the specified reason.
|
||||
/// </summary>
|
||||
/// <param name="reason"></param>
|
||||
public void Disconnect(NetworkDisconnectionReason reason)
|
||||
{
|
||||
NativeAPI.DisconnectClient(Slot, (int)reason);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Issue the specified command directly from the server (mimics the server executing the command with the given player context).
|
||||
/// <remarks>Works with server commands like `kill`, `explode`, `noclip`, etc. </remarks>
|
||||
@@ -337,4 +340,16 @@ public partial class CCSPlayerController
|
||||
NativeAPI.SetClientVoiceFlags(Handle, (Byte)value);
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete(
|
||||
"You are trying to call Teleport on a non-physical player. Maybe you mean Pawn? (See: https://docs.cssharp.dev/docs/guides/referencing-players.html#controllers--pawns)")]
|
||||
public new void Teleport(Vector? position = null, QAngle? angles = null, Vector? velocity = null)
|
||||
{
|
||||
base.Teleport(position, angles, velocity);
|
||||
}
|
||||
|
||||
public void ReplicateConVar(string conVar, string value)
|
||||
{
|
||||
NativeAPI.ReplicateConvar(Slot, conVar, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
@@ -45,4 +47,18 @@ 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)!;
|
||||
}
|
||||
|
||||
public AcquireResult CanAcquire(CEconItemView itemView, AcquireMethod method, IntPtr unknown = 0)
|
||||
{
|
||||
return VirtualFunctions.CCSPlayer_ItemServices_CanAcquireFunc.Invoke(this, itemView, method, unknown);
|
||||
}
|
||||
}
|
||||
|
||||
106
managed/CounterStrikeSharp.API/Core/Model/CCheckTransmitInfo.cs
Normal file
106
managed/CounterStrikeSharp.API/Core/Model/CCheckTransmitInfo.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* This file is part of CounterStrikeSharp.
|
||||
* CounterStrikeSharp is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* CounterStrikeSharp is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CounterStrikeSharp. If not, see <https://www.gnu.org/licenses/>. *
|
||||
*/
|
||||
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct CCheckTransmitInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Entity n is already marked for transmission
|
||||
/// </summary>
|
||||
[FieldOffset(0x0)]
|
||||
public CFixedBitVecBase TransmitEntities;
|
||||
|
||||
/// <summary>
|
||||
/// Entity n is always send even if not in PVS (HLTV and Replay only)
|
||||
/// </summary>
|
||||
[FieldOffset(0x8)]
|
||||
public CFixedBitVecBase TransmitAlways;
|
||||
};
|
||||
|
||||
public sealed class CCheckTransmitInfoList : NativeObject, IReadOnlyList<(CCheckTransmitInfo info, CCSPlayerController? player)>
|
||||
{
|
||||
private int CheckTransmitPlayerSlotOffset = GameData.GetOffset("CheckTransmitPlayerSlot");
|
||||
|
||||
private unsafe nint* Inner => (nint*)base.Handle;
|
||||
|
||||
public unsafe int Count { get => (int)(*(this.Inner + 1)); }
|
||||
|
||||
public unsafe CCheckTransmitInfoList(IntPtr pointer) : base(pointer)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Get transmit info for the given index.
|
||||
/// </summary>
|
||||
/// <param name="index">Index of the info you want to retrieve from the list, should be between 0 and '<see cref="Count"/>' - 1</param>
|
||||
/// <returns></returns>
|
||||
public (CCheckTransmitInfo info, CCSPlayerController? player) this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
var (transmit, slot) = this.Get(index);
|
||||
CCSPlayerController? player = Utilities.GetPlayerFromSlot(slot);
|
||||
return (transmit, player);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get transmit info for the given index.
|
||||
/// </summary>
|
||||
/// <param name="index">Index of the info you want to retrieve from the list, should be between 0 and '<see cref="Count"/>' - 1</param>
|
||||
/// <returns></returns>
|
||||
private unsafe (CCheckTransmitInfo, int) Get(int index)
|
||||
{
|
||||
if (index < 0 || index >= this.Count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
|
||||
// 'base.Handle' holds the pointer for our 'CCheckTransmitInfoList' wrapper class
|
||||
|
||||
// Get the pointer to the array of 'CCheckTransmitInfo'
|
||||
nint* infoListPtr = *(nint**)this.Inner; // Dereference 'Inner' to get the pointer to the array
|
||||
|
||||
// Access the specific 'CCheckTransmitInfo*'
|
||||
nint infoPtr = *(infoListPtr + index);
|
||||
|
||||
// Retrieve the 'CCheckTransmitInfo' from the pointer
|
||||
CCheckTransmitInfo info = Marshal.PtrToStructure<CCheckTransmitInfo>(infoPtr);
|
||||
|
||||
// Get player slot from the 'infoPtr' using the 'CheckTransmitPlayerSlotOffset' offset
|
||||
int playerSlot = *(int*)((byte*)infoPtr + CheckTransmitPlayerSlotOffset);
|
||||
|
||||
return (info, playerSlot);
|
||||
}
|
||||
|
||||
public IEnumerator<(CCheckTransmitInfo, CCSPlayerController?)> GetEnumerator()
|
||||
{
|
||||
for (int i = 0; i < this.Count; i++)
|
||||
{
|
||||
yield return this[i];
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return this.GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public partial class CEntityInstance : IEquatable<CEntityInstance>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls a named input method on an entity.
|
||||
/// Calls a named input method on an entity, this will bypass the map IO event queue system.
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// entity.AcceptInput("Break");
|
||||
@@ -82,7 +82,30 @@ public partial class CEntityInstance : IEquatable<CEntityInstance>
|
||||
{
|
||||
Guard.IsValidEntity(this);
|
||||
|
||||
VirtualFunctions.AcceptInput(Handle, inputName, activator?.Handle ?? IntPtr.Zero, caller?.Handle ?? IntPtr.Zero, value, 0);
|
||||
NativeAPI.AcceptInput(Handle, inputName, activator?.Handle ?? IntPtr.Zero, caller?.Handle ?? IntPtr.Zero, value, outputId);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Calls a named input method on an entity, conforming to the map IO event queue system.
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// entity.AddEntityIOEvent("Break");
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// </summary>
|
||||
/// <param name="inputName">Input action name</param>
|
||||
/// <param name="activator">Entity which initiated the action, <see langword="null"/> for no entity</param>
|
||||
/// <param name="caller">Entity that is sending the event, <see langword="null"/> for no entity</param>
|
||||
/// <param name="value">String variant value to send with the event</param>
|
||||
/// <param name="delay">Delay in seconds before calling the input</param>
|
||||
/// <param name="outputId">Unknown, defaults to 0</param>
|
||||
/// <exception cref="InvalidOperationException">Entity is not valid</exception>
|
||||
public void AddEntityIOEvent(string inputName, CEntityInstance? activator = null, CEntityInstance? caller = null, string value = "", float delay = 0, int outputId = 0)
|
||||
{
|
||||
Guard.IsValidEntity(this);
|
||||
|
||||
NativeAPI.AddEntityIoEvent(Handle, inputName, activator?.Handle ?? IntPtr.Zero, caller?.Handle ?? IntPtr.Zero, value, delay, outputId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,4 +113,4 @@ public partial class CEntityIdentity
|
||||
{
|
||||
public unsafe CEntityInstance EntityInstance => new(Unsafe.Read<IntPtr>((void*)Handle));
|
||||
public unsafe CHandle<CEntityInstance> EntityHandle => new(this.Handle + 0x10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* This file is part of CounterStrikeSharp.
|
||||
* CounterStrikeSharp is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* CounterStrikeSharp is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CounterStrikeSharp. If not, see <https://www.gnu.org/licenses/>. *
|
||||
*/
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core
|
||||
{
|
||||
// credits: qstage
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct CFixedBitVecBase
|
||||
{
|
||||
private const int LOG2_BITS_PER_INT = 5;
|
||||
private const int BITS_PER_INT = 32;
|
||||
|
||||
private readonly uint* m_Ints;
|
||||
|
||||
public void Add(CEntityInstance entityInstance) => Write(entityInstance.Index);
|
||||
|
||||
public void Add(int bitNum) => Write(bitNum);
|
||||
|
||||
public void Add(uint bitNum) => Write(bitNum);
|
||||
|
||||
public void Remove(CEntityInstance entityInstance) => Clear(entityInstance.Index);
|
||||
|
||||
public void Remove(int bitNum) => Clear(bitNum);
|
||||
|
||||
public void Remove(uint bitNum) => Clear(bitNum);
|
||||
|
||||
public bool Contains(CEntityInstance entityInstance) => Contains(entityInstance.Index);
|
||||
|
||||
public bool Contains(uint bitNum) => Contains((int)bitNum);
|
||||
|
||||
private void Clear(uint bitNum) => Clear((int)bitNum);
|
||||
|
||||
private void Write(uint bitNum) => Write((int)bitNum);
|
||||
|
||||
private void Clear(int bitNum)
|
||||
{
|
||||
if (!(bitNum >= 0 && bitNum < Utilities.MaxEdicts))
|
||||
return;
|
||||
|
||||
uint* pInt = m_Ints + BitVec_Int(bitNum);
|
||||
*pInt &= ~(uint)BitVec_Bit(bitNum);
|
||||
}
|
||||
|
||||
private void Write(int bitNum)
|
||||
{
|
||||
if (!(bitNum >= 0 && bitNum < Utilities.MaxEdicts))
|
||||
return;
|
||||
|
||||
uint* pInt = m_Ints + BitVec_Int(bitNum);
|
||||
*pInt |= (uint)BitVec_Bit(bitNum);
|
||||
}
|
||||
|
||||
public bool Contains(int bitNum)
|
||||
{
|
||||
if (!(bitNum >= 0 && bitNum < Utilities.MaxEdicts))
|
||||
return false;
|
||||
|
||||
uint* pInt = m_Ints + BitVec_Int(bitNum);
|
||||
return (*pInt & (uint)BitVec_Bit(bitNum)) != 0;
|
||||
}
|
||||
|
||||
private int BitVec_Int(int bitNum) => bitNum >> LOG2_BITS_PER_INT;
|
||||
|
||||
private int BitVec_Bit(int bitNum) => 1 << (bitNum & (BITS_PER_INT - 1));
|
||||
}
|
||||
}
|
||||
32
managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs
Normal file
32
managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CTakeDamageInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the hitgroup
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// Returns a <see cref="HitGroup_t"/> enumeration representing the player's current hit group,
|
||||
/// or <see cref="HitGroup_t.HITGROUP_INVALID"/> if the hit group cannot be determined.
|
||||
/// </returns>
|
||||
public HitGroup_t GetHitGroup()
|
||||
{
|
||||
IntPtr v4 = Marshal.ReadIntPtr(Handle, 0x78);
|
||||
|
||||
if (v4 == nint.Zero)
|
||||
{
|
||||
return HitGroup_t.HITGROUP_INVALID;
|
||||
}
|
||||
|
||||
IntPtr v1 = Marshal.ReadIntPtr(v4, 16);
|
||||
|
||||
if (v1 == nint.Zero)
|
||||
{
|
||||
return HitGroup_t.HITGROUP_GENERIC;
|
||||
}
|
||||
|
||||
return (HitGroup_t)Marshal.ReadInt32(v1, 56);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ public partial class NetworkedVector<T> : NativeObject, IReadOnlyCollection<T>
|
||||
}
|
||||
|
||||
public unsafe uint Size => Unsafe.Read<uint>((void*)Handle);
|
||||
|
||||
|
||||
public unsafe int Count => NativeAPI.GetNetworkVectorSize(Handle);
|
||||
|
||||
public T this[int index]
|
||||
@@ -28,7 +28,7 @@ public partial class NetworkedVector<T> : NativeObject, IReadOnlyCollection<T>
|
||||
{
|
||||
throw new NotSupportedException("Networked vectors currently only support CHandle<T>");
|
||||
}
|
||||
|
||||
|
||||
return (T)Activator.CreateInstance(typeof(T), NativeAPI.GetNetworkVectorElementAt(Handle, index));
|
||||
}
|
||||
}
|
||||
@@ -50,4 +50,4 @@ public partial class NetworkedVector<T> : NativeObject, IReadOnlyCollection<T>
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class PluginManager : IPluginManager
|
||||
config => { config.PreferSharedTypes = true; });
|
||||
var assembly = loader.LoadDefaultAssembly();
|
||||
|
||||
_sharedAssemblies[assembly.GetName().FullName] = assembly;
|
||||
_sharedAssemblies[assembly.GetName().Name] = assembly;
|
||||
}
|
||||
|
||||
private void LoadSharedLibraries()
|
||||
@@ -76,7 +76,7 @@ public class PluginManager : IPluginManager
|
||||
_loadedSharedLibs = true;
|
||||
}
|
||||
|
||||
if (!_sharedAssemblies.TryGetValue(name.FullName, out var assembly))
|
||||
if (!_sharedAssemblies.TryGetValue(name.Name, out var assembly))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -124,4 +124,4 @@ public class PluginManager : IPluginManager
|
||||
_loadedPluginContexts.Add(plugin);
|
||||
plugin.Load();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class AutoRoomDoorwayPairs_t : NativeObject
|
||||
{
|
||||
public AutoRoomDoorwayPairs_t (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
// vP1
|
||||
[SchemaMember("AutoRoomDoorwayPairs_t", "vP1")]
|
||||
public Vector VP1 => Schema.GetDeclaredClass<Vector>(this.Handle, "AutoRoomDoorwayPairs_t", "vP1");
|
||||
|
||||
// vP2
|
||||
[SchemaMember("AutoRoomDoorwayPairs_t", "vP2")]
|
||||
public Vector VP2 => Schema.GetDeclaredClass<Vector>(this.Handle, "AutoRoomDoorwayPairs_t", "vP2");
|
||||
|
||||
}
|
||||
@@ -20,11 +20,11 @@ public partial class CAISound : CPointEntity
|
||||
|
||||
// m_iSoundType
|
||||
[SchemaMember("CAISound", "m_iSoundType")]
|
||||
public ref Int32 SoundType => ref Schema.GetRef<Int32>(this.Handle, "CAISound", "m_iSoundType");
|
||||
public ref SoundTypes_t SoundType => ref Schema.GetRef<SoundTypes_t>(this.Handle, "CAISound", "m_iSoundType");
|
||||
|
||||
// m_iSoundContext
|
||||
[SchemaMember("CAISound", "m_iSoundContext")]
|
||||
public ref Int32 SoundContext => ref Schema.GetRef<Int32>(this.Handle, "CAISound", "m_iSoundContext");
|
||||
// m_iSoundFlags
|
||||
[SchemaMember("CAISound", "m_iSoundFlags")]
|
||||
public ref SoundFlags_t SoundFlags => ref Schema.GetRef<SoundFlags_t>(this.Handle, "CAISound", "m_iSoundFlags");
|
||||
|
||||
// m_iVolume
|
||||
[SchemaMember("CAISound", "m_iVolume")]
|
||||
|
||||
@@ -46,6 +46,10 @@ public partial class CAI_Expresser : NativeObject
|
||||
[SchemaMember("CAI_Expresser", "m_bConsiderSceneInvolvementAsSpeech")]
|
||||
public ref bool ConsiderSceneInvolvementAsSpeech => ref Schema.GetRef<bool>(this.Handle, "CAI_Expresser", "m_bConsiderSceneInvolvementAsSpeech");
|
||||
|
||||
// m_bSceneEntityDisabled
|
||||
[SchemaMember("CAI_Expresser", "m_bSceneEntityDisabled")]
|
||||
public ref bool SceneEntityDisabled => ref Schema.GetRef<bool>(this.Handle, "CAI_Expresser", "m_bSceneEntityDisabled");
|
||||
|
||||
// m_nLastSpokenPriority
|
||||
[SchemaMember("CAI_Expresser", "m_nLastSpokenPriority")]
|
||||
public ref Int32 LastSpokenPriority => ref Schema.GetRef<Int32>(this.Handle, "CAI_Expresser", "m_nLastSpokenPriority");
|
||||
|
||||
@@ -190,6 +190,10 @@ public partial class CBarnLight : CBaseModelEntity
|
||||
[SchemaMember("CBarnLight", "m_flFogScale")]
|
||||
public ref float FogScale => ref Schema.GetRef<float>(this.Handle, "CBarnLight", "m_flFogScale");
|
||||
|
||||
// m_bFogMixedShadows
|
||||
[SchemaMember("CBarnLight", "m_bFogMixedShadows")]
|
||||
public ref bool FogMixedShadows => ref Schema.GetRef<bool>(this.Handle, "CBarnLight", "m_bFogMixedShadows");
|
||||
|
||||
// m_flFadeSizeStart
|
||||
[SchemaMember("CBarnLight", "m_flFadeSizeStart")]
|
||||
public ref float FadeSizeStart => ref Schema.GetRef<float>(this.Handle, "CBarnLight", "m_flFadeSizeStart");
|
||||
@@ -230,8 +234,88 @@ public partial class CBarnLight : CBaseModelEntity
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBExtent")]
|
||||
public Vector PrecomputedOBBExtent => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBExtent");
|
||||
|
||||
// m_nPrecomputedSubFrusta
|
||||
[SchemaMember("CBarnLight", "m_nPrecomputedSubFrusta")]
|
||||
public ref Int32 PrecomputedSubFrusta => ref Schema.GetRef<Int32>(this.Handle, "CBarnLight", "m_nPrecomputedSubFrusta");
|
||||
|
||||
// m_vPrecomputedOBBOrigin0
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBOrigin0")]
|
||||
public Vector PrecomputedOBBOrigin0 => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBOrigin0");
|
||||
|
||||
// m_vPrecomputedOBBAngles0
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBAngles0")]
|
||||
public QAngle PrecomputedOBBAngles0 => Schema.GetDeclaredClass<QAngle>(this.Handle, "CBarnLight", "m_vPrecomputedOBBAngles0");
|
||||
|
||||
// m_vPrecomputedOBBExtent0
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBExtent0")]
|
||||
public Vector PrecomputedOBBExtent0 => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBExtent0");
|
||||
|
||||
// m_vPrecomputedOBBOrigin1
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBOrigin1")]
|
||||
public Vector PrecomputedOBBOrigin1 => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBOrigin1");
|
||||
|
||||
// m_vPrecomputedOBBAngles1
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBAngles1")]
|
||||
public QAngle PrecomputedOBBAngles1 => Schema.GetDeclaredClass<QAngle>(this.Handle, "CBarnLight", "m_vPrecomputedOBBAngles1");
|
||||
|
||||
// m_vPrecomputedOBBExtent1
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBExtent1")]
|
||||
public Vector PrecomputedOBBExtent1 => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBExtent1");
|
||||
|
||||
// m_vPrecomputedOBBOrigin2
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBOrigin2")]
|
||||
public Vector PrecomputedOBBOrigin2 => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBOrigin2");
|
||||
|
||||
// m_vPrecomputedOBBAngles2
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBAngles2")]
|
||||
public QAngle PrecomputedOBBAngles2 => Schema.GetDeclaredClass<QAngle>(this.Handle, "CBarnLight", "m_vPrecomputedOBBAngles2");
|
||||
|
||||
// m_vPrecomputedOBBExtent2
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBExtent2")]
|
||||
public Vector PrecomputedOBBExtent2 => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBExtent2");
|
||||
|
||||
// m_vPrecomputedOBBOrigin3
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBOrigin3")]
|
||||
public Vector PrecomputedOBBOrigin3 => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBOrigin3");
|
||||
|
||||
// m_vPrecomputedOBBAngles3
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBAngles3")]
|
||||
public QAngle PrecomputedOBBAngles3 => Schema.GetDeclaredClass<QAngle>(this.Handle, "CBarnLight", "m_vPrecomputedOBBAngles3");
|
||||
|
||||
// m_vPrecomputedOBBExtent3
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBExtent3")]
|
||||
public Vector PrecomputedOBBExtent3 => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBExtent3");
|
||||
|
||||
// m_vPrecomputedOBBOrigin4
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBOrigin4")]
|
||||
public Vector PrecomputedOBBOrigin4 => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBOrigin4");
|
||||
|
||||
// m_vPrecomputedOBBAngles4
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBAngles4")]
|
||||
public QAngle PrecomputedOBBAngles4 => Schema.GetDeclaredClass<QAngle>(this.Handle, "CBarnLight", "m_vPrecomputedOBBAngles4");
|
||||
|
||||
// m_vPrecomputedOBBExtent4
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBExtent4")]
|
||||
public Vector PrecomputedOBBExtent4 => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBExtent4");
|
||||
|
||||
// m_vPrecomputedOBBOrigin5
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBOrigin5")]
|
||||
public Vector PrecomputedOBBOrigin5 => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBOrigin5");
|
||||
|
||||
// m_vPrecomputedOBBAngles5
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBAngles5")]
|
||||
public QAngle PrecomputedOBBAngles5 => Schema.GetDeclaredClass<QAngle>(this.Handle, "CBarnLight", "m_vPrecomputedOBBAngles5");
|
||||
|
||||
// m_vPrecomputedOBBExtent5
|
||||
[SchemaMember("CBarnLight", "m_vPrecomputedOBBExtent5")]
|
||||
public Vector PrecomputedOBBExtent5 => Schema.GetDeclaredClass<Vector>(this.Handle, "CBarnLight", "m_vPrecomputedOBBExtent5");
|
||||
|
||||
// m_bPvsModifyEntity
|
||||
[SchemaMember("CBarnLight", "m_bPvsModifyEntity")]
|
||||
public ref bool PvsModifyEntity => ref Schema.GetRef<bool>(this.Handle, "CBarnLight", "m_bPvsModifyEntity");
|
||||
|
||||
// m_VisClusters
|
||||
[SchemaMember("CBarnLight", "m_VisClusters")]
|
||||
public NetworkedVector<UInt16> VisClusters => Schema.GetDeclaredClass<NetworkedVector<UInt16>>(this.Handle, "CBarnLight", "m_VisClusters");
|
||||
|
||||
}
|
||||
|
||||
@@ -50,12 +50,16 @@ public partial class CBaseAnimGraph : CBaseModelEntity
|
||||
[SchemaMember("CBaseAnimGraph", "m_nForceBone")]
|
||||
public ref Int32 ForceBone => ref Schema.GetRef<Int32>(this.Handle, "CBaseAnimGraph", "m_nForceBone");
|
||||
|
||||
// m_pRagdollPose
|
||||
[SchemaMember("CBaseAnimGraph", "m_pRagdollPose")]
|
||||
public PhysicsRagdollPose_t? RagdollPose => Schema.GetPointer<PhysicsRagdollPose_t>(this.Handle, "CBaseAnimGraph", "m_pRagdollPose");
|
||||
// m_RagdollPose
|
||||
[SchemaMember("CBaseAnimGraph", "m_RagdollPose")]
|
||||
public PhysicsRagdollPose_t RagdollPose => Schema.GetDeclaredClass<PhysicsRagdollPose_t>(this.Handle, "CBaseAnimGraph", "m_RagdollPose");
|
||||
|
||||
// m_bClientRagdoll
|
||||
[SchemaMember("CBaseAnimGraph", "m_bClientRagdoll")]
|
||||
public ref bool ClientRagdoll => ref Schema.GetRef<bool>(this.Handle, "CBaseAnimGraph", "m_bClientRagdoll");
|
||||
// m_bRagdollClientSide
|
||||
[SchemaMember("CBaseAnimGraph", "m_bRagdollClientSide")]
|
||||
public ref bool RagdollClientSide => ref Schema.GetRef<bool>(this.Handle, "CBaseAnimGraph", "m_bRagdollClientSide");
|
||||
|
||||
// m_nLastDestructiblePartDestroyedAnimgraphSetTick
|
||||
[SchemaMember("CBaseAnimGraph", "m_nLastDestructiblePartDestroyedAnimgraphSetTick")]
|
||||
public ref Int32 LastDestructiblePartDestroyedAnimgraphSetTick => ref Schema.GetRef<Int32>(this.Handle, "CBaseAnimGraph", "m_nLastDestructiblePartDestroyedAnimgraphSetTick");
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,10 @@ public partial class CBaseAnimGraphController : CSkeletonAnimationController
|
||||
[SchemaMember("CBaseAnimGraphController", "m_flSoundSyncTime")]
|
||||
public ref float SoundSyncTime => ref Schema.GetRef<float>(this.Handle, "CBaseAnimGraphController", "m_flSoundSyncTime");
|
||||
|
||||
// m_nActiveIKChainMask
|
||||
[SchemaMember("CBaseAnimGraphController", "m_nActiveIKChainMask")]
|
||||
public ref UInt32 ActiveIKChainMask => ref Schema.GetRef<UInt32>(this.Handle, "CBaseAnimGraphController", "m_nActiveIKChainMask");
|
||||
|
||||
// m_hSequence
|
||||
[SchemaMember("CBaseAnimGraphController", "m_hSequence")]
|
||||
public ref Int32 Sequence => ref Schema.GetRef<Int32>(this.Handle, "CBaseAnimGraphController", "m_hSequence");
|
||||
@@ -48,7 +52,7 @@ public partial class CBaseAnimGraphController : CSkeletonAnimationController
|
||||
|
||||
// m_flPlaybackRate
|
||||
[SchemaMember("CBaseAnimGraphController", "m_flPlaybackRate")]
|
||||
public float PlaybackRate => Schema.GetDeclaredClass<float>(this.Handle, "CBaseAnimGraphController", "m_flPlaybackRate");
|
||||
public ref float PlaybackRate => ref Schema.GetRef<float>(this.Handle, "CBaseAnimGraphController", "m_flPlaybackRate");
|
||||
|
||||
// m_nNotifyState
|
||||
[SchemaMember("CBaseAnimGraphController", "m_nNotifyState")]
|
||||
|
||||
@@ -58,6 +58,14 @@ public partial class CBaseButton : CBaseToggle
|
||||
set { Schema.SetString(this.Handle, "CBaseButton", "m_sUnlockedSound", value); }
|
||||
}
|
||||
|
||||
// m_sOverrideAnticipationName
|
||||
[SchemaMember("CBaseButton", "m_sOverrideAnticipationName")]
|
||||
public string OverrideAnticipationName
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CBaseButton", "m_sOverrideAnticipationName"); }
|
||||
set { Schema.SetString(this.Handle, "CBaseButton", "m_sOverrideAnticipationName", value); }
|
||||
}
|
||||
|
||||
// m_bLocked
|
||||
[SchemaMember("CBaseButton", "m_bLocked")]
|
||||
public ref bool Locked => ref Schema.GetRef<bool>(this.Handle, "CBaseButton", "m_bLocked");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -54,10 +54,6 @@ public partial class CBaseCSGrenadeProjectile : CBaseGrenade
|
||||
[SchemaMember("CBaseCSGrenadeProjectile", "m_bDetonationRecorded")]
|
||||
public ref bool DetonationRecorded => ref Schema.GetRef<bool>(this.Handle, "CBaseCSGrenadeProjectile", "m_bDetonationRecorded");
|
||||
|
||||
// m_flDetonateTime
|
||||
[SchemaMember("CBaseCSGrenadeProjectile", "m_flDetonateTime")]
|
||||
public ref float DetonateTime => ref Schema.GetRef<float>(this.Handle, "CBaseCSGrenadeProjectile", "m_flDetonateTime");
|
||||
|
||||
// m_nItemIndex
|
||||
[SchemaMember("CBaseCSGrenadeProjectile", "m_nItemIndex")]
|
||||
public ref UInt16 ItemIndex => ref Schema.GetRef<UInt16>(this.Handle, "CBaseCSGrenadeProjectile", "m_nItemIndex");
|
||||
@@ -82,12 +78,8 @@ public partial class CBaseCSGrenadeProjectile : CBaseGrenade
|
||||
[SchemaMember("CBaseCSGrenadeProjectile", "m_nTicksAtZeroVelocity")]
|
||||
public ref Int32 TicksAtZeroVelocity => ref Schema.GetRef<Int32>(this.Handle, "CBaseCSGrenadeProjectile", "m_nTicksAtZeroVelocity");
|
||||
|
||||
// m_bHasEverHitPlayer
|
||||
[SchemaMember("CBaseCSGrenadeProjectile", "m_bHasEverHitPlayer")]
|
||||
public ref bool HasEverHitPlayer => ref Schema.GetRef<bool>(this.Handle, "CBaseCSGrenadeProjectile", "m_bHasEverHitPlayer");
|
||||
|
||||
// m_bClearFromPlayers
|
||||
[SchemaMember("CBaseCSGrenadeProjectile", "m_bClearFromPlayers")]
|
||||
public ref bool ClearFromPlayers => ref Schema.GetRef<bool>(this.Handle, "CBaseCSGrenadeProjectile", "m_bClearFromPlayers");
|
||||
// m_bHasEverHitEnemy
|
||||
[SchemaMember("CBaseCSGrenadeProjectile", "m_bHasEverHitEnemy")]
|
||||
public ref bool HasEverHitEnemy => ref Schema.GetRef<bool>(this.Handle, "CBaseCSGrenadeProjectile", "m_bHasEverHitEnemy");
|
||||
|
||||
}
|
||||
|
||||
@@ -26,26 +26,14 @@ public partial class CBaseCombatCharacter : CBaseFlex
|
||||
[SchemaMember("CBaseCombatCharacter", "m_hMyWearables")]
|
||||
public NetworkedVector<CHandle<CEconWearable>> MyWearables => Schema.GetDeclaredClass<NetworkedVector<CHandle<CEconWearable>>>(this.Handle, "CBaseCombatCharacter", "m_hMyWearables");
|
||||
|
||||
// m_flFieldOfView
|
||||
[SchemaMember("CBaseCombatCharacter", "m_flFieldOfView")]
|
||||
public ref float FieldOfView => ref Schema.GetRef<float>(this.Handle, "CBaseCombatCharacter", "m_flFieldOfView");
|
||||
|
||||
// m_impactEnergyScale
|
||||
[SchemaMember("CBaseCombatCharacter", "m_impactEnergyScale")]
|
||||
public ref float ImpactEnergyScale => ref Schema.GetRef<float>(this.Handle, "CBaseCombatCharacter", "m_impactEnergyScale");
|
||||
|
||||
// m_LastHitGroup
|
||||
[SchemaMember("CBaseCombatCharacter", "m_LastHitGroup")]
|
||||
public ref HitGroup_t LastHitGroup => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseCombatCharacter", "m_LastHitGroup");
|
||||
|
||||
// m_bApplyStressDamage
|
||||
[SchemaMember("CBaseCombatCharacter", "m_bApplyStressDamage")]
|
||||
public ref bool ApplyStressDamage => ref Schema.GetRef<bool>(this.Handle, "CBaseCombatCharacter", "m_bApplyStressDamage");
|
||||
|
||||
// m_bloodColor
|
||||
[SchemaMember("CBaseCombatCharacter", "m_bloodColor")]
|
||||
public ref Int32 BloodColor => ref Schema.GetRef<Int32>(this.Handle, "CBaseCombatCharacter", "m_bloodColor");
|
||||
|
||||
// m_iDamageCount
|
||||
[SchemaMember("CBaseCombatCharacter", "m_iDamageCount")]
|
||||
public ref Int32 DamageCount => ref Schema.GetRef<Int32>(this.Handle, "CBaseCombatCharacter", "m_iDamageCount");
|
||||
|
||||
@@ -38,9 +38,9 @@ public partial class CBaseEntity : CEntityInstance
|
||||
[SchemaMember("CBaseEntity", "m_nLastThinkTick")]
|
||||
public ref Int32 LastThinkTick => ref Schema.GetRef<Int32>(this.Handle, "CBaseEntity", "m_nLastThinkTick");
|
||||
|
||||
// m_nDisableContextThinkStartTick
|
||||
[SchemaMember("CBaseEntity", "m_nDisableContextThinkStartTick")]
|
||||
public ref Int32 DisableContextThinkStartTick => ref Schema.GetRef<Int32>(this.Handle, "CBaseEntity", "m_nDisableContextThinkStartTick");
|
||||
// m_bDisabledContextThinks
|
||||
[SchemaMember("CBaseEntity", "m_bDisabledContextThinks")]
|
||||
public ref bool DisabledContextThinks => ref Schema.GetRef<bool>(this.Handle, "CBaseEntity", "m_bDisabledContextThinks");
|
||||
|
||||
// m_isSteadyState
|
||||
[SchemaMember("CBaseEntity", "m_isSteadyState")]
|
||||
@@ -86,9 +86,9 @@ public partial class CBaseEntity : CEntityInstance
|
||||
[SchemaMember("CBaseEntity", "m_nTakeDamageFlags")]
|
||||
public ref TakeDamageFlags_t TakeDamageFlags => ref Schema.GetRef<TakeDamageFlags_t>(this.Handle, "CBaseEntity", "m_nTakeDamageFlags");
|
||||
|
||||
// m_bIsPlatform
|
||||
[SchemaMember("CBaseEntity", "m_bIsPlatform")]
|
||||
public ref bool IsPlatform => ref Schema.GetRef<bool>(this.Handle, "CBaseEntity", "m_bIsPlatform");
|
||||
// m_nPlatformType
|
||||
[SchemaMember("CBaseEntity", "m_nPlatformType")]
|
||||
public ref EntityPlatformTypes_t PlatformType => ref Schema.GetRef<EntityPlatformTypes_t>(this.Handle, "CBaseEntity", "m_nPlatformType");
|
||||
|
||||
// m_MoveCollide
|
||||
[SchemaMember("CBaseEntity", "m_MoveCollide")]
|
||||
@@ -250,6 +250,10 @@ public partial class CBaseEntity : CEntityInstance
|
||||
[SchemaMember("CBaseEntity", "m_hGroundEntity")]
|
||||
public CHandle<CBaseEntity> GroundEntity => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CBaseEntity", "m_hGroundEntity");
|
||||
|
||||
// m_nGroundBodyIndex
|
||||
[SchemaMember("CBaseEntity", "m_nGroundBodyIndex")]
|
||||
public ref Int32 GroundBodyIndex => ref Schema.GetRef<Int32>(this.Handle, "CBaseEntity", "m_nGroundBodyIndex");
|
||||
|
||||
// m_flFriction
|
||||
[SchemaMember("CBaseEntity", "m_flFriction")]
|
||||
public ref float Friction => ref Schema.GetRef<float>(this.Handle, "CBaseEntity", "m_flFriction");
|
||||
@@ -338,4 +342,8 @@ public partial class CBaseEntity : CEntityInstance
|
||||
[SchemaMember("CBaseEntity", "m_flVPhysicsUpdateLocalTime")]
|
||||
public ref float VPhysicsUpdateLocalTime => ref Schema.GetRef<float>(this.Handle, "CBaseEntity", "m_flVPhysicsUpdateLocalTime");
|
||||
|
||||
// m_nBloodType
|
||||
[SchemaMember("CBaseEntity", "m_nBloodType")]
|
||||
public ref BloodType BloodType => ref Schema.GetRef<BloodType>(this.Handle, "CBaseEntity", "m_nBloodType");
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public partial class CBaseFlex : CBaseAnimGraph
|
||||
|
||||
// m_nNextSceneEventId
|
||||
[SchemaMember("CBaseFlex", "m_nNextSceneEventId")]
|
||||
public ref UInt32 NextSceneEventId => ref Schema.GetRef<UInt32>(this.Handle, "CBaseFlex", "m_nNextSceneEventId");
|
||||
public SceneEventId_t NextSceneEventId => Schema.GetDeclaredClass<SceneEventId_t>(this.Handle, "CBaseFlex", "m_nNextSceneEventId");
|
||||
|
||||
// m_bUpdateLayerPriorities
|
||||
[SchemaMember("CBaseFlex", "m_bUpdateLayerPriorities")]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -26,6 +26,34 @@ public partial class CBaseModelEntity : CBaseEntity
|
||||
[SchemaMember("CBaseModelEntity", "m_CHitboxComponent")]
|
||||
public CHitboxComponent CHitboxComponent => Schema.GetDeclaredClass<CHitboxComponent>(this.Handle, "CBaseModelEntity", "m_CHitboxComponent");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed0
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed0")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed0 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed0");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed1
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed1")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed1 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed1");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed2
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed2")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed2 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed2");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed3
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed3")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed3 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed3");
|
||||
|
||||
// m_nDestructiblePartInitialStateDestructed4
|
||||
[SchemaMember("CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed4")]
|
||||
public ref HitGroup_t DestructiblePartInitialStateDestructed4 => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_nDestructiblePartInitialStateDestructed4");
|
||||
|
||||
// m_nLastHitDestructiblePartIndex
|
||||
[SchemaMember("CBaseModelEntity", "m_nLastHitDestructiblePartIndex")]
|
||||
public ref Int32 LastHitDestructiblePartIndex => ref Schema.GetRef<Int32>(this.Handle, "CBaseModelEntity", "m_nLastHitDestructiblePartIndex");
|
||||
|
||||
// m_LastHitGroup
|
||||
[SchemaMember("CBaseModelEntity", "m_LastHitGroup")]
|
||||
public ref HitGroup_t LastHitGroup => ref Schema.GetRef<HitGroup_t>(this.Handle, "CBaseModelEntity", "m_LastHitGroup");
|
||||
|
||||
// m_flDissolveStartTime
|
||||
[SchemaMember("CBaseModelEntity", "m_flDissolveStartTime")]
|
||||
public ref float DissolveStartTime => ref Schema.GetRef<float>(this.Handle, "CBaseModelEntity", "m_flDissolveStartTime");
|
||||
@@ -62,9 +90,13 @@ public partial class CBaseModelEntity : CBaseEntity
|
||||
[SchemaMember("CBaseModelEntity", "m_bRenderToCubemaps")]
|
||||
public ref bool RenderToCubemaps => ref Schema.GetRef<bool>(this.Handle, "CBaseModelEntity", "m_bRenderToCubemaps");
|
||||
|
||||
// m_bNoInterpolate
|
||||
[SchemaMember("CBaseModelEntity", "m_bNoInterpolate")]
|
||||
public ref bool NoInterpolate => ref Schema.GetRef<bool>(this.Handle, "CBaseModelEntity", "m_bNoInterpolate");
|
||||
|
||||
// m_Collision
|
||||
[SchemaMember("CBaseModelEntity", "m_Collision")]
|
||||
public CCollisionProperty Collision => Schema.GetDeclaredClass<CCollisionProperty>(this.Handle, "CBaseModelEntity", "m_Collision");
|
||||
public new CCollisionProperty Collision => Schema.GetDeclaredClass<CCollisionProperty>(this.Handle, "CBaseModelEntity", "m_Collision");
|
||||
|
||||
// m_Glow
|
||||
[SchemaMember("CBaseModelEntity", "m_Glow")]
|
||||
|
||||
@@ -30,6 +30,10 @@ public partial class CBasePlayerController : CBaseEntity
|
||||
[SchemaMember("CBasePlayerController", "m_hPawn")]
|
||||
public CHandle<CBasePlayerPawn> Pawn => Schema.GetDeclaredClass<CHandle<CBasePlayerPawn>>(this.Handle, "CBasePlayerController", "m_hPawn");
|
||||
|
||||
// m_bKnownTeamMismatch
|
||||
[SchemaMember("CBasePlayerController", "m_bKnownTeamMismatch")]
|
||||
public ref bool KnownTeamMismatch => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerController", "m_bKnownTeamMismatch");
|
||||
|
||||
// m_nSplitScreenSlot
|
||||
[SchemaMember("CBasePlayerController", "m_nSplitScreenSlot")]
|
||||
public ref Int32 SplitScreenSlot => ref Schema.GetRef<Int32>(this.Handle, "CBasePlayerController", "m_nSplitScreenSlot");
|
||||
@@ -78,10 +82,6 @@ public partial class CBasePlayerController : CBaseEntity
|
||||
[SchemaMember("CBasePlayerController", "m_bPredict")]
|
||||
public ref bool Predict => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerController", "m_bPredict");
|
||||
|
||||
// m_bAutoKickDisabled
|
||||
[SchemaMember("CBasePlayerController", "m_bAutoKickDisabled")]
|
||||
public ref bool AutoKickDisabled => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerController", "m_bAutoKickDisabled");
|
||||
|
||||
// m_bIsLowViolence
|
||||
[SchemaMember("CBasePlayerController", "m_bIsLowViolence")]
|
||||
public ref bool IsLowViolence => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerController", "m_bIsLowViolence");
|
||||
@@ -90,14 +90,6 @@ public partial class CBasePlayerController : CBaseEntity
|
||||
[SchemaMember("CBasePlayerController", "m_bGamePaused")]
|
||||
public ref bool GamePaused => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerController", "m_bGamePaused");
|
||||
|
||||
// m_nLastRealCommandNumberExecuted
|
||||
[SchemaMember("CBasePlayerController", "m_nLastRealCommandNumberExecuted")]
|
||||
public ref Int32 LastRealCommandNumberExecuted => ref Schema.GetRef<Int32>(this.Handle, "CBasePlayerController", "m_nLastRealCommandNumberExecuted");
|
||||
|
||||
// m_nLastLateCommandExecuted
|
||||
[SchemaMember("CBasePlayerController", "m_nLastLateCommandExecuted")]
|
||||
public ref Int32 LastLateCommandExecuted => ref Schema.GetRef<Int32>(this.Handle, "CBasePlayerController", "m_nLastLateCommandExecuted");
|
||||
|
||||
// m_iIgnoreGlobalChat
|
||||
[SchemaMember("CBasePlayerController", "m_iIgnoreGlobalChat")]
|
||||
public ref ChatIgnoreType_t IgnoreGlobalChat => ref Schema.GetRef<ChatIgnoreType_t>(this.Handle, "CBasePlayerController", "m_iIgnoreGlobalChat");
|
||||
|
||||
@@ -26,13 +26,9 @@ public partial class CBasePlayerWeaponVData : CEntitySubclassVDataBase
|
||||
[SchemaMember("CBasePlayerWeaponVData", "m_bAllowFlipping")]
|
||||
public ref bool AllowFlipping => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerWeaponVData", "m_bAllowFlipping");
|
||||
|
||||
// m_sMuzzleAttachment
|
||||
[SchemaMember("CBasePlayerWeaponVData", "m_sMuzzleAttachment")]
|
||||
public string MuzzleAttachment
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CBasePlayerWeaponVData", "m_sMuzzleAttachment"); }
|
||||
set { Schema.SetString(this.Handle, "CBasePlayerWeaponVData", "m_sMuzzleAttachment", value); }
|
||||
}
|
||||
// m_bLinkedCooldowns
|
||||
[SchemaMember("CBasePlayerWeaponVData", "m_bLinkedCooldowns")]
|
||||
public ref bool LinkedCooldowns => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerWeaponVData", "m_bLinkedCooldowns");
|
||||
|
||||
// m_iFlags
|
||||
[SchemaMember("CBasePlayerWeaponVData", "m_iFlags")]
|
||||
@@ -62,6 +58,10 @@ public partial class CBasePlayerWeaponVData : CEntitySubclassVDataBase
|
||||
[SchemaMember("CBasePlayerWeaponVData", "m_iDefaultClip2")]
|
||||
public ref Int32 DefaultClip2 => ref Schema.GetRef<Int32>(this.Handle, "CBasePlayerWeaponVData", "m_iDefaultClip2");
|
||||
|
||||
// m_bReserveAmmoAsClips
|
||||
[SchemaMember("CBasePlayerWeaponVData", "m_bReserveAmmoAsClips")]
|
||||
public ref bool ReserveAmmoAsClips => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerWeaponVData", "m_bReserveAmmoAsClips");
|
||||
|
||||
// m_iWeight
|
||||
[SchemaMember("CBasePlayerWeaponVData", "m_iWeight")]
|
||||
public ref Int32 Weight => ref Schema.GetRef<Int32>(this.Handle, "CBasePlayerWeaponVData", "m_iWeight");
|
||||
@@ -78,10 +78,6 @@ public partial class CBasePlayerWeaponVData : CEntitySubclassVDataBase
|
||||
[SchemaMember("CBasePlayerWeaponVData", "m_iRumbleEffect")]
|
||||
public ref RumbleEffect_t RumbleEffect => ref Schema.GetRef<RumbleEffect_t>(this.Handle, "CBasePlayerWeaponVData", "m_iRumbleEffect");
|
||||
|
||||
// m_bLinkedCooldowns
|
||||
[SchemaMember("CBasePlayerWeaponVData", "m_bLinkedCooldowns")]
|
||||
public ref bool LinkedCooldowns => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerWeaponVData", "m_bLinkedCooldowns");
|
||||
|
||||
// m_iSlot
|
||||
[SchemaMember("CBasePlayerWeaponVData", "m_iSlot")]
|
||||
public ref Int32 Slot => ref Schema.GetRef<Int32>(this.Handle, "CBasePlayerWeaponVData", "m_iSlot");
|
||||
|
||||
@@ -52,7 +52,7 @@ public partial class CBasePropDoor : CDynamicProp
|
||||
|
||||
// m_hBlocker
|
||||
[SchemaMember("CBasePropDoor", "m_hBlocker")]
|
||||
public CHandle<CBaseEntity> Blocker => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CBasePropDoor", "m_hBlocker");
|
||||
public new CHandle<CBaseEntity> Blocker => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CBasePropDoor", "m_hBlocker");
|
||||
|
||||
// m_bFirstBlocked
|
||||
[SchemaMember("CBasePropDoor", "m_bFirstBlocked")]
|
||||
|
||||
@@ -54,6 +54,10 @@ public partial class CBaseTrigger : CBaseToggle
|
||||
[SchemaMember("CBaseTrigger", "m_OnTouching")]
|
||||
public CEntityIOOutput OnTouching => Schema.GetDeclaredClass<CEntityIOOutput>(this.Handle, "CBaseTrigger", "m_OnTouching");
|
||||
|
||||
// m_OnTouchingEachEntity
|
||||
[SchemaMember("CBaseTrigger", "m_OnTouchingEachEntity")]
|
||||
public CEntityIOOutput OnTouchingEachEntity => Schema.GetDeclaredClass<CEntityIOOutput>(this.Handle, "CBaseTrigger", "m_OnTouchingEachEntity");
|
||||
|
||||
// m_OnNotTouching
|
||||
[SchemaMember("CBaseTrigger", "m_OnNotTouching")]
|
||||
public CEntityIOOutput OnNotTouching => Schema.GetDeclaredClass<CEntityIOOutput>(this.Handle, "CBaseTrigger", "m_OnNotTouching");
|
||||
|
||||
@@ -88,7 +88,7 @@ public partial class CBeam : CBaseModelEntity
|
||||
|
||||
// m_fSpeed
|
||||
[SchemaMember("CBeam", "m_fSpeed")]
|
||||
public ref float Speed => ref Schema.GetRef<float>(this.Handle, "CBeam", "m_fSpeed");
|
||||
public new ref float Speed => ref Schema.GetRef<float>(this.Handle, "CBeam", "m_fSpeed");
|
||||
|
||||
// m_flFrame
|
||||
[SchemaMember("CBeam", "m_flFrame")]
|
||||
|
||||
@@ -32,6 +32,6 @@ public partial class CBlood : CPointEntity
|
||||
|
||||
// m_Color
|
||||
[SchemaMember("CBlood", "m_Color")]
|
||||
public ref Int32 Color => ref Schema.GetRef<Int32>(this.Handle, "CBlood", "m_Color");
|
||||
public ref BloodType Color => ref Schema.GetRef<BloodType>(this.Handle, "CBlood", "m_Color");
|
||||
|
||||
}
|
||||
|
||||
@@ -22,8 +22,4 @@ public partial class CBodyComponentBaseAnimGraph : CBodyComponentSkeletonInstanc
|
||||
[SchemaMember("CBodyComponentBaseAnimGraph", "m_animationController")]
|
||||
public CBaseAnimGraphController AnimationController => Schema.GetDeclaredClass<CBaseAnimGraphController>(this.Handle, "CBodyComponentBaseAnimGraph", "m_animationController");
|
||||
|
||||
// __m_pChainEntity
|
||||
[SchemaMember("CBodyComponentBaseAnimGraph", "__m_pChainEntity")]
|
||||
public CNetworkVarChainer __m_pChainEntity => Schema.GetDeclaredClass<CNetworkVarChainer>(this.Handle, "CBodyComponentBaseAnimGraph", "__m_pChainEntity");
|
||||
|
||||
}
|
||||
|
||||
@@ -18,8 +18,4 @@ public partial class CBodyComponentBaseModelEntity : CBodyComponentSkeletonInsta
|
||||
{
|
||||
public CBodyComponentBaseModelEntity (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
// __m_pChainEntity
|
||||
[SchemaMember("CBodyComponentBaseModelEntity", "__m_pChainEntity")]
|
||||
public CNetworkVarChainer __m_pChainEntity => Schema.GetDeclaredClass<CNetworkVarChainer>(this.Handle, "CBodyComponentBaseModelEntity", "__m_pChainEntity");
|
||||
|
||||
}
|
||||
|
||||
@@ -20,10 +20,6 @@ public partial class CBodyComponentPoint : CBodyComponent
|
||||
|
||||
// m_sceneNode
|
||||
[SchemaMember("CBodyComponentPoint", "m_sceneNode")]
|
||||
public CGameSceneNode SceneNode => Schema.GetDeclaredClass<CGameSceneNode>(this.Handle, "CBodyComponentPoint", "m_sceneNode");
|
||||
|
||||
// __m_pChainEntity
|
||||
[SchemaMember("CBodyComponentPoint", "__m_pChainEntity")]
|
||||
public CNetworkVarChainer __m_pChainEntity => Schema.GetDeclaredClass<CNetworkVarChainer>(this.Handle, "CBodyComponentPoint", "__m_pChainEntity");
|
||||
public new CGameSceneNode SceneNode => Schema.GetDeclaredClass<CGameSceneNode>(this.Handle, "CBodyComponentPoint", "m_sceneNode");
|
||||
|
||||
}
|
||||
|
||||
@@ -22,8 +22,4 @@ public partial class CBodyComponentSkeletonInstance : CBodyComponent
|
||||
[SchemaMember("CBodyComponentSkeletonInstance", "m_skeletonInstance")]
|
||||
public CSkeletonInstance SkeletonInstance => Schema.GetDeclaredClass<CSkeletonInstance>(this.Handle, "CBodyComponentSkeletonInstance", "m_skeletonInstance");
|
||||
|
||||
// __m_pChainEntity
|
||||
[SchemaMember("CBodyComponentSkeletonInstance", "__m_pChainEntity")]
|
||||
public CNetworkVarChainer __m_pChainEntity => Schema.GetDeclaredClass<CNetworkVarChainer>(this.Handle, "CBodyComponentSkeletonInstance", "__m_pChainEntity");
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ public partial class CBreakable : CBaseModelEntity
|
||||
{
|
||||
public CBreakable (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
// m_CPropDataComponent
|
||||
[SchemaMember("CBreakable", "m_CPropDataComponent")]
|
||||
public CPropDataComponent CPropDataComponent => Schema.GetDeclaredClass<CPropDataComponent>(this.Handle, "CBreakable", "m_CPropDataComponent");
|
||||
|
||||
// m_Material
|
||||
[SchemaMember("CBreakable", "m_Material")]
|
||||
public ref Materials Material => ref Schema.GetRef<Materials>(this.Handle, "CBreakable", "m_Material");
|
||||
@@ -66,42 +70,6 @@ public partial class CBreakable : CBaseModelEntity
|
||||
[SchemaMember("CBreakable", "m_OnBreak")]
|
||||
public CEntityIOOutput OnBreak => Schema.GetDeclaredClass<CEntityIOOutput>(this.Handle, "CBreakable", "m_OnBreak");
|
||||
|
||||
// m_flDmgModBullet
|
||||
[SchemaMember("CBreakable", "m_flDmgModBullet")]
|
||||
public ref float DmgModBullet => ref Schema.GetRef<float>(this.Handle, "CBreakable", "m_flDmgModBullet");
|
||||
|
||||
// m_flDmgModClub
|
||||
[SchemaMember("CBreakable", "m_flDmgModClub")]
|
||||
public ref float DmgModClub => ref Schema.GetRef<float>(this.Handle, "CBreakable", "m_flDmgModClub");
|
||||
|
||||
// m_flDmgModExplosive
|
||||
[SchemaMember("CBreakable", "m_flDmgModExplosive")]
|
||||
public ref float DmgModExplosive => ref Schema.GetRef<float>(this.Handle, "CBreakable", "m_flDmgModExplosive");
|
||||
|
||||
// m_flDmgModFire
|
||||
[SchemaMember("CBreakable", "m_flDmgModFire")]
|
||||
public ref float DmgModFire => ref Schema.GetRef<float>(this.Handle, "CBreakable", "m_flDmgModFire");
|
||||
|
||||
// m_iszPhysicsDamageTableName
|
||||
[SchemaMember("CBreakable", "m_iszPhysicsDamageTableName")]
|
||||
public string PhysicsDamageTableName
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CBreakable", "m_iszPhysicsDamageTableName"); }
|
||||
set { Schema.SetString(this.Handle, "CBreakable", "m_iszPhysicsDamageTableName", value); }
|
||||
}
|
||||
|
||||
// m_iszBasePropData
|
||||
[SchemaMember("CBreakable", "m_iszBasePropData")]
|
||||
public string BasePropData
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CBreakable", "m_iszBasePropData"); }
|
||||
set { Schema.SetString(this.Handle, "CBreakable", "m_iszBasePropData", value); }
|
||||
}
|
||||
|
||||
// m_iInteractions
|
||||
[SchemaMember("CBreakable", "m_iInteractions")]
|
||||
public ref Int32 Interactions => ref Schema.GetRef<Int32>(this.Handle, "CBreakable", "m_iInteractions");
|
||||
|
||||
// m_PerformanceMode
|
||||
[SchemaMember("CBreakable", "m_PerformanceMode")]
|
||||
public ref PerformanceMode_t PerformanceMode => ref Schema.GetRef<PerformanceMode_t>(this.Handle, "CBreakable", "m_PerformanceMode");
|
||||
|
||||
@@ -18,6 +18,10 @@ public partial class CBreakableProp : CBaseProp
|
||||
{
|
||||
public CBreakableProp (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
// m_CPropDataComponent
|
||||
[SchemaMember("CBreakableProp", "m_CPropDataComponent")]
|
||||
public CPropDataComponent CPropDataComponent => Schema.GetDeclaredClass<CPropDataComponent>(this.Handle, "CBreakableProp", "m_CPropDataComponent");
|
||||
|
||||
// m_OnBreak
|
||||
[SchemaMember("CBreakableProp", "m_OnBreak")]
|
||||
public CEntityIOOutput OnBreak => Schema.GetDeclaredClass<CEntityIOOutput>(this.Handle, "CBreakableProp", "m_OnBreak");
|
||||
@@ -42,6 +46,14 @@ public partial class CBreakableProp : CBaseProp
|
||||
[SchemaMember("CBreakableProp", "m_flPressureDelay")]
|
||||
public ref float PressureDelay => ref Schema.GetRef<float>(this.Handle, "CBreakableProp", "m_flPressureDelay");
|
||||
|
||||
// m_flDefBurstScale
|
||||
[SchemaMember("CBreakableProp", "m_flDefBurstScale")]
|
||||
public ref float DefBurstScale => ref Schema.GetRef<float>(this.Handle, "CBreakableProp", "m_flDefBurstScale");
|
||||
|
||||
// m_vDefBurstOffset
|
||||
[SchemaMember("CBreakableProp", "m_vDefBurstOffset")]
|
||||
public Vector DefBurstOffset => Schema.GetDeclaredClass<Vector>(this.Handle, "CBreakableProp", "m_vDefBurstOffset");
|
||||
|
||||
// m_hBreaker
|
||||
[SchemaMember("CBreakableProp", "m_hBreaker")]
|
||||
public CHandle<CBaseEntity> Breaker => Schema.GetDeclaredClass<CHandle<CBaseEntity>>(this.Handle, "CBreakableProp", "m_hBreaker");
|
||||
@@ -50,46 +62,30 @@ public partial class CBreakableProp : CBaseProp
|
||||
[SchemaMember("CBreakableProp", "m_PerformanceMode")]
|
||||
public ref PerformanceMode_t PerformanceMode => ref Schema.GetRef<PerformanceMode_t>(this.Handle, "CBreakableProp", "m_PerformanceMode");
|
||||
|
||||
// m_flDmgModBullet
|
||||
[SchemaMember("CBreakableProp", "m_flDmgModBullet")]
|
||||
public ref float DmgModBullet => ref Schema.GetRef<float>(this.Handle, "CBreakableProp", "m_flDmgModBullet");
|
||||
|
||||
// m_flDmgModClub
|
||||
[SchemaMember("CBreakableProp", "m_flDmgModClub")]
|
||||
public ref float DmgModClub => ref Schema.GetRef<float>(this.Handle, "CBreakableProp", "m_flDmgModClub");
|
||||
|
||||
// m_flDmgModExplosive
|
||||
[SchemaMember("CBreakableProp", "m_flDmgModExplosive")]
|
||||
public ref float DmgModExplosive => ref Schema.GetRef<float>(this.Handle, "CBreakableProp", "m_flDmgModExplosive");
|
||||
|
||||
// m_flDmgModFire
|
||||
[SchemaMember("CBreakableProp", "m_flDmgModFire")]
|
||||
public ref float DmgModFire => ref Schema.GetRef<float>(this.Handle, "CBreakableProp", "m_flDmgModFire");
|
||||
|
||||
// m_iszPhysicsDamageTableName
|
||||
[SchemaMember("CBreakableProp", "m_iszPhysicsDamageTableName")]
|
||||
public string PhysicsDamageTableName
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CBreakableProp", "m_iszPhysicsDamageTableName"); }
|
||||
set { Schema.SetString(this.Handle, "CBreakableProp", "m_iszPhysicsDamageTableName", value); }
|
||||
}
|
||||
|
||||
// m_iszBasePropData
|
||||
[SchemaMember("CBreakableProp", "m_iszBasePropData")]
|
||||
public string BasePropData
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CBreakableProp", "m_iszBasePropData"); }
|
||||
set { Schema.SetString(this.Handle, "CBreakableProp", "m_iszBasePropData", value); }
|
||||
}
|
||||
|
||||
// m_iInteractions
|
||||
[SchemaMember("CBreakableProp", "m_iInteractions")]
|
||||
public ref Int32 Interactions => ref Schema.GetRef<Int32>(this.Handle, "CBreakableProp", "m_iInteractions");
|
||||
|
||||
// m_flPreventDamageBeforeTime
|
||||
[SchemaMember("CBreakableProp", "m_flPreventDamageBeforeTime")]
|
||||
public ref float PreventDamageBeforeTime => ref Schema.GetRef<float>(this.Handle, "CBreakableProp", "m_flPreventDamageBeforeTime");
|
||||
|
||||
// m_BreakableContentsType
|
||||
[SchemaMember("CBreakableProp", "m_BreakableContentsType")]
|
||||
public ref BreakableContentsType_t BreakableContentsType => ref Schema.GetRef<BreakableContentsType_t>(this.Handle, "CBreakableProp", "m_BreakableContentsType");
|
||||
|
||||
// m_strBreakableContentsPropGroupOverride
|
||||
[SchemaMember("CBreakableProp", "m_strBreakableContentsPropGroupOverride")]
|
||||
public string StrBreakableContentsPropGroupOverride
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CBreakableProp", "m_strBreakableContentsPropGroupOverride"); }
|
||||
set { Schema.SetString(this.Handle, "CBreakableProp", "m_strBreakableContentsPropGroupOverride", value); }
|
||||
}
|
||||
|
||||
// m_strBreakableContentsParticleOverride
|
||||
[SchemaMember("CBreakableProp", "m_strBreakableContentsParticleOverride")]
|
||||
public string StrBreakableContentsParticleOverride
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CBreakableProp", "m_strBreakableContentsParticleOverride"); }
|
||||
set { Schema.SetString(this.Handle, "CBreakableProp", "m_strBreakableContentsParticleOverride", value); }
|
||||
}
|
||||
|
||||
// m_bHasBreakPiecesOrCommands
|
||||
[SchemaMember("CBreakableProp", "m_bHasBreakPiecesOrCommands")]
|
||||
public ref bool HasBreakPiecesOrCommands => ref Schema.GetRef<bool>(this.Handle, "CBreakableProp", "m_bHasBreakPiecesOrCommands");
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp;
|
||||
using CounterStrikeSharp.API.Modules.Events;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CBumpMineProjectile : CBaseGrenade
|
||||
{
|
||||
public CBumpMineProjectile (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user