Compare commits

...

4 Commits
v42 ... v45

Author SHA1 Message Date
Roflmuffin
9c8e9db56e ci: set fallback build number for PRs 2023-11-13 20:23:46 +10:00
Roflmuffin
e2e0eab87d ci: run main pipeline skipping publish on PR 2023-11-13 20:19:37 +10:00
Nexd
43292bb1d2 feat: CBaseModelEntity_SetModel (#72) 2023-11-13 09:10:49 +10:00
Nexd
12c54cd4fc hotfix: deserializer couldn't call setter (#70) 2023-11-12 22:39:15 +10:00
6 changed files with 55 additions and 60 deletions

View File

@@ -4,7 +4,9 @@ on:
push:
paths-ignore:
- 'docs/**'
branches: [ "main", "feature/cross-platform-builds" ]
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
BUILD_TYPE: Release
@@ -95,10 +97,18 @@ jobs:
shell: bash
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Set fallback build number
if: github.event_name == 'pull_request'
id: buildnumber
run: |
echo "build_number=0" >> "$GITHUB_OUTPUT"
echo "BUILD_NUMBER=0" >> $GITHUB_ENV
# We don't need expensive submodules for the managed side.
- uses: actions/checkout@v3
- name: Generate build number
if: github.event_name == 'push'
id: buildnumber
uses: onyxmueller/build-tag-number@v1
with:
@@ -119,6 +129,7 @@ jobs:
path: managed/CounterStrikeSharp.API/bin/Release
publish:
if: github.event_name == 'push'
permissions:
contents: write
needs: [ "build_linux", "build_windows", "build_managed" ]

View File

@@ -1,53 +0,0 @@
name: Build
on:
pull_request:
branches: [ "main" ]
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: ubuntu-latest
container:
image: registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest
permissions:
pull-requests: read
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
csharp:
- managed/**/*
- src/scripting/natives/**/*
cpp:
- src/**/*
- uses: actions/setup-dotnet@v3
if: steps.changes.outputs.csharp == 'true'
with:
dotnet-version: '7.0.x'
- if: steps.changes.outputs.csharp == 'true'
run: dotnet build -c Release managed/CounterStrikeSharp.API
- name: Setup protobuf
shell: bash
if: steps.changes.outputs.cpp == 'true'
run: sudo apt-get update && sudo apt install -y protobuf-compiler
- name: Configure CMake
if: steps.changes.outputs.cpp == 'true'
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
# Build your program with the given configuration
if: steps.changes.outputs.cpp == 'true'
run: cmake --build build --config ${{env.BUILD_TYPE}}

View File

@@ -47,6 +47,13 @@
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x49\\x89\\xFF\\x41\\x56\\x41\\x55\\x41\\x54\\x4D\\x89\\xC4"
}
},
"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",
"linux": "\\x55\\x48\\x89\\xF2\\x48\\x89\\xE5\\x41\\x54\\x49\\x89\\xFC\\x48\\x8D\\x7D\\xE0\\x48\\x83\\xEC\\x18\\x48\\x8D\\x05\\xE5\\xD1\\xBF\\x00"
}
},
"CBasePlayerPawn_CommitSuicide": {
"offsets": {
"windows": 355,

View File

@@ -31,11 +31,11 @@ namespace CounterStrikeSharp.API.Core
/// </summary>
internal sealed partial class CoreConfigData
{
[JsonPropertyName("PublicChatTrigger")] public string PublicChatTrigger { get; internal set; } = "!";
[JsonPropertyName("SilentChatTrigger")] public string SilentChatTrigger { get; internal set; } = "/";
[JsonPropertyName("PublicChatTrigger")] public string PublicChatTrigger { get; set; } = "!";
[JsonPropertyName("FollowCS2ServerGuidelines")] public bool FollowCS2ServerGuidelines { get; internal set; } = true;
[JsonPropertyName("SilentChatTrigger")] public string SilentChatTrigger { get; set; } = "/";
[JsonPropertyName("FollowCS2ServerGuidelines")] public bool FollowCS2ServerGuidelines { get; set; } = true;
}
/// <summary>
@@ -103,12 +103,12 @@ namespace CounterStrikeSharp.API.Core
try
{
var data = JsonSerializer.Deserialize<CoreConfigData>(File.ReadAllText(coreConfigPath), new JsonSerializerOptions() { ReadCommentHandling = JsonCommentHandling.Skip });
if (data != null)
{
_coreConfig = data;
}
Console.WriteLine($"Loaded core configuration");
}
catch (Exception ex)

View File

@@ -0,0 +1,27 @@
/*
* 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 CounterStrikeSharp.API.Modules.Memory;
namespace CounterStrikeSharp.API.Core;
public partial class CBaseModelEntity
{
public void SetModel(string model)
{
VirtualFunctions.SetModel(Handle, model);
}
}

View File

@@ -24,4 +24,7 @@ public static class VirtualFunctions
// void(*UTIL_Remove)(CEntityInstance*);
public static Action<IntPtr> UTIL_Remove = VirtualFunction.CreateVoid<IntPtr>(GameData.GetSignature("UTIL_Remove"));
// void(*CBaseModelEntity_SetModel)(CBaseModelEntity*, const char*);
public static Action<IntPtr, string> SetModel = VirtualFunction.CreateVoid<IntPtr, string>(GameData.GetSignature("CBaseModelEntity_SetModel"));
}