mirror of
https://github.com/roflmuffin/CounterStrikeSharp.git
synced 2025-12-07 08:26:34 -08:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
2
.github/workflows/cmake-single-platform.yml
vendored
2
.github/workflows/cmake-single-platform.yml
vendored
@@ -107,7 +107,7 @@ jobs:
|
||||
run: |
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ..
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ..
|
||||
cmake --build . --config ${{env.BUILD_TYPE}} -- -j16
|
||||
|
||||
- name: Clean build directory
|
||||
|
||||
1
.github/workflows/publish-docs.yml
vendored
1
.github/workflows/publish-docs.yml
vendored
@@ -2,6 +2,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"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 49 89 D6 41 55 49 89 CD 41 54 49 89 F4 53 48 89 FB 48 8D 3D"
|
||||
"linux": "55 48 89 E5 41 57 41 56 4D 89 C6 41 55 49 89 D5 41 54 49 89 F4"
|
||||
}
|
||||
},
|
||||
"UTIL_Remove": {
|
||||
@@ -84,14 +84,14 @@
|
||||
"CCSPlayer_WeaponServices_CanUse": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 56 48 83 EC 30 48 8B 01",
|
||||
"windows": "48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 56 48 83 EC ? 48 8B 01 48 8B FA",
|
||||
"linux": "55 48 8D 15 ? ? ? ? 48 89 E5 41 55 49 89 FD 41 54 49 89 F4"
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_CanAcquire": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 8B C4 44 89 40 ? 48 89 50 ? 48 89 48",
|
||||
"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 41 55 49 89 CD 41 54 53 48 83 EC"
|
||||
}
|
||||
},
|
||||
@@ -133,6 +133,12 @@
|
||||
"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",
|
||||
@@ -170,8 +176,8 @@
|
||||
},
|
||||
"CBasePlayerPawn_CommitSuicide": {
|
||||
"offsets": {
|
||||
"windows": 377,
|
||||
"linux": 377
|
||||
"windows": 380,
|
||||
"linux": 380
|
||||
}
|
||||
},
|
||||
"CBasePlayerPawn_RemovePlayerItem": {
|
||||
@@ -253,5 +259,11 @@
|
||||
"windows": 2,
|
||||
"linux": 0
|
||||
}
|
||||
},
|
||||
"CheckTransmitPlayerSlot": {
|
||||
"offsets": {
|
||||
"windows": 584,
|
||||
"linux": 584
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,6 @@
|
||||
|
||||
- name: Dependency Injection
|
||||
href: dependency-injection.md
|
||||
|
||||
- name: Referencing Players
|
||||
href: referencing-players.md
|
||||
@@ -1,5 +1,2 @@
|
||||
- name: Core Configuration
|
||||
href: core-configuration.md
|
||||
|
||||
- name: Referencing Players
|
||||
href: referencing-players.md
|
||||
href: core-configuration.md
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Submodule libraries/Protobufs updated: 76e070dc65...b46090af9c
Submodule libraries/hl2sdk-cs2 updated: fc4b98f1a7...a26ca82e87
@@ -11,7 +11,7 @@ set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING
|
||||
FORCE
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
if(LINUX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
|
||||
@@ -163,5 +163,12 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,15 +12,17 @@ public partial class CBaseEntity
|
||||
public void Teleport(Vector? position = null, QAngle? angles = null, Vector? velocity = null)
|
||||
{
|
||||
Guard.IsValidEntity(this);
|
||||
|
||||
|
||||
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;
|
||||
|
||||
VirtualFunction.CreateVoid<IntPtr, IntPtr, IntPtr, IntPtr>(Handle, GameData.GetOffset("CBaseEntity_Teleport"))(Handle, _position, _angles, _velocity);
|
||||
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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,4 +340,11 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,4 +58,8 @@ public partial class CBaseAnimGraph : CBaseModelEntity
|
||||
[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");
|
||||
|
||||
}
|
||||
|
||||
@@ -78,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");
|
||||
|
||||
}
|
||||
|
||||
@@ -30,10 +30,6 @@ public partial class CBaseCombatCharacter : CBaseFlex
|
||||
[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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -98,6 +98,10 @@ public partial class CCSPlayerController : CBasePlayerController
|
||||
[SchemaMember("CCSPlayerController", "m_bRemoveAllItemsOnNextRoundReset")]
|
||||
public ref bool RemoveAllItemsOnNextRoundReset => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerController", "m_bRemoveAllItemsOnNextRoundReset");
|
||||
|
||||
// m_flLastJoinTeamTime
|
||||
[SchemaMember("CCSPlayerController", "m_flLastJoinTeamTime")]
|
||||
public ref float LastJoinTeamTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerController", "m_flLastJoinTeamTime");
|
||||
|
||||
// m_szClan
|
||||
[SchemaMember("CCSPlayerController", "m_szClan")]
|
||||
public string Clan
|
||||
@@ -290,9 +294,17 @@ public partial class CCSPlayerController : CBasePlayerController
|
||||
[SchemaMember("CCSPlayerController", "m_iRoundsWon")]
|
||||
public ref Int32 RoundsWon => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerController", "m_iRoundsWon");
|
||||
|
||||
// m_vecKills
|
||||
[SchemaMember("CCSPlayerController", "m_vecKills")]
|
||||
public NetworkedVector<EKillTypes_t> Kills => Schema.GetDeclaredClass<NetworkedVector<EKillTypes_t>>(this.Handle, "CCSPlayerController", "m_vecKills");
|
||||
// m_recentKillQueue
|
||||
[SchemaMember("CCSPlayerController", "m_recentKillQueue")]
|
||||
public Span<byte> RecentKillQueue => Schema.GetFixedArray<byte>(this.Handle, "CCSPlayerController", "m_recentKillQueue", 8);
|
||||
|
||||
// m_nFirstKill
|
||||
[SchemaMember("CCSPlayerController", "m_nFirstKill")]
|
||||
public ref byte FirstKill => ref Schema.GetRef<byte>(this.Handle, "CCSPlayerController", "m_nFirstKill");
|
||||
|
||||
// m_nKillCount
|
||||
[SchemaMember("CCSPlayerController", "m_nKillCount")]
|
||||
public ref byte KillCount => ref Schema.GetRef<byte>(this.Handle, "CCSPlayerController", "m_nKillCount");
|
||||
|
||||
// m_bMvpNoMusic
|
||||
[SchemaMember("CCSPlayerController", "m_bMvpNoMusic")]
|
||||
@@ -370,4 +382,8 @@ public partial class CCSPlayerController : CBasePlayerController
|
||||
[SchemaMember("CCSPlayerController", "m_nNonSuspiciousHitStreak")]
|
||||
public ref UInt32 NonSuspiciousHitStreak => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayerController", "m_nNonSuspiciousHitStreak");
|
||||
|
||||
// m_bFireBulletsSeedSynchronized
|
||||
[SchemaMember("CCSPlayerController", "m_bFireBulletsSeedSynchronized")]
|
||||
public ref bool FireBulletsSeedSynchronized => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerController", "m_bFireBulletsSeedSynchronized");
|
||||
|
||||
}
|
||||
|
||||
@@ -18,10 +18,6 @@ public partial class CCSPlayer_MovementServices : CPlayer_MovementServices_Human
|
||||
{
|
||||
public CCSPlayer_MovementServices (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
// m_flMaxFallVelocity
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_flMaxFallVelocity")]
|
||||
public ref float MaxFallVelocity => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_flMaxFallVelocity");
|
||||
|
||||
// m_vecLadderNormal
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_vecLadderNormal")]
|
||||
public Vector LadderNormal => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayer_MovementServices", "m_vecLadderNormal");
|
||||
@@ -142,14 +138,6 @@ public partial class CCSPlayer_MovementServices : CPlayer_MovementServices_Human
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_flJumpPressedTime")]
|
||||
public ref float JumpPressedTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_flJumpPressedTime");
|
||||
|
||||
// m_flJumpUntil
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_flJumpUntil")]
|
||||
public ref float JumpUntil => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_flJumpUntil");
|
||||
|
||||
// m_flJumpVel
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_flJumpVel")]
|
||||
public ref float JumpVel => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_flJumpVel");
|
||||
|
||||
// m_fStashGrenadeParameterWhen
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_fStashGrenadeParameterWhen")]
|
||||
public ref float StashGrenadeParameterWhen => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_fStashGrenadeParameterWhen");
|
||||
@@ -182,4 +170,12 @@ public partial class CCSPlayer_MovementServices : CPlayer_MovementServices_Human
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_flMaxJumpHeightLastJump")]
|
||||
public ref float MaxJumpHeightLastJump => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_flMaxJumpHeightLastJump");
|
||||
|
||||
// m_flStaminaAtJumpStart
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_flStaminaAtJumpStart")]
|
||||
public ref float StaminaAtJumpStart => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_flStaminaAtJumpStart");
|
||||
|
||||
// m_flAccumulatedJumpError
|
||||
[SchemaMember("CCSPlayer_MovementServices", "m_flAccumulatedJumpError")]
|
||||
public ref float AccumulatedJumpError => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_MovementServices", "m_flAccumulatedJumpError");
|
||||
|
||||
}
|
||||
|
||||
@@ -222,6 +222,10 @@ public partial class CCSWeaponBase : CBasePlayerWeapon
|
||||
[SchemaMember("CCSWeaponBase", "m_nextPrevOwnerTouchTime")]
|
||||
public ref float NextPrevOwnerTouchTime => ref Schema.GetRef<float>(this.Handle, "CCSWeaponBase", "m_nextPrevOwnerTouchTime");
|
||||
|
||||
// m_nextPrevOwnerUseTime
|
||||
[SchemaMember("CCSWeaponBase", "m_nextPrevOwnerUseTime")]
|
||||
public ref float NextPrevOwnerUseTime => ref Schema.GetRef<float>(this.Handle, "CCSWeaponBase", "m_nextPrevOwnerUseTime");
|
||||
|
||||
// m_hPrevOwner
|
||||
[SchemaMember("CCSWeaponBase", "m_hPrevOwner")]
|
||||
public CHandle<CCSPlayerPawn> PrevOwner => Schema.GetDeclaredClass<CHandle<CCSPlayerPawn>>(this.Handle, "CCSWeaponBase", "m_hPrevOwner");
|
||||
|
||||
@@ -58,6 +58,10 @@ public partial class CDamageRecord : NativeObject
|
||||
[SchemaMember("CDamageRecord", "m_RecipientXuid")]
|
||||
public ref UInt64 RecipientXuid => ref Schema.GetRef<UInt64>(this.Handle, "CDamageRecord", "m_RecipientXuid");
|
||||
|
||||
// m_iBulletsDamage
|
||||
[SchemaMember("CDamageRecord", "m_iBulletsDamage")]
|
||||
public ref Int32 BulletsDamage => ref Schema.GetRef<Int32>(this.Handle, "CDamageRecord", "m_iBulletsDamage");
|
||||
|
||||
// m_iDamage
|
||||
[SchemaMember("CDamageRecord", "m_iDamage")]
|
||||
public ref Int32 Damage => ref Schema.GetRef<Int32>(this.Handle, "CDamageRecord", "m_iDamage");
|
||||
|
||||
@@ -14,7 +14,7 @@ using CounterStrikeSharp.API.Core.Attributes;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public partial class CEnvSoundscape : CServerOnlyEntity
|
||||
public partial class CEnvSoundscape : CBaseEntity
|
||||
{
|
||||
public CEnvSoundscape (IntPtr pointer) : base(pointer) {}
|
||||
|
||||
@@ -26,14 +26,6 @@ public partial class CEnvSoundscape : CServerOnlyEntity
|
||||
[SchemaMember("CEnvSoundscape", "m_flRadius")]
|
||||
public ref float Radius => ref Schema.GetRef<float>(this.Handle, "CEnvSoundscape", "m_flRadius");
|
||||
|
||||
// m_soundscapeName
|
||||
[SchemaMember("CEnvSoundscape", "m_soundscapeName")]
|
||||
public string SoundscapeName
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CEnvSoundscape", "m_soundscapeName"); }
|
||||
set { Schema.SetString(this.Handle, "CEnvSoundscape", "m_soundscapeName", value); }
|
||||
}
|
||||
|
||||
// m_soundEventName
|
||||
[SchemaMember("CEnvSoundscape", "m_soundEventName")]
|
||||
public string SoundEventName
|
||||
@@ -54,10 +46,6 @@ public partial class CEnvSoundscape : CServerOnlyEntity
|
||||
[SchemaMember("CEnvSoundscape", "m_soundscapeEntityListId")]
|
||||
public ref Int32 SoundscapeEntityListId => ref Schema.GetRef<Int32>(this.Handle, "CEnvSoundscape", "m_soundscapeEntityListId");
|
||||
|
||||
// m_soundEventHash
|
||||
[SchemaMember("CEnvSoundscape", "m_soundEventHash")]
|
||||
public ref UInt32 SoundEventHash => ref Schema.GetRef<UInt32>(this.Handle, "CEnvSoundscape", "m_soundEventHash");
|
||||
|
||||
// m_positionNames
|
||||
[SchemaMember("CEnvSoundscape", "m_positionNames")]
|
||||
public Span<string> PositionNames => Schema.GetFixedArray<string>(this.Handle, "CEnvSoundscape", "m_positionNames", 8);
|
||||
@@ -70,4 +58,16 @@ public partial class CEnvSoundscape : CServerOnlyEntity
|
||||
[SchemaMember("CEnvSoundscape", "m_bDisabled")]
|
||||
public ref bool Disabled => ref Schema.GetRef<bool>(this.Handle, "CEnvSoundscape", "m_bDisabled");
|
||||
|
||||
// m_soundscapeName
|
||||
[SchemaMember("CEnvSoundscape", "m_soundscapeName")]
|
||||
public string SoundscapeName
|
||||
{
|
||||
get { return Schema.GetUtf8String(this.Handle, "CEnvSoundscape", "m_soundscapeName"); }
|
||||
set { Schema.SetString(this.Handle, "CEnvSoundscape", "m_soundscapeName", value); }
|
||||
}
|
||||
|
||||
// m_soundEventHash
|
||||
[SchemaMember("CEnvSoundscape", "m_soundEventHash")]
|
||||
public ref UInt32 SoundEventHash => ref Schema.GetRef<UInt32>(this.Handle, "CEnvSoundscape", "m_soundEventHash");
|
||||
|
||||
}
|
||||
|
||||
@@ -50,4 +50,8 @@ public partial class CMapInfo : CPointEntity
|
||||
[SchemaMember("CMapInfo", "m_bFadePlayerVisibilityFarZ")]
|
||||
public ref bool FadePlayerVisibilityFarZ => ref Schema.GetRef<bool>(this.Handle, "CMapInfo", "m_bFadePlayerVisibilityFarZ");
|
||||
|
||||
// m_bRainTraceToSkyEnabled
|
||||
[SchemaMember("CMapInfo", "m_bRainTraceToSkyEnabled")]
|
||||
public ref bool RainTraceToSkyEnabled => ref Schema.GetRef<bool>(this.Handle, "CMapInfo", "m_bRainTraceToSkyEnabled");
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,14 @@ public partial class CPointWorldText : CModelPointEntity
|
||||
set { Schema.SetStringBytes(this.Handle, "CPointWorldText", "m_FontName", value, 64); }
|
||||
}
|
||||
|
||||
// m_BackgroundMaterialName
|
||||
[SchemaMember("CPointWorldText", "m_BackgroundMaterialName")]
|
||||
public string BackgroundMaterialName
|
||||
{
|
||||
get { return Schema.GetString(this.Handle, "CPointWorldText", "m_BackgroundMaterialName"); }
|
||||
set { Schema.SetStringBytes(this.Handle, "CPointWorldText", "m_BackgroundMaterialName", value, 64); }
|
||||
}
|
||||
|
||||
// m_bEnabled
|
||||
[SchemaMember("CPointWorldText", "m_bEnabled")]
|
||||
public ref bool Enabled => ref Schema.GetRef<bool>(this.Handle, "CPointWorldText", "m_bEnabled");
|
||||
@@ -54,6 +62,22 @@ public partial class CPointWorldText : CModelPointEntity
|
||||
[SchemaMember("CPointWorldText", "m_flDepthOffset")]
|
||||
public ref float DepthOffset => ref Schema.GetRef<float>(this.Handle, "CPointWorldText", "m_flDepthOffset");
|
||||
|
||||
// m_bDrawBackground
|
||||
[SchemaMember("CPointWorldText", "m_bDrawBackground")]
|
||||
public ref bool DrawBackground => ref Schema.GetRef<bool>(this.Handle, "CPointWorldText", "m_bDrawBackground");
|
||||
|
||||
// m_flBackgroundBorderWidth
|
||||
[SchemaMember("CPointWorldText", "m_flBackgroundBorderWidth")]
|
||||
public ref float BackgroundBorderWidth => ref Schema.GetRef<float>(this.Handle, "CPointWorldText", "m_flBackgroundBorderWidth");
|
||||
|
||||
// m_flBackgroundBorderHeight
|
||||
[SchemaMember("CPointWorldText", "m_flBackgroundBorderHeight")]
|
||||
public ref float BackgroundBorderHeight => ref Schema.GetRef<float>(this.Handle, "CPointWorldText", "m_flBackgroundBorderHeight");
|
||||
|
||||
// m_flBackgroundWorldToUV
|
||||
[SchemaMember("CPointWorldText", "m_flBackgroundWorldToUV")]
|
||||
public ref float BackgroundWorldToUV => ref Schema.GetRef<float>(this.Handle, "CPointWorldText", "m_flBackgroundWorldToUV");
|
||||
|
||||
// m_Color
|
||||
[SchemaMember("CPointWorldText", "m_Color")]
|
||||
public Color Color
|
||||
|
||||
@@ -30,4 +30,8 @@ public partial class CRagdollManager : CBaseEntity
|
||||
[SchemaMember("CRagdollManager", "m_bSaveImportant")]
|
||||
public ref bool SaveImportant => ref Schema.GetRef<bool>(this.Handle, "CRagdollManager", "m_bSaveImportant");
|
||||
|
||||
// m_bCanTakeDamage
|
||||
[SchemaMember("CRagdollManager", "m_bCanTakeDamage")]
|
||||
public ref bool CanTakeDamage => ref Schema.GetRef<bool>(this.Handle, "CRagdollManager", "m_bCanTakeDamage");
|
||||
|
||||
}
|
||||
|
||||
@@ -42,6 +42,14 @@ public partial class CSmokeGrenadeProjectile : CBaseCSGrenadeProjectile
|
||||
[SchemaMember("CSmokeGrenadeProjectile", "m_VoxelFrameData")]
|
||||
public NetworkedVector<byte> VoxelFrameData => Schema.GetDeclaredClass<NetworkedVector<byte>>(this.Handle, "CSmokeGrenadeProjectile", "m_VoxelFrameData");
|
||||
|
||||
// m_nVoxelFrameDataSize
|
||||
[SchemaMember("CSmokeGrenadeProjectile", "m_nVoxelFrameDataSize")]
|
||||
public ref Int32 VoxelFrameDataSize => ref Schema.GetRef<Int32>(this.Handle, "CSmokeGrenadeProjectile", "m_nVoxelFrameDataSize");
|
||||
|
||||
// m_nVoxelUpdate
|
||||
[SchemaMember("CSmokeGrenadeProjectile", "m_nVoxelUpdate")]
|
||||
public ref Int32 VoxelUpdate => ref Schema.GetRef<Int32>(this.Handle, "CSmokeGrenadeProjectile", "m_nVoxelUpdate");
|
||||
|
||||
// m_flLastBounce
|
||||
[SchemaMember("CSmokeGrenadeProjectile", "m_flLastBounce")]
|
||||
public ref float LastBounce => ref Schema.GetRef<float>(this.Handle, "CSmokeGrenadeProjectile", "m_flLastBounce");
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public enum EContributionScoreFlag_t : byte
|
||||
{
|
||||
k_EContributionScoreFlag_Default = 0x0,
|
||||
k_EContributionScoreFlag_Objective = 0x1,
|
||||
k_EContributionScoreFlag_Bullets = 0x2,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public enum EDestructiblePartDamagePassThroughType : uint
|
||||
{
|
||||
Normal = 0x0,
|
||||
Absorb = 0x1,
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// <auto-generated />
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
||||
namespace CounterStrikeSharp.API.Core;
|
||||
|
||||
public enum EIKEndEffectorRotationFixUpMode : uint
|
||||
{
|
||||
None = 0x0,
|
||||
MatchTargetOrientation = 0x1,
|
||||
LookAtTargetForward = 0x2,
|
||||
MaintainParentOrientation = 0x3,
|
||||
Count = 0x4,
|
||||
}
|
||||
@@ -2,7 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
|
||||
namespace CounterStrikeSharp.API.Modules.Commands.Targeting;
|
||||
@@ -12,7 +14,9 @@ public class Target
|
||||
private TargetType Type { get; }
|
||||
private string Raw { get; }
|
||||
private string Slug { get; }
|
||||
|
||||
|
||||
internal CCSGameRulesProxy? _gameRulesEntity = null;
|
||||
|
||||
public static readonly IReadOnlyDictionary<string, TargetType> TargetTypeMap = new Dictionary<string, TargetType>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "@all", TargetType.GroupAll },
|
||||
@@ -22,6 +26,7 @@ public class Target
|
||||
{ "@dead", TargetType.GroupDead },
|
||||
{ "@!me", TargetType.GroupNotMe },
|
||||
{ "@me", TargetType.PlayerMe },
|
||||
{ "@aim", TargetType.PlayerAim },
|
||||
{ "@ct", TargetType.TeamCt },
|
||||
{ "@t", TargetType.TeamT },
|
||||
{ "@spec", TargetType.TeamSpec }
|
||||
@@ -49,7 +54,7 @@ public class Target
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
slug = target.TrimStart('#');
|
||||
if (slug.StartsWith("STEAM")) targetType = TargetType.IdSteamEscaped;
|
||||
else if (!ulong.TryParse(slug, out _)) targetType = TargetType.ExplicitName;
|
||||
@@ -80,48 +85,40 @@ public class Target
|
||||
}
|
||||
}
|
||||
|
||||
private bool TargetPredicate(CCSPlayerController player, CCSPlayerController? caller)
|
||||
private bool TargetPredicate(CCSPlayerController player, CCSPlayerController? caller, CCSGameRules? gameRules = null)
|
||||
{
|
||||
switch (Type)
|
||||
return Type switch
|
||||
{
|
||||
case TargetType.TeamCt:
|
||||
return player.TeamNum == (byte)CsTeam.CounterTerrorist;
|
||||
case TargetType.TeamT:
|
||||
return player.TeamNum == (byte)CsTeam.Terrorist;
|
||||
case TargetType.TeamSpec:
|
||||
return player.TeamNum == (byte)CsTeam.Spectator;
|
||||
case TargetType.GroupAll:
|
||||
return !player.IsHLTV;
|
||||
case TargetType.GroupBots:
|
||||
return player.IsBot;
|
||||
case TargetType.GroupHumans:
|
||||
return !player.IsBot && !player.IsHLTV;
|
||||
case TargetType.GroupAlive:
|
||||
return player.PlayerPawn is { IsValid: true, Value.LifeState: (byte)LifeState_t.LIFE_ALIVE };
|
||||
case TargetType.GroupDead:
|
||||
return player.PlayerPawn is { IsValid: true, Value.LifeState: (byte)LifeState_t.LIFE_DEAD or (byte)LifeState_t.LIFE_DYING };
|
||||
case TargetType.GroupNotMe:
|
||||
return player.SteamID != caller?.SteamID;
|
||||
case TargetType.PlayerMe:
|
||||
return player.SteamID == caller?.SteamID;
|
||||
case TargetType.IdUserid:
|
||||
return player.UserId.ToString() == Slug;
|
||||
case TargetType.IdSteamEscaped:
|
||||
return ((SteamID)player.SteamID).SteamId2 == Slug;
|
||||
case TargetType.IdSteam64:
|
||||
return ((SteamID)player.SteamID).SteamId64.ToString() == Slug;
|
||||
case TargetType.ExplicitName:
|
||||
case TargetType.ImplicitName:
|
||||
return player.PlayerName.Contains(Slug, StringComparison.OrdinalIgnoreCase);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
TargetType.PlayerAim => caller != null && player == gameRules!.GetClientAimTarget(caller),
|
||||
TargetType.TeamCt => player.Team == CsTeam.CounterTerrorist,
|
||||
TargetType.TeamT => player.Team == CsTeam.Terrorist,
|
||||
TargetType.TeamSpec => player.Team == CsTeam.Spectator,
|
||||
TargetType.GroupAll => !player.IsHLTV,
|
||||
TargetType.GroupBots => player.IsBot,
|
||||
TargetType.GroupHumans => !player.IsBot && !player.IsHLTV,
|
||||
TargetType.GroupAlive => player.PlayerPawn is { IsValid: true, Value.LifeState: (byte)LifeState_t.LIFE_ALIVE },
|
||||
TargetType.GroupDead => player.PlayerPawn is { IsValid: true, Value.LifeState: (byte)LifeState_t.LIFE_DEAD or (byte)LifeState_t.LIFE_DYING },
|
||||
TargetType.GroupNotMe => player.SteamID != caller?.SteamID,
|
||||
TargetType.PlayerMe => player.SteamID == caller?.SteamID,
|
||||
TargetType.IdUserid => player.UserId.ToString() == Slug,
|
||||
TargetType.IdSteamEscaped => ((SteamID)player.SteamID).SteamId2 == Slug,
|
||||
TargetType.IdSteam64 => ((SteamID)player.SteamID).SteamId64.ToString() == Slug,
|
||||
TargetType.ExplicitName => player.PlayerName.Contains(Slug, StringComparison.OrdinalIgnoreCase),
|
||||
TargetType.ImplicitName => player.PlayerName.Contains(Slug, StringComparison.OrdinalIgnoreCase),
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
public TargetResult GetTarget(CCSPlayerController? caller)
|
||||
{
|
||||
var players = Utilities.GetPlayers().Where(player => TargetPredicate(player, caller)).ToList();
|
||||
|
||||
return new TargetResult() { Players = players };
|
||||
if (Type == TargetType.PlayerAim)
|
||||
{
|
||||
if (_gameRulesEntity == null || !_gameRulesEntity.IsValid)
|
||||
{
|
||||
_gameRulesEntity = Utilities.FindAllEntitiesByDesignerName<CCSGameRulesProxy>("cs_gamerules").FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
return new TargetResult() { Players = Utilities.GetPlayers().Where(player => TargetPredicate(player, caller, _gameRulesEntity?.GameRules)).ToList() };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ public enum TargetType
|
||||
GroupNotMe, // @!me
|
||||
|
||||
PlayerMe, // @me
|
||||
PlayerAim, // @aim
|
||||
|
||||
IdUserid, // #4
|
||||
IdSteamEscaped, // "#STEAM_0:1:8614"
|
||||
@@ -22,4 +23,4 @@ public enum TargetType
|
||||
ExplicitName, // #name
|
||||
ImplicitName, // name
|
||||
Invalid
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
using System.Text.Json;
|
||||
using System.Reflection;
|
||||
|
||||
namespace CounterStrikeSharp.API.Modules.Extensions;
|
||||
|
||||
public static class PluginConfigExtensions
|
||||
{
|
||||
private static readonly JsonSerializerOptions _jsonSerializerOptions = new()
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
public static JsonSerializerOptions JsonSerializerOptions => _jsonSerializerOptions;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configuration file path
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the plugin configuration.</typeparam>
|
||||
/// <param name="_">Current configuration instance</param>
|
||||
public static string GetConfigPath<T>(this T _) where T : BasePluginConfig, new()
|
||||
{
|
||||
string assemblyName = typeof(T).Assembly.GetName().Name ?? string.Empty;
|
||||
return Path.Combine(Server.GameDirectory, "csgo", "addons", "counterstrikesharp", "configs", "plugins", assemblyName, $"{assemblyName}.json");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the configuration file
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the plugin configuration.</typeparam>
|
||||
/// <param name="config">Current configuration instance</param>
|
||||
public static void Update<T>(this T config) where T : BasePluginConfig, new()
|
||||
{
|
||||
var configPath = config.GetConfigPath();
|
||||
|
||||
try
|
||||
{
|
||||
using var stream = new FileStream(configPath, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||
using var writer = new StreamWriter(stream);
|
||||
writer.Write(JsonSerializer.Serialize(config, JsonSerializerOptions));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception($"Failed to update configuration file at '{configPath}'.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the configuration file and updates current configuration instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the plugin configuration.</typeparam>
|
||||
/// <param name="config">Current configuration instance</param>
|
||||
public static void Reload<T>(this T config) where T : BasePluginConfig, new()
|
||||
{
|
||||
var configPath = config.GetConfigPath();
|
||||
|
||||
try
|
||||
{
|
||||
if (!File.Exists(configPath))
|
||||
{
|
||||
throw new FileNotFoundException($"Configuration file '{configPath} not found.");
|
||||
}
|
||||
|
||||
var configContent = File.ReadAllText(configPath);
|
||||
|
||||
var newConfig = JsonSerializer.Deserialize<T>(configContent)
|
||||
?? throw new JsonException($"Deserialization failed for configuration file '{configPath}'.");
|
||||
|
||||
foreach (var property in typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public))
|
||||
{
|
||||
if (property.CanWrite)
|
||||
{
|
||||
property.SetValue(config, property.GetValue(newConfig));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception($"Failed to reload configuration file at '{configPath}'.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,7 @@ public abstract class BaseMenuInstance : IMenuInstance
|
||||
|
||||
protected bool HasPrevButton => Page > 0;
|
||||
protected bool HasNextButton => Menu.MenuOptions.Count > NumPerPage && CurrentOffset + NumPerPage < Menu.MenuOptions.Count;
|
||||
protected bool HasExitButton => Menu.ExitButton;
|
||||
protected virtual int MenuItemsPerPage => NumPerPage;
|
||||
|
||||
public virtual void Display()
|
||||
@@ -113,7 +114,7 @@ public abstract class BaseMenuInstance : IMenuInstance
|
||||
return;
|
||||
}
|
||||
|
||||
if (key == 9)
|
||||
if (key == 9 && HasExitButton)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
@@ -174,4 +175,4 @@ public abstract class BaseMenuInstance : IMenuInstance
|
||||
CurrentOffset = PrevPageOffsets.Pop();
|
||||
Display();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,13 +101,11 @@ public class RecipientFilter : IList<CCSPlayerController>, IMarshalToNative
|
||||
public void Add(int slot)
|
||||
{
|
||||
var player = Utilities.GetPlayerFromSlot(slot);
|
||||
if (player == null)
|
||||
if (player != null)
|
||||
{
|
||||
throw new ArgumentException($"Player with slot {slot} not found");
|
||||
_recipients.Add(player);
|
||||
CollectionChanged?.Invoke();
|
||||
}
|
||||
|
||||
_recipients.Add(player);
|
||||
CollectionChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void AddAllPlayers()
|
||||
|
||||
@@ -2497,7 +2497,36 @@
|
||||
]
|
||||
},
|
||||
"CAnimGraphControllerBase": {
|
||||
"fields": []
|
||||
"fields": [
|
||||
{
|
||||
"name": "m_sDestructiblePartDestroyedHitGroup",
|
||||
"type": {
|
||||
"atomic": 1,
|
||||
"category": 4,
|
||||
"inner": {
|
||||
"category": 1,
|
||||
"inner": {
|
||||
"category": 0,
|
||||
"name": "char"
|
||||
},
|
||||
"name": "char*"
|
||||
},
|
||||
"name": "CAnimGraphParamOptionalRef< char* >"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nDestructiblePartDestroyedPartIndex",
|
||||
"type": {
|
||||
"atomic": 1,
|
||||
"category": 4,
|
||||
"inner": {
|
||||
"category": 0,
|
||||
"name": "int32"
|
||||
},
|
||||
"name": "CAnimGraphParamOptionalRef< int32 >"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"CAnimGraphDebugReplay": {
|
||||
"fields": [
|
||||
@@ -5153,6 +5182,13 @@
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nLastDestructiblePartDestroyedAnimgraphSetTick",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "int32"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parent": "CBaseModelEntity"
|
||||
@@ -5685,14 +5721,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bHasEverHitPlayer",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bClearFromPlayers",
|
||||
"name": "m_bHasEverHitEnemy",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
@@ -5840,13 +5869,6 @@
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_LastHitGroup",
|
||||
"type": {
|
||||
"category": 6,
|
||||
"name": "HitGroup_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bApplyStressDamage",
|
||||
"type": {
|
||||
@@ -7084,6 +7106,55 @@
|
||||
"name": "CHitboxComponent"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nDestructiblePartInitialStateDestructed0",
|
||||
"type": {
|
||||
"category": 6,
|
||||
"name": "HitGroup_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nDestructiblePartInitialStateDestructed1",
|
||||
"type": {
|
||||
"category": 6,
|
||||
"name": "HitGroup_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nDestructiblePartInitialStateDestructed2",
|
||||
"type": {
|
||||
"category": 6,
|
||||
"name": "HitGroup_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nDestructiblePartInitialStateDestructed3",
|
||||
"type": {
|
||||
"category": 6,
|
||||
"name": "HitGroup_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nDestructiblePartInitialStateDestructed4",
|
||||
"type": {
|
||||
"category": 6,
|
||||
"name": "HitGroup_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nLastHitDestructiblePartIndex",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "int32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_LastHitGroup",
|
||||
"type": {
|
||||
"category": 6,
|
||||
"name": "HitGroup_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_flDissolveStartTime",
|
||||
"type": {
|
||||
@@ -14451,6 +14522,13 @@
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_flLastJoinTeamTime",
|
||||
"type": {
|
||||
"category": 5,
|
||||
"name": "GameTime_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_szClan",
|
||||
"type": {
|
||||
@@ -14805,15 +14883,28 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_vecKills",
|
||||
"name": "m_recentKillQueue",
|
||||
"type": {
|
||||
"atomic": 2,
|
||||
"category": 4,
|
||||
"category": 3,
|
||||
"inner": {
|
||||
"category": 6,
|
||||
"name": "EKillTypes_t"
|
||||
"category": 0,
|
||||
"name": "uint8"
|
||||
},
|
||||
"name": "CNetworkUtlVectorBase< EKillTypes_t >"
|
||||
"name": "uint8[8]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nFirstKill",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "uint8"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nKillCount",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "uint8"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -14948,6 +15039,13 @@
|
||||
"category": 0,
|
||||
"name": "uint32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bFireBulletsSeedSynchronized",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parent": "CBasePlayerController"
|
||||
@@ -16486,13 +16584,6 @@
|
||||
},
|
||||
"CCSPlayer_MovementServices": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "m_flMaxFallVelocity",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_vecLadderNormal",
|
||||
"type": {
|
||||
@@ -16716,20 +16807,6 @@
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_flJumpUntil",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_flJumpVel",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_fStashGrenadeParameterWhen",
|
||||
"type": {
|
||||
@@ -16785,6 +16862,20 @@
|
||||
"category": 0,
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_flStaminaAtJumpStart",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_flAccumulatedJumpError",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "float32"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parent": "CPlayer_MovementServices_Humanoid"
|
||||
@@ -17616,6 +17707,13 @@
|
||||
"name": "GameTime_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nextPrevOwnerUseTime",
|
||||
"type": {
|
||||
"category": 5,
|
||||
"name": "GameTime_t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_hPrevOwner",
|
||||
"type": {
|
||||
@@ -20347,6 +20445,13 @@
|
||||
"name": "uint64"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_iBulletsDamage",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "int32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_iDamage",
|
||||
"type": {
|
||||
@@ -20548,6 +20653,156 @@
|
||||
],
|
||||
"parent": "CAnimComponentUpdater"
|
||||
},
|
||||
"CDestructiblePartRuntimeData": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "m_nHealthRemaining",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "int32"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"CDestructiblePartRuntimeDataVector": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "m_DestructiblePartsRuntimeData",
|
||||
"type": {
|
||||
"atomic": 2,
|
||||
"category": 4,
|
||||
"inner": {
|
||||
"category": 5,
|
||||
"name": "CDestructiblePartRuntimeData"
|
||||
},
|
||||
"name": "CUtlVector< CDestructiblePartRuntimeData >"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"CDestructiblePartsSystemData": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "m_DestructiblePartsDataByHitGroup",
|
||||
"type": {
|
||||
"atomic": 3,
|
||||
"category": 4,
|
||||
"name": "CUtlOrderedMap< HitGroup_t, CDestructiblePartsSystemData_HitGroupInfoAndPartData >"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"CDestructiblePartsSystemData_HitGroupInfoAndPartData": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "m_sName",
|
||||
"type": {
|
||||
"atomic": 0,
|
||||
"category": 4,
|
||||
"name": "CUtlString"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_DestructiblePartsData",
|
||||
"type": {
|
||||
"atomic": 2,
|
||||
"category": 4,
|
||||
"inner": {
|
||||
"category": 5,
|
||||
"name": "CDestructiblePartsSystemData_PartData"
|
||||
},
|
||||
"name": "CUtlVector< CDestructiblePartsSystemData_PartData >"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bDisableHitGroupWhenDestroyed",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"CDestructiblePartsSystemData_PartData": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "m_sName",
|
||||
"type": {
|
||||
"atomic": 0,
|
||||
"category": 4,
|
||||
"name": "CUtlString"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_sBreakablePieceName",
|
||||
"type": {
|
||||
"atomic": 0,
|
||||
"category": 4,
|
||||
"name": "CGlobalSymbol"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_sBodyGroupName",
|
||||
"type": {
|
||||
"atomic": 0,
|
||||
"category": 4,
|
||||
"name": "CGlobalSymbol"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nBodyGroupValue",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "int32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_sAnimGraphParamName_PartDestroyed",
|
||||
"type": {
|
||||
"atomic": 0,
|
||||
"category": 4,
|
||||
"name": "CGlobalSymbol"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_sAnimGraphParamName_PartNormalizedHealth",
|
||||
"type": {
|
||||
"atomic": 0,
|
||||
"category": 4,
|
||||
"name": "CGlobalSymbol"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nHealth",
|
||||
"type": {
|
||||
"category": 5,
|
||||
"name": "CSkillInt"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nDamagePassthroughType",
|
||||
"type": {
|
||||
"category": 6,
|
||||
"name": "EDestructiblePartDamagePassThroughType"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bKillNPCOnDestruction",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_sCustomDeathHandshake",
|
||||
"type": {
|
||||
"atomic": 0,
|
||||
"category": 4,
|
||||
"name": "CGlobalSymbol"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"CDirectPlaybackTagData": {
|
||||
"fields": [
|
||||
{
|
||||
@@ -24209,14 +24464,6 @@
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_soundscapeName",
|
||||
"type": {
|
||||
"atomic": 0,
|
||||
"category": 4,
|
||||
"name": "CUtlSymbolLarge"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_soundEventName",
|
||||
"type": {
|
||||
@@ -24246,13 +24493,6 @@
|
||||
"name": "int32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_soundEventHash",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "uint32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_positionNames",
|
||||
"type": {
|
||||
@@ -24283,9 +24523,24 @@
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_soundscapeName",
|
||||
"type": {
|
||||
"atomic": 0,
|
||||
"category": 4,
|
||||
"name": "CUtlSymbolLarge"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_soundEventHash",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "uint32"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parent": "CServerOnlyEntity"
|
||||
"parent": "CBaseEntity"
|
||||
},
|
||||
"CEnvSoundscapeAlias_snd_soundscape": {
|
||||
"fields": [],
|
||||
@@ -34850,6 +35105,13 @@
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bRainTraceToSkyEnabled",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parent": "CPointEntity"
|
||||
@@ -48678,6 +48940,17 @@
|
||||
"name": "char[64]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_BackgroundMaterialName",
|
||||
"type": {
|
||||
"category": 3,
|
||||
"inner": {
|
||||
"category": 0,
|
||||
"name": "char"
|
||||
},
|
||||
"name": "char[64]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bEnabled",
|
||||
"type": {
|
||||
@@ -48713,6 +48986,34 @@
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bDrawBackground",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_flBackgroundBorderWidth",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_flBackgroundBorderHeight",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_flBackgroundWorldToUV",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "float32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_Color",
|
||||
"type": {
|
||||
@@ -51818,6 +52119,13 @@
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bCanTakeDamage",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parent": "CBaseEntity"
|
||||
@@ -57267,7 +57575,21 @@
|
||||
"category": 0,
|
||||
"name": "uint8"
|
||||
},
|
||||
"name": "CUtlVector< uint8 >"
|
||||
"name": "CNetworkUtlVectorBase< uint8 >"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nVoxelFrameDataSize",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "int32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nVoxelUpdate",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "int32"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -87420,6 +87742,13 @@
|
||||
"category": 0,
|
||||
"name": "int32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_EndEffectorRotationFixUpMode",
|
||||
"type": {
|
||||
"category": 6,
|
||||
"name": "EIKEndEffectorRotationFixUpMode"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -92093,6 +92422,13 @@
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_nHealthToGrant",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "int32"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -94126,13 +94462,6 @@
|
||||
},
|
||||
"name": "CUtlVector< ChainToSolveData_t >"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m_bMatchTargetOrientation",
|
||||
"type": {
|
||||
"category": 0,
|
||||
"name": "bool"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -101062,6 +101391,23 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"EContributionScoreFlag_t": {
|
||||
"align": 1,
|
||||
"items": [
|
||||
{
|
||||
"name": "k_EContributionScoreFlag_Default",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"name": "k_EContributionScoreFlag_Objective",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"name": "k_EContributionScoreFlag_Bullets",
|
||||
"value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"EDemoBoneSelectionMode": {
|
||||
"align": 4,
|
||||
"items": [
|
||||
@@ -101075,6 +101421,44 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"EDestructiblePartDamagePassThroughType": {
|
||||
"align": 4,
|
||||
"items": [
|
||||
{
|
||||
"name": "Normal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"name": "Absorb",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"EIKEndEffectorRotationFixUpMode": {
|
||||
"align": 4,
|
||||
"items": [
|
||||
{
|
||||
"name": "None",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"name": "MatchTargetOrientation",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"name": "LookAtTargetForward",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"name": "MaintainParentOrientation",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"name": "Count",
|
||||
"value": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"EInButtonState": {
|
||||
"align": 4,
|
||||
"items": [
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35309.182
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestPlugin", "TestPlugin\TestPlugin.csproj", "{57E64289-5D69-4AA1-BEF0-D0D96A55EE8F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CounterStrikeSharp.API", "CounterStrikeSharp.API\CounterStrikeSharp.API.csproj", "{55B47E41-61AA-4D75-9069-CB14328107B7}"
|
||||
@@ -42,6 +45,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WithSharedTypesConsumer", "
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WithUserMessages", "..\examples\WithUserMessages\WithUserMessages.csproj", "{A14029BA-CADE-4F25-ADC5-48CF14332F61}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WithCheckTransmit", "..\examples\WithCheckTransmit\WithCheckTransmit.csproj", "{854B06B5-0E7B-438A-BA51-3F299557F884}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -108,14 +113,14 @@ Global
|
||||
{6FA3107D-42AF-42A0-BF51-2230D13268B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6FA3107D-42AF-42A0-BF51-2230D13268B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6FA3107D-42AF-42A0-BF51-2230D13268B5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4E5289B5-E81D-421C-B340-B98B6FFE09D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4E5289B5-E81D-421C-B340-B98B6FFE09D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4E5289B5-E81D-421C-B340-B98B6FFE09D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4E5289B5-E81D-421C-B340-B98B6FFE09D1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1309954E-FAF7-47A5-9FF9-C7263B33E4E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1309954E-FAF7-47A5-9FF9-C7263B33E4E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1309954E-FAF7-47A5-9FF9-C7263B33E4E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1309954E-FAF7-47A5-9FF9-C7263B33E4E3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4E5289B5-E81D-421C-B340-B98B6FFE09D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4E5289B5-E81D-421C-B340-B98B6FFE09D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4E5289B5-E81D-421C-B340-B98B6FFE09D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4E5289B5-E81D-421C-B340-B98B6FFE09D1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A37676EA-CF2F-424D-85A1-C359D07A679D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A37676EA-CF2F-424D-85A1-C359D07A679D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A37676EA-CF2F-424D-85A1-C359D07A679D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -128,6 +133,13 @@ Global
|
||||
{A14029BA-CADE-4F25-ADC5-48CF14332F61}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A14029BA-CADE-4F25-ADC5-48CF14332F61}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A14029BA-CADE-4F25-ADC5-48CF14332F61}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{854B06B5-0E7B-438A-BA51-3F299557F884}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{854B06B5-0E7B-438A-BA51-3F299557F884}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{854B06B5-0E7B-438A-BA51-3F299557F884}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{854B06B5-0E7B-438A-BA51-3F299557F884}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{57E64289-5D69-4AA1-BEF0-D0D96A55EE8F} = {7DF99C35-881D-4FF2-B1C9-246BD3DECB9A}
|
||||
@@ -141,10 +153,14 @@ Global
|
||||
{31EABE0B-871F-497B-BF36-37FFC6FAD15F} = {7DF99C35-881D-4FF2-B1C9-246BD3DECB9A}
|
||||
{BB44E08E-CCA8-4E22-A132-11B2F69D1890} = {7DF99C35-881D-4FF2-B1C9-246BD3DECB9A}
|
||||
{6FA3107D-42AF-42A0-BF51-2230D13268B5} = {7DF99C35-881D-4FF2-B1C9-246BD3DECB9A}
|
||||
{4E5289B5-E81D-421C-B340-B98B6FFE09D1} = {7DF99C35-881D-4FF2-B1C9-246BD3DECB9A}
|
||||
{1309954E-FAF7-47A5-9FF9-C7263B33E4E3} = {7DF99C35-881D-4FF2-B1C9-246BD3DECB9A}
|
||||
{4E5289B5-E81D-421C-B340-B98B6FFE09D1} = {7DF99C35-881D-4FF2-B1C9-246BD3DECB9A}
|
||||
{A37676EA-CF2F-424D-85A1-C359D07A679D} = {7DF99C35-881D-4FF2-B1C9-246BD3DECB9A}
|
||||
{76AD7BB0-A096-4336-83E2-B32CAE4E9933} = {7DF99C35-881D-4FF2-B1C9-246BD3DECB9A}
|
||||
{A14029BA-CADE-4F25-ADC5-48CF14332F61} = {7DF99C35-881D-4FF2-B1C9-246BD3DECB9A}
|
||||
{854B06B5-0E7B-438A-BA51-3F299557F884} = {7DF99C35-881D-4FF2-B1C9-246BD3DECB9A}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {069C4CD4-BACA-446A-A6B8-0194E4F75355}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
@@ -301,6 +302,26 @@ namespace TestPlugin
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
// Hide every door (prop_door_rotating) for everyone as a test
|
||||
RegisterListener<Listeners.CheckTransmit>((CCheckTransmitInfoList infoList) =>
|
||||
{
|
||||
IEnumerable<CPropDoorRotating> doors = Utilities.FindAllEntitiesByDesignerName<CPropDoorRotating>("prop_door_rotating");
|
||||
|
||||
if (!doors.Any())
|
||||
return;
|
||||
|
||||
foreach ((CCheckTransmitInfo info, CCSPlayerController? player) in infoList)
|
||||
{
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
foreach (CPropDoorRotating door in doors)
|
||||
{
|
||||
info.TransmitEntities.Remove(door);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void SetupCommands()
|
||||
|
||||
@@ -78,6 +78,7 @@ ISmmAPI* ismm = nullptr;
|
||||
CGameEntitySystem* entitySystem = nullptr;
|
||||
CCoreConfig* coreConfig = nullptr;
|
||||
CGameConfig* gameConfig = nullptr;
|
||||
ISource2GameEntities* gameEntities = nullptr;
|
||||
|
||||
// Custom Managers
|
||||
CallbackManager callbackManager;
|
||||
|
||||
@@ -94,6 +94,7 @@ extern ISource2Server* server;
|
||||
extern CGlobalEntityList* globalEntityList;
|
||||
extern EntityListener entityListener;
|
||||
extern CGameEntitySystem* entitySystem;
|
||||
extern ISource2GameEntities* gameEntities;
|
||||
|
||||
extern EventManager eventManager;
|
||||
extern UserMessageManager userMessageManager;
|
||||
|
||||
@@ -24,14 +24,24 @@
|
||||
#include <public/eiface.h>
|
||||
#include "scripting/callback_manager.h"
|
||||
|
||||
SH_DECL_HOOK7_void(ISource2GameEntities, CheckTransmit, SH_NOATTRIB, 0, CCheckTransmitInfo**, int, CBitVec<16384>&, const Entity2Networkable_t**, const uint16*, int, bool);
|
||||
|
||||
namespace counterstrikesharp {
|
||||
|
||||
EntityManager::EntityManager() {}
|
||||
EntityManager::EntityManager()
|
||||
{
|
||||
m_profile_name = "EntityManager";
|
||||
}
|
||||
|
||||
EntityManager::~EntityManager() {}
|
||||
|
||||
CCheckTransmitInfoList::CCheckTransmitInfoList(CCheckTransmitInfo** pInfoInfoList, int nInfoCount) : infoList(pInfoInfoList), infoCount(nInfoCount) {}
|
||||
|
||||
void EntityManager::OnAllInitialized()
|
||||
{
|
||||
SH_ADD_HOOK_MEMFUNC(ISource2GameEntities, CheckTransmit, globals::gameEntities, this, &EntityManager::CheckTransmit, true);
|
||||
|
||||
check_transmit = globals::callbackManager.CreateCallback("CheckTransmit");
|
||||
on_entity_spawned_callback = globals::callbackManager.CreateCallback("OnEntitySpawned");
|
||||
on_entity_created_callback = globals::callbackManager.CreateCallback("OnEntityCreated");
|
||||
on_entity_deleted_callback = globals::callbackManager.CreateCallback("OnEntityDeleted");
|
||||
@@ -75,7 +85,10 @@ void EntityManager::OnShutdown()
|
||||
globals::callbackManager.ReleaseCallback(on_entity_created_callback);
|
||||
globals::callbackManager.ReleaseCallback(on_entity_deleted_callback);
|
||||
globals::callbackManager.ReleaseCallback(on_entity_parent_changed_callback);
|
||||
globals::callbackManager.ReleaseCallback(check_transmit);
|
||||
globals::entitySystem->RemoveListenerEntity(&entityListener);
|
||||
|
||||
SH_REMOVE_HOOK_MEMFUNC(ISource2GameEntities, CheckTransmit, globals::gameEntities, this, &EntityManager::CheckTransmit, true);
|
||||
}
|
||||
|
||||
void CEntityListener::OnEntitySpawned(CEntityInstance* pEntity)
|
||||
@@ -156,6 +169,23 @@ void EntityManager::UnhookEntityOutput(const char* szClassname, const char* szOu
|
||||
}
|
||||
}
|
||||
|
||||
void EntityManager::CheckTransmit(CCheckTransmitInfo** pInfoInfoList, int nInfoCount, CBitVec<16384>& unionTransmitEdicts, const Entity2Networkable_t** pNetworkables, const uint16* pEntityIndicies, int nEntityIndices, bool bEnablePVSBits)
|
||||
{
|
||||
VPROF_BUDGET(m_profile_name.c_str(), "CS# CheckTransmit");
|
||||
|
||||
auto callback = globals::entityManager.check_transmit;
|
||||
|
||||
if (callback && callback->GetFunctionCount()) {
|
||||
CCheckTransmitInfoList* infoList = new CCheckTransmitInfoList(pInfoInfoList, nInfoCount);
|
||||
|
||||
callback->ScriptContext().Reset();
|
||||
callback->ScriptContext().Push(infoList);
|
||||
callback->Execute();
|
||||
|
||||
delete infoList;
|
||||
}
|
||||
}
|
||||
|
||||
void DetourFireOutputInternal(CEntityIOOutput* const pThis, CEntityInstance* pActivator,
|
||||
CEntityInstance* pCaller, const CVariant* const value, float flDelay)
|
||||
{
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <variant.h>
|
||||
|
||||
#include "vprof.h"
|
||||
|
||||
namespace counterstrikesharp {
|
||||
class ScriptCallback;
|
||||
|
||||
@@ -39,6 +41,14 @@ class CEntityListener : public IEntityListener {
|
||||
void OnEntityParentChanged(CEntityInstance *pEntity, CEntityInstance *pNewParent) override;
|
||||
};
|
||||
|
||||
class CCheckTransmitInfoList {
|
||||
public:
|
||||
CCheckTransmitInfoList(CCheckTransmitInfo** pInfoInfoList, int nInfoCount);
|
||||
private:
|
||||
CCheckTransmitInfo** infoList;
|
||||
int infoCount;
|
||||
};
|
||||
|
||||
class EntityManager : public GlobalClass {
|
||||
friend CEntityListener;
|
||||
public:
|
||||
@@ -51,10 +61,15 @@ public:
|
||||
CEntityListener entityListener;
|
||||
std::map<OutputKey_t, CallbackPair*> m_pHookMap;
|
||||
private:
|
||||
void CheckTransmit(CCheckTransmitInfo** pInfoInfoList, int nInfoCount, CBitVec<16384>& unionTransmitEdicts, const Entity2Networkable_t** pNetworkables, const uint16* pEntityIndicies, int nEntityIndices, bool bEnablePVSBits);
|
||||
|
||||
ScriptCallback *on_entity_spawned_callback;
|
||||
ScriptCallback *on_entity_created_callback;
|
||||
ScriptCallback *on_entity_deleted_callback;
|
||||
ScriptCallback *on_entity_parent_changed_callback;
|
||||
ScriptCallback *check_transmit;
|
||||
|
||||
std::string m_profile_name;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -30,14 +30,15 @@
|
||||
*/
|
||||
|
||||
#include "core/timer_system.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include <public/eiface.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "core/globals.h"
|
||||
#include "core/log.h"
|
||||
#include "scripting/callback_manager.h"
|
||||
#include "core/managers/player_manager.h"
|
||||
#include "scripting/callback_manager.h"
|
||||
|
||||
namespace counterstrikesharp {
|
||||
namespace timers {
|
||||
@@ -46,8 +47,7 @@ double timer_next_think = 0.0f;
|
||||
} // namespace timers
|
||||
|
||||
timers::Timer::Timer(float interval, float exec_time, CallbackT callback, int flags)
|
||||
: m_interval(interval), m_exec_time(exec_time), m_flags(flags), m_kill_me(false),
|
||||
m_in_exec(false)
|
||||
: m_interval(interval), m_exec_time(exec_time), m_flags(flags), m_kill_me(false), m_in_exec(false)
|
||||
{
|
||||
m_callback = globals::callbackManager.CreateCallback("Timer");
|
||||
m_callback->AddListener(callback);
|
||||
@@ -76,7 +76,8 @@ void TimerSystem::OnShutdown()
|
||||
|
||||
void TimerSystem::OnLevelEnd()
|
||||
{
|
||||
if (on_map_end_callback && on_map_end_callback->GetFunctionCount()) {
|
||||
if (on_map_end_callback && on_map_end_callback->GetFunctionCount())
|
||||
{
|
||||
on_map_end_callback->ScriptContext().Reset();
|
||||
on_map_end_callback->Execute();
|
||||
}
|
||||
@@ -89,7 +90,8 @@ void TimerSystem::OnLevelEnd()
|
||||
|
||||
void TimerSystem::OnStartupServer()
|
||||
{
|
||||
if (m_has_map_ticked) {
|
||||
if (m_has_map_ticked)
|
||||
{
|
||||
CALL_GLOBAL_LISTENER(OnLevelEnd());
|
||||
|
||||
CSSHARP_CORE_TRACE("name={0}", "LevelShutdown");
|
||||
@@ -101,12 +103,16 @@ void TimerSystem::OnStartupServer()
|
||||
|
||||
void TimerSystem::OnGameFrame(bool simulating)
|
||||
{
|
||||
if (simulating && m_has_map_ticked) {
|
||||
if (simulating && m_has_map_ticked)
|
||||
{
|
||||
timers::universal_time += globals::getGlobalVars()->curtime - m_last_ticked_time;
|
||||
if (!m_has_map_simulated) {
|
||||
if (!m_has_map_simulated)
|
||||
{
|
||||
m_has_map_simulated = true;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
timers::universal_time += globals::engine_fixed_tick_interval;
|
||||
}
|
||||
|
||||
@@ -114,13 +120,15 @@ void TimerSystem::OnGameFrame(bool simulating)
|
||||
m_has_map_ticked = true;
|
||||
|
||||
// Handle timer tick
|
||||
if (timers::universal_time >= timers::timer_next_think) {
|
||||
if (timers::universal_time >= timers::timer_next_think)
|
||||
{
|
||||
RunFrame();
|
||||
|
||||
timers::timer_next_think = CalculateNextThink(timers::timer_next_think, 0.1f);
|
||||
}
|
||||
|
||||
if (m_on_tick_callback_->GetFunctionCount()) {
|
||||
if (m_on_tick_callback_->GetFunctionCount())
|
||||
{
|
||||
m_on_tick_callback_->ScriptContext().Reset();
|
||||
m_on_tick_callback_->Execute();
|
||||
}
|
||||
@@ -130,18 +138,23 @@ void TimerSystem::OnGameFrame(bool simulating)
|
||||
|
||||
double TimerSystem::CalculateNextThink(double last_think_time, float interval)
|
||||
{
|
||||
if (timers::universal_time - last_think_time - interval <= 0.1) {
|
||||
if (timers::universal_time - last_think_time - interval <= 0.1)
|
||||
{
|
||||
return last_think_time + interval;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return timers::universal_time + interval;
|
||||
}
|
||||
}
|
||||
|
||||
void TimerSystem::RunFrame()
|
||||
{
|
||||
for (int i = m_once_off_timers.size() - 1; i >= 0; i--) {
|
||||
for (int i = m_once_off_timers.size() - 1; i >= 0; i--)
|
||||
{
|
||||
auto timer = m_once_off_timers[i];
|
||||
if (timers::universal_time >= timer->m_exec_time) {
|
||||
if (timers::universal_time >= timer->m_exec_time)
|
||||
{
|
||||
timer->m_in_exec = true;
|
||||
timer->m_callback->ScriptContext().Reset();
|
||||
timer->m_callback->Execute();
|
||||
@@ -151,14 +164,17 @@ void TimerSystem::RunFrame()
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = m_repeat_timers.size() - 1; i >= 0; i--) {
|
||||
for (int i = m_repeat_timers.size() - 1; i >= 0; i--)
|
||||
{
|
||||
auto timer = m_repeat_timers[i];
|
||||
if (timers::universal_time >= timer->m_exec_time) {
|
||||
if (timers::universal_time >= timer->m_exec_time)
|
||||
{
|
||||
timer->m_in_exec = true;
|
||||
timer->m_callback->ScriptContext().Reset();
|
||||
timer->m_callback->Execute();
|
||||
|
||||
if (timer->m_kill_me) {
|
||||
if (timer->m_kill_me)
|
||||
{
|
||||
m_repeat_timers.erase(m_repeat_timers.begin() + i);
|
||||
delete timer;
|
||||
continue;
|
||||
@@ -172,17 +188,17 @@ void TimerSystem::RunFrame()
|
||||
|
||||
void TimerSystem::RemoveMapChangeTimers()
|
||||
{
|
||||
for (auto timer : m_once_off_timers) {
|
||||
if (timer->m_flags & TIMER_FLAG_NO_MAPCHANGE) {
|
||||
KillTimer(timer);
|
||||
auto isMapChangeTimer = [](timers::Timer* timer) {
|
||||
bool shouldRemove = timer->m_flags & TIMER_FLAG_NO_MAPCHANGE;
|
||||
if (shouldRemove)
|
||||
{
|
||||
delete timer;
|
||||
}
|
||||
}
|
||||
return shouldRemove;
|
||||
};
|
||||
|
||||
for (auto timer : m_repeat_timers) {
|
||||
if (timer->m_flags & TIMER_FLAG_NO_MAPCHANGE) {
|
||||
KillTimer(timer);
|
||||
}
|
||||
}
|
||||
std::erase_if(m_once_off_timers, isMapChangeTimer);
|
||||
std::erase_if(m_repeat_timers, isMapChangeTimer);
|
||||
}
|
||||
|
||||
timers::Timer* TimerSystem::CreateTimer(float interval, CallbackT callback, int flags)
|
||||
@@ -191,7 +207,8 @@ timers::Timer* TimerSystem::CreateTimer(float interval, CallbackT callback, int
|
||||
|
||||
auto timer = new timers::Timer(interval, exec_time, callback, flags);
|
||||
|
||||
if (flags & TIMER_FLAG_REPEAT) {
|
||||
if (flags & TIMER_FLAG_REPEAT)
|
||||
{
|
||||
m_repeat_timers.push_back(timer);
|
||||
return timer;
|
||||
}
|
||||
@@ -202,39 +219,41 @@ timers::Timer* TimerSystem::CreateTimer(float interval, CallbackT callback, int
|
||||
|
||||
void TimerSystem::KillTimer(timers::Timer* timer)
|
||||
{
|
||||
if (!timer)
|
||||
return;
|
||||
if (!timer) return;
|
||||
|
||||
if (std::find(m_repeat_timers.begin(), m_repeat_timers.end(), timer) == m_repeat_timers.end() &&
|
||||
std::find(m_once_off_timers.begin(), m_once_off_timers.end(), timer) ==
|
||||
m_once_off_timers.end()) {
|
||||
std::find(m_once_off_timers.begin(), m_once_off_timers.end(), timer) == m_once_off_timers.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (timer->m_kill_me)
|
||||
return;
|
||||
if (timer->m_kill_me) return;
|
||||
|
||||
// If were executing, make sure it doesn't run again next time.
|
||||
if (timer->m_in_exec) {
|
||||
if (timer->m_in_exec)
|
||||
{
|
||||
timer->m_kill_me = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (timer->m_flags & TIMER_FLAG_REPEAT) {
|
||||
auto it = std::remove_if(m_repeat_timers.begin(), m_repeat_timers.end(),
|
||||
[timer](timers::Timer* i) { return timer == i; });
|
||||
if (timer->m_flags & TIMER_FLAG_REPEAT)
|
||||
{
|
||||
auto it = std::remove_if(m_repeat_timers.begin(), m_repeat_timers.end(), [timer](timers::Timer* i) {
|
||||
return timer == i;
|
||||
});
|
||||
|
||||
bool success;
|
||||
if ((success = it != m_repeat_timers.end()))
|
||||
m_repeat_timers.erase(it, m_repeat_timers.end());
|
||||
if ((success = it != m_repeat_timers.end())) m_repeat_timers.erase(it, m_repeat_timers.end());
|
||||
delete timer;
|
||||
} else {
|
||||
auto it = std::remove_if(m_once_off_timers.begin(), m_once_off_timers.end(),
|
||||
[timer](timers::Timer* i) { return timer == i; });
|
||||
}
|
||||
else
|
||||
{
|
||||
auto it = std::remove_if(m_once_off_timers.begin(), m_once_off_timers.end(), [timer](timers::Timer* i) {
|
||||
return timer == i;
|
||||
});
|
||||
|
||||
bool success;
|
||||
if ((success = it != m_once_off_timers.end()))
|
||||
m_once_off_timers.erase(it, m_once_off_timers.end());
|
||||
if ((success = it != m_once_off_timers.end())) m_once_off_timers.erase(it, m_once_off_timers.end());
|
||||
delete timer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ bool CounterStrikeSharpMMPlugin::Load(PluginId id, ISmmAPI* ismm, char* error, s
|
||||
GET_V_IFACE_ANY(GetEngineFactory, globals::gameEventSystem, IGameEventSystem, GAMEEVENTSYSTEM_INTERFACE_VERSION);
|
||||
GET_V_IFACE_ANY(GetEngineFactory, globals::engineServiceManager, IEngineServiceMgr, ENGINESERVICEMGR_INTERFACE_VERSION);
|
||||
GET_V_IFACE_ANY(GetEngineFactory, globals::networkMessages, INetworkMessages, NETWORKMESSAGES_INTERFACE_VERSION);
|
||||
GET_V_IFACE_ANY(GetServerFactory, globals::gameEntities, ISource2GameEntities, SOURCE2GAMEENTITIES_INTERFACE_VERSION);
|
||||
|
||||
auto coreconfig_path = std::string(utils::ConfigsDirectory() + "/core");
|
||||
globals::coreConfig = new CCoreConfig(coreconfig_path);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
OnEntitySpawned: entity:pointer
|
||||
OnEntityCreated: entity:pointer
|
||||
OnEntityDeleted: entity:pointer
|
||||
OnEntityParentChanged: entity:pointer, newParent:pointer
|
||||
OnEntityParentChanged: entity:pointer, newParent:pointer
|
||||
CheckTransmit: infoList:pointer
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
#include <ios>
|
||||
#include <sstream>
|
||||
|
||||
#include "scripting/autonative.h"
|
||||
#include "core/function.h"
|
||||
#include "scripting/script_engine.h"
|
||||
#include "core/memory.h"
|
||||
#include "core/log.h"
|
||||
#include "core/memory.h"
|
||||
#include "scripting/autonative.h"
|
||||
#include "scripting/script_engine.h"
|
||||
|
||||
namespace counterstrikesharp {
|
||||
std::vector<ValveFunction*> m_managed_ptrs;
|
||||
@@ -44,21 +44,22 @@ ValveFunction* CreateVirtualFunctionBySignature(ScriptContext& script_context)
|
||||
|
||||
auto* function_addr = FindSignature(binary_name, signature_hex_string);
|
||||
|
||||
if (function_addr == nullptr) {
|
||||
if (function_addr == nullptr)
|
||||
{
|
||||
script_context.ThrowNativeError("Could not find signature %s", signature_hex_string);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto args = std::vector<DataType_t>();
|
||||
for (int i = 0; i < num_arguments; i++) {
|
||||
for (int i = 0; i < num_arguments; i++)
|
||||
{
|
||||
args.push_back(script_context.GetArgument<DataType_t>(5 + i));
|
||||
}
|
||||
|
||||
auto function = new ValveFunction(function_addr, CONV_CDECL, args, return_type);
|
||||
function->SetSignature(signature_hex_string);
|
||||
|
||||
CSSHARP_CORE_TRACE("Created virtual function, pointer found at {}, signature {}", function_addr,
|
||||
signature_hex_string);
|
||||
CSSHARP_CORE_TRACE("Created virtual function, pointer found at {}, signature {}", function_addr, signature_hex_string);
|
||||
|
||||
m_managed_ptrs.push_back(function);
|
||||
return function;
|
||||
@@ -72,7 +73,8 @@ ValveFunction* CreateVirtualFunction(ScriptContext& script_context)
|
||||
auto return_type = script_context.GetArgument<DataType_t>(3);
|
||||
|
||||
void** vtable = *(void***)ptr;
|
||||
if (!vtable) {
|
||||
if (!vtable)
|
||||
{
|
||||
script_context.ThrowNativeError("Failed to get the virtual function table.");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -80,7 +82,8 @@ ValveFunction* CreateVirtualFunction(ScriptContext& script_context)
|
||||
auto function_addr = (void*)vtable[vtable_offset];
|
||||
|
||||
auto args = std::vector<DataType_t>();
|
||||
for (int i = 0; i < num_arguments; i++) {
|
||||
for (int i = 0; i < num_arguments; i++)
|
||||
{
|
||||
args.push_back(script_context.GetArgument<DataType_t>(4 + i));
|
||||
}
|
||||
|
||||
@@ -97,7 +100,8 @@ void HookFunction(ScriptContext& script_context)
|
||||
auto callback = script_context.GetArgument<CallbackT>(1);
|
||||
auto post = script_context.GetArgument<bool>(2);
|
||||
|
||||
if (!function) {
|
||||
if (!function)
|
||||
{
|
||||
script_context.ThrowNativeError("Invalid function pointer");
|
||||
return;
|
||||
}
|
||||
@@ -111,7 +115,8 @@ void UnhookFunction(ScriptContext& script_context)
|
||||
auto callback = script_context.GetArgument<CallbackT>(1);
|
||||
auto post = script_context.GetArgument<bool>(2);
|
||||
|
||||
if (!function) {
|
||||
if (!function)
|
||||
{
|
||||
script_context.ThrowNativeError("Invalid function pointer");
|
||||
return;
|
||||
}
|
||||
@@ -123,7 +128,8 @@ void ExecuteVirtualFunction(ScriptContext& script_context)
|
||||
{
|
||||
auto function = script_context.GetArgument<ValveFunction*>(0);
|
||||
|
||||
if (!function) {
|
||||
if (!function)
|
||||
{
|
||||
script_context.ThrowNativeError("Invalid function pointer");
|
||||
return;
|
||||
}
|
||||
@@ -155,8 +161,7 @@ void RemoveAllNetworkVectorElements(ScriptContext& script_context)
|
||||
|
||||
REGISTER_NATIVES(memory, {
|
||||
ScriptEngine::RegisterNativeHandler("CREATE_VIRTUAL_FUNCTION", CreateVirtualFunction);
|
||||
ScriptEngine::RegisterNativeHandler("CREATE_VIRTUAL_FUNCTION_BY_SIGNATURE",
|
||||
CreateVirtualFunctionBySignature);
|
||||
ScriptEngine::RegisterNativeHandler("CREATE_VIRTUAL_FUNCTION_BY_SIGNATURE", CreateVirtualFunctionBySignature);
|
||||
ScriptEngine::RegisterNativeHandler("EXECUTE_VIRTUAL_FUNCTION", ExecuteVirtualFunction);
|
||||
ScriptEngine::RegisterNativeHandler("HOOK_FUNCTION", HookFunction);
|
||||
ScriptEngine::RegisterNativeHandler("UNHOOK_FUNCTION", UnhookFunction);
|
||||
|
||||
Reference in New Issue
Block a user