Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ set(SOURCE_FILES
src/core/cs2_sdk/interfaces/cgameresourceserviceserver.h
src/core/cs2_sdk/interfaces/cs2_interfaces.h
src/core/cs2_sdk/interfaces/cs2_interfaces.cpp
src/core/cs2_sdk/interfaces/navphysicsinterface.h
src/core/cs2_sdk/interfaces/navphysicsinterface.cpp
src/core/cs2_sdk/schema.h
src/core/cs2_sdk/schema.cpp
src/core/function.cpp
Expand All @@ -107,6 +109,7 @@ set(SOURCE_FILES
src/core/managers/voice_manager.h
src/core/managers/usermessage_manager.cpp
src/core/managers/usermessage_manager.h
src/scripting/natives/natives_raytrace.cpp
src/scripting/natives/natives_dynamichooks.cpp
src/core/game_system.h
src/core/game_system.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ public class EventPlayerDisconnect : GameEvent
{
public EventPlayerDisconnect(IntPtr pointer) : base(pointer){}
public EventPlayerDisconnect(bool force) : base("player_disconnect", force){}
// player name
// Was the player ever fully connected?
public bool EverFullyConnected
{
get => Get<bool>("ever_fully_connected");
set => Set<bool>("ever_fully_connected", value);
}
// player name
public string Name
{
get => Get<string>("name");
Expand Down
127 changes: 107 additions & 20 deletions managed/CounterStrikeSharp.API/Generated/Natives/API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,113 @@ public static IntPtr MetaFactory(string interfacename){
}
}

public static void TraceShape(IntPtr startpos, IntPtr angles, IntPtr ignoreentity, ulong interactsas, ulong interactswith, ulong interactsexclude, IntPtr outresult){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.PushPrimitive(startpos);
ScriptContext.GlobalScriptContext.PushPrimitive(angles);
ScriptContext.GlobalScriptContext.PushPrimitive(ignoreentity);
ScriptContext.GlobalScriptContext.PushPrimitive(interactsas);
ScriptContext.GlobalScriptContext.PushPrimitive(interactswith);
ScriptContext.GlobalScriptContext.PushPrimitive(interactsexclude);
ScriptContext.GlobalScriptContext.PushPrimitive(outresult);
ScriptContext.GlobalScriptContext.SetIdentifier(0xDBED3874);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
}
}

public static void TraceEndShape(IntPtr startpos, IntPtr endpos, IntPtr ignoreentity, ulong interactsas, ulong interactswith, ulong interactsexclude, IntPtr outresult){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.PushPrimitive(startpos);
ScriptContext.GlobalScriptContext.PushPrimitive(endpos);
ScriptContext.GlobalScriptContext.PushPrimitive(ignoreentity);
ScriptContext.GlobalScriptContext.PushPrimitive(interactsas);
ScriptContext.GlobalScriptContext.PushPrimitive(interactswith);
ScriptContext.GlobalScriptContext.PushPrimitive(interactsexclude);
ScriptContext.GlobalScriptContext.PushPrimitive(outresult);
ScriptContext.GlobalScriptContext.SetIdentifier(0x8A833D84);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
}
}

public static void TraceHullShape(IntPtr startpos, IntPtr endpos, IntPtr mins, IntPtr maxs, IntPtr ignoreentity, ulong interactsas, ulong interactswith, ulong interactsexclude, IntPtr outresult){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.PushPrimitive(startpos);
ScriptContext.GlobalScriptContext.PushPrimitive(endpos);
ScriptContext.GlobalScriptContext.PushPrimitive(mins);
ScriptContext.GlobalScriptContext.PushPrimitive(maxs);
ScriptContext.GlobalScriptContext.PushPrimitive(ignoreentity);
ScriptContext.GlobalScriptContext.PushPrimitive(interactsas);
ScriptContext.GlobalScriptContext.PushPrimitive(interactswith);
ScriptContext.GlobalScriptContext.PushPrimitive(interactsexclude);
ScriptContext.GlobalScriptContext.PushPrimitive(outresult);
ScriptContext.GlobalScriptContext.SetIdentifier(0x6C62B676);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
}
}

public static ulong PointContents(IntPtr pos, ulong contentsmask){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.PushPrimitive(pos);
ScriptContext.GlobalScriptContext.PushPrimitive(contentsmask);
ScriptContext.GlobalScriptContext.SetIdentifier(0x8A68FFAC);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
return ScriptContext.GlobalScriptContext.GetResultPrimitive<ulong>();
}
}

public static bool CheckAreaOverlappingEntity(IntPtr area, IntPtr entity, bool extrudehullheight){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.PushPrimitive(area);
ScriptContext.GlobalScriptContext.PushPrimitive(entity);
ScriptContext.GlobalScriptContext.PushPrimitive(extrudehullheight);
ScriptContext.GlobalScriptContext.SetIdentifier(0x2ACFC3F3);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
return ScriptContext.GlobalScriptContext.GetResultPrimitive<bool>();
}
}

public static void GetEntityWorldSpaceAabb(IntPtr entity, IntPtr minsout, IntPtr maxsout){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.PushPrimitive(entity);
ScriptContext.GlobalScriptContext.PushPrimitive(minsout);
ScriptContext.GlobalScriptContext.PushPrimitive(maxsout);
ScriptContext.GlobalScriptContext.SetIdentifier(0x6C485DCE);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
}
}

public static IntPtr GetEconItemSystem(){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.SetIdentifier(0x981E9B5B);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
return ScriptContext.GlobalScriptContext.GetResultPrimitive<IntPtr>();
}
}

public static bool IsServerPaused(){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.SetIdentifier(0xB216AAAC);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
return ScriptContext.GlobalScriptContext.GetResultPrimitive<bool>();
}
}

public static short GetSchemaOffset(string classname, string propname){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
Expand Down Expand Up @@ -1692,26 +1799,6 @@ public static void SchemaNetworkStateChanged(IntPtr instance, uint offset, uint
}
}

public static IntPtr GetEconItemSystem(){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.SetIdentifier(0x981E9B5B);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
return ScriptContext.GlobalScriptContext.GetResultPrimitive<IntPtr>();
}
}

public static bool IsServerPaused(){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.SetIdentifier(0xB216AAAC);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
return ScriptContext.GlobalScriptContext.GetResultPrimitive<bool>();
}
}

Comment on lines -1695 to -1714

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these do still exist in the yaml so next code gen would re add these, what was the point of this removal?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like they've just been moved? I'm assuming the generator may have done this? If not they should probably be moved back

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've regenerated whole API.cs using CodeGen, basically I removed everything and ran CodeGen to have up-to-date methods

public static IntPtr CreateTimer(float interval, InputArgument callback, int flags){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
Expand Down
134 changes: 134 additions & 0 deletions managed/CounterStrikeSharp.API/Modules/Utils/Contents.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*
* 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/>.
*/

namespace CounterStrikeSharp.API.Modules.Utils;

/// <summary>
/// Contents flags for physics interaction layers (bspflags.h / const.h).
/// Used with <see cref="TraceOptions"/> and <see cref="Trace.PointContents"/>.
/// </summary>
[Flags]
public enum Contents : ulong
{
Empty = 0ul,

Solid = 1ul << 0,
Hitbox = 1ul << 1,
Trigger = 1ul << 2,
Sky = 1ul << 3,

PlayerClip = 1ul << 4,
NpcClip = 1ul << 5,
BlockLos = 1ul << 6,
BlockLight = 1ul << 7,
Ladder = 1ul << 8,
Pickup = 1ul << 9,
BlockSound = 1ul << 10,
NoDraw = 1ul << 11,
Window = 1ul << 12,
PassBullets = 1ul << 13,
WorldGeometry = 1ul << 14,
Water = 1ul << 15,
Slime = 1ul << 16,
TouchAll = 1ul << 17,
Player = 1ul << 18,
Npc = 1ul << 19,
Debris = 1ul << 20,
PhysicsProp = 1ul << 21,
NavIgnore = 1ul << 22,
NavLocalIgnore = 1ul << 23,
PostProcessingVolume = 1ul << 24,
UnusedLayer3 = 1ul << 25,
CarriedObject = 1ul << 26,
Pushaway = 1ul << 27,
ServerEntityOnClient = 1ul << 28,
CarriedWeapon = 1ul << 29,
StaticLevel = 1ul << 30,

CsgoTeam1 = 1ul << 31,
CsgoTeam2 = 1ul << 32,
CsgoGrenadeClip = 1ul << 33,
CsgoDroneClip = 1ul << 34,
CsgoMoveable = 1ul << 35,
CsgoOpaque = 1ul << 36,
CsgoMonster = 1ul << 37,
CsgoUnusedLayer = 1ul << 38,
CsgoThrownGrenade = 1ul << 39,
}

/// <summary>
/// Composite trace masks (bspflags.h MASK_* defines).
/// </summary>
public static class Masks
{
public const Contents All = (Contents)~0ul;

/// <summary>Everything that is normally solid.</summary>
public const Contents Solid = Contents.Solid | Contents.Window | Contents.Player | Contents.Npc |
Contents.PassBullets;

/// <summary>Everything that blocks player movement.</summary>
public const Contents PlayerSolid =
Contents.Solid | Contents.PlayerClip | Contents.Window | Contents.Player | Contents.Npc |
Contents.PassBullets;

/// <summary>Blocks NPC movement.</summary>
public const Contents NpcSolid =
Contents.Solid | Contents.NpcClip | Contents.Window | Contents.Player | Contents.Npc |
Contents.PassBullets;

/// <summary>Blocks fluid movement.</summary>
public const Contents NpcFluid =
Contents.Solid | Contents.NpcClip | Contents.Window | Contents.Player | Contents.Npc;

/// <summary>Water physics.</summary>
public const Contents Water = Contents.Water | Contents.Slime;

/// <summary>Bullets see these as solid.</summary>
public const Contents Shot = Contents.Solid | Contents.Player | Contents.Npc | Contents.Window |
Contents.Debris | Contents.Hitbox;

/// <summary>Bullets see these as solid, except monsters (world + brush only).</summary>
public const Contents ShotBrushOnly = Contents.Solid | Contents.Window | Contents.Debris;

/// <summary>Non-raycasted weapons see this as solid (includes grates).</summary>
public const Contents ShotHull =
Contents.Solid | Contents.Player | Contents.Npc | Contents.Window | Contents.Debris |
Contents.PassBullets;

/// <summary>Hits solids (not grates) and passes through everything else.</summary>
public const Contents ShotPortal = Contents.Solid | Contents.Window | Contents.Player | Contents.Npc;

/// <summary>Everything normally solid, except monsters (world + brush only).</summary>
public const Contents SolidBrushOnly = Contents.Solid | Contents.Window | Contents.PassBullets;

/// <summary>Everything normally solid for player movement, except monsters (world + brush only).</summary>
public const Contents PlayerSolidBrushOnly =
Contents.Solid | Contents.Window | Contents.PlayerClip | Contents.PassBullets;

/// <summary>Everything normally solid for NPC movement, except monsters (world + brush only).</summary>
public const Contents NpcSolidBrushOnly =
Contents.Solid | Contents.Window | Contents.NpcClip | Contents.PassBullets;
}

public enum RayType_t : uint
{
RAY_TYPE_LINE = 0x0,
RAY_TYPE_SPHERE = 0x1,
RAY_TYPE_HULL = 0x2,
RAY_TYPE_CAPSULE = 0x3,
RAY_TYPE_MESH = 0x4
};
Loading
Loading