Skip to content

Commit

Permalink
document some API structs
Browse files Browse the repository at this point in the history
  • Loading branch information
rtldg committed Sep 23, 2024
1 parent bac325c commit fee7df2
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 4 deletions.
21 changes: 20 additions & 1 deletion addons/sourcemod/scripting/include/shavit/anti-sv_cheats.sp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
*
*/


// This code annoys everyone but admins would sometimes set sv_cheats 1 and then
// forget to toggle it back off when they were done playing around so then people
// would join and teleport into the endzone and set dumb times. And now we're here...
// Just add some aliases to your autoexec:
// alias cheats "sm_rcon shavit_core_disable_sv_cheats 0 ; sm_rcon sv_cheats 1"
// alias cheat "sm_rcon shavit_core_disable_sv_cheats 0 ; sm_rcon sv_cheats 1"


Convar gCV_DisableSvCheats = null;

#if !DEBUG
Expand Down Expand Up @@ -84,9 +93,19 @@ void Remove_sv_cheat_Impluses(int client, int &impulse)
#if !DEBUG
if (impulse && sv_cheats.BoolValue && !(GetUserFlagBits(client) & ADMFLAG_ROOT))
{
// Block cheat impulses
switch (impulse)
{
// Likely incomplete list of the most cheaty impulses...
// 76 = spawn npc
// 81 = something cubemap
// 82 = create jeep
// 83 = create airboat
// 102 = something node
// 195 = something node
// 196 = something node
// 197 = something node
// 202 = something bloodsplat
// 203 = remove entity
case 76, 81, 82, 83, 102, 195, 196, 197, 202, 203:
{
impulse = 0;
Expand Down
3 changes: 3 additions & 0 deletions addons/sourcemod/scripting/include/shavit/checkpoints.inc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ enum struct cp_cache_t
ArrayList aEvents;
ArrayList aOutputWaits;
float vecLadderNormal[3];
// This handle will be deleted when the checkpoint is deleted, or something like that...
// If you want to keep this (which you probably should) then you'd have
// to use StringMap.Clone() (owned clone) or CloneHandle() (shared object).
StringMap customdata;

bool m_bHasWalkMovedSinceLastJump; // csgo only
Expand Down
27 changes: 25 additions & 2 deletions addons/sourcemod/scripting/include/shavit/core.inc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

#include <shavit/bhopstats-timerified>

// status
enum TimerStatus
{
Timer_Stopped,
Expand Down Expand Up @@ -67,6 +66,7 @@ enum
{
sStyleName,
sShortName,
// Used in CSGO
sHTMLColor,
sChangeCommand,
sClanTag,
Expand Down Expand Up @@ -115,40 +115,63 @@ enum struct timer_snapshot_t
int iJumps;
int bsStyle;
int iStrafes;
// Total times we checked if a strafe was "synced".
int iTotalMeasures;
// Not actually "gains". How many times a strafe was "synced".
int iGoodGains;
// Not actually used for anything. GetEngineTime() when the snapshot was taken.
float fServerTime;
// -1 by default which means no key combination
// if a_or_d_only: 0 = IN_MOVELEFT (a), 1 = IN_MOVERIGHT (d)
// if surf hsw: 0 = WA/SD, 1 = WD/SA
int iKeyCombo;
int iTimerTrack;
// How many times we checked if the player jumped on the same tick they land.
// This is only incremented if the player jumps within 10 ticks of landing (this is just an implementation note and could change (99% won't though)).
int iMeasuredJumps;
// How many times the player jumped on the same tick they land.
int iPerfectJumps;
// used as a "tick fraction" basically
float fZoneOffset[2];
float fDistanceOffset[2];
float fAvgVelocity;
float fMaxVelocity;
float fTimescale;
int iZoneIncrement; // convert to array for per zone offsets (?)
// Internal counter used for calculating the startzone's fZoneOffset & fDistanceOffset
int iZoneIncrement;

int iFullTicks;
int iFractionalTicks; // divide this by 10000.0 to get a fraction of a tick. whole ticks are moved to iFullTicks

bool bPracticeMode;

// Internal bool for checking if the player jumped.
bool bJumped;
// If shavit_core_simplerladders == 1 & we're on a ladder then this is true so the player can use any keys when they're on SW or W-only or etc...
bool bCanUseAllKeys;
// Internal bool for checking if the player is(/was?) on the ground. Complicated...
bool bOnGround;

// Currently unused but saved because why not...
int iLastButtons;
// Internal float used for checking if the player's horizontal viewangle changed so we can do sync stuff.
float fLastAngle;

// Internal int used for the iMeasuredJumps & iPerfectJumps stuff.
int iLandingTick;
// Internal value used for unfucking style/zone gravity when using ladders.
MoveType iLastMoveType;
// Internal value used for blocking +strafe (if block_pstrafe is enabled).
float fStrafeWarning;
// Internal values used for incrementing strafe count.
float fLastInputVel[2];

// Internal value used for unfucking m_flLaggedMovementValue from player_speedmod's when combined with style settings such as "timescale" and "speed".
float fplayer_speedmod;
// Internal value used for timescaling and recording frames and stuff....
float fNextFrameTime;

// Internal value used for timescaling and stuff....
MoveType iLastMoveTypeTAS;
}

Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/include/shavit/zones.inc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ enum
{
ZF_ForceRender = (1 << 0),
ZF_Hammerid = (1 << 1), // used by ZoneForm_{trigger_{multiple, teleport}, func_button} sometimes
ZF_Solid = (1 << 2), // forces the zone to block people...
ZF_Solid = (1 << 2), // forces the zone to physically block people...
ZF_Origin = (1 << 4), // sTarget is the entity's origin formatted as "%X %X %X"
};

Expand Down

0 comments on commit fee7df2

Please sign in to comment.