Skip to content

Commit

Permalink
Remove old code (#380)
Browse files Browse the repository at this point in the history
* Remove pushfix

* Remove slopefix

* Update README.md - Installation and Requirements
  • Loading branch information
t5mat authored Jan 25, 2022
1 parent a29d003 commit 75cee57
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 359 deletions.
53 changes: 29 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,41 @@ Yes, but not any more than other projects currently and for past years.
- That means you won't delete any pre-entered questions!
- Give clear and as precise information as you can
- If applicable include related logs / configs (posted to [pastebin](https://pastebin.com/))
- Don't edit issues
- Don't edit issues
- Always write a new comment below!

## Installation and Requirements
* [SourceMod 1.10](https://www.sourcemod.net/downloads.php?branch=stable)

* [Metamod 1.10](https://www.sourcemm.net/downloads.php/?branch=stable)
* [SourceMod-Discord API](https://github.com/Deathknife/sourcemod-discord)
* [SourceMod 1.10](https://www.sourcemod.net/downloads.php?branch=stable) (only the latest stable version is supported)
* A MySQL Database (MySQL 5.7, MySQL 8+, MariaDB supported)
* *(recommended)* [Stripper:Source](http://www.bailopan.net/stripper/) - Allows adding/modifying/removing entities from a map before it loads (config files included)

<sup>(We only support the latest stable version of Sourcemod.)</sup>

**Extensions:**
* [DHooks](https://github.com/peace-maker/DHooks2/releases/latest)
**SourceMod Extensions**
* [DHooks](https://github.com/peace-maker/DHooks2)
* [SMJansson](https://forums.alliedmods.net/showthread.php?t=184604)
* [SteamWorks](https://forums.alliedmods.net/showthread.php?t=229556)
* *(recommended)* [Cleaner](https://github.com/Accelerator74/Cleaner) - Suppresses server console warnings

**Compilation Requirements (Includes):**
* [SourceMod Includes](https://www.sourcemod.net/downloads.php?branch=stable)
**SourceMod Libraries**
* [SMLib](https://github.com/bcserv/smlib/tree/transitional_syntax)
* [ColorLib](https://github.com/c0rp3n/colorlib-sm/blob/master/addons/sourcemod/scripting/include/colorlib.inc)
* [AutoExecConfig](https://github.com/Impact123/AutoExecConfig/blob/development/autoexecconfig.inc)
* [ColorLib](https://github.com/c0rp3n/colorlib-sm)
* [AutoExecConfig](https://github.com/Impact123/AutoExecConfig)
* [SourceMod-Discord API](https://github.com/Deathknife/sourcemod-discord)

**Recommended:**
* [Cleaner Extension](https://github.com/Accelerator74/Cleaner) (Suppresses console warnings)
* [Stripper:Source](https://forums.alliedmods.net/showthread.php?t=39439) (Allows you to add/modify/removes entities from maps, recommended filter file included)
**SourceMod Plugins**
* *(recommended)* [Movement Unlocker](https://forums.alliedmods.net/showthread.php?t=255298) - Enables ground sliding
* *(recommended)* [MomSurfFix](https://github.com/GAMMACASE/MomSurfFix) - Fixes ramp glitches
* *(recommended)* [RNGFix](https://github.com/jason-e/rngfix) - Fixes a bunch of engine physics "bugs"
* *(recommended)* [End-Touch-Fix](https://github.com/rumourA/End-Touch-Fix) - Checks EntityUntouch on PostThink instead of server frames
* *(recommended)* [HeadBugFix](https://github.com/GAMMACASE/HeadBugFix) - Fixes the head boundary box poping up when you start ducking
* *(recommended)* [PushFixDE](https://github.com/GAMMACASE/PushFixDE) - Fixes client prediction errors in push triggers
* *(recommended)* [crouchboostfix](https://github.com/t5mat/crouchboostfix) - Prevents crouchboosting
* *(recommended)* [Normalized-Run-Speed](https://github.com/sneak-it/Normalized-Run-Speed) - Normalizes players run speed across all weapons
* *(optional)* [Surftimer-Discord](https://github.com/Sarrus1/SurfTimer-discord) - Discord WR notifications

**Optional:**
* [Surftimer-Web-Stats](https://github.com/KristianP26/Surftimer-Web-Stats) - Web Statistics
* [Surftimer-Discord](https://github.com/Sarrus1/SurfTimer-discord/releases/latest) - Discord Record Notifications
**Misc**
* *(optional)* [Surftimer-Web-Stats](https://github.com/KristianP26/Surftimer-Web-Stats) - Web statistics

## Issue Rules

Expand Down Expand Up @@ -103,8 +109,8 @@ Yes, but not any more than other projects currently and for past years.

## Point System
<details>
<summary>Explanation</summary>
<summary>Explanation</summary>

The points system has seen a massive overhaul from the original ckSurf; it is now a percentile tiered system. Points are now distributed in two ways: (1) map completion, and (2) map ranking. Map completion points will be given to all players who complete a specific and are dependent on the tier.
* Tier 1: 25
* Tier 2: 50
Expand Down Expand Up @@ -147,7 +153,7 @@ Take surf_aircontrol_nbv for example: (You can use sm_mi to see this menu)
<img src="http://puu.sh/ykaR8/7520a6b0d6.jpg" width="372" height="469" />

###### Credit to NDiamond for theory crafting this point system, I just implemented his idea

</details>

## Credits
Expand All @@ -157,18 +163,17 @@ Extensions used in this version:
* [Discord API](https://github.com/Deathknife/sourcemod-discord) (Deathknife)
* [Trails Chroma](https://github.com/Nickelony/Trails-Chroma) (Nickelony)
<details>
<summary>forked from fluffys - contributors</summary>
<summary>forked from fluffys - contributors</summary>

* Jonitaikaponi - Original ckSurf creator
* sneaK
* nikooo777 - ckSurf 1.19 Fork
* fluffys
* Jakeey802
* Grandpa Goose

</details>

* [Ace](https://github.com/13ace37) [xace.ch](https://xace.ch)
* [olokos](https://github.com/olokos) [Steam](https://steamcommunity.com/id/olokos/) [My server](https://kiepownica.pl/)
* and many, many more people who contributed to the project!

24 changes: 0 additions & 24 deletions addons/sourcemod/scripting/SurfTimer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ float g_fZoneCorners[MAXZONES][8][3];
/*---------- AntiJump & AntiDuck Variables ----------*/
bool g_bInDuck[MAXPLAYERS + 1] = {false, ...};
bool g_bInJump[MAXPLAYERS + 1] = {false, ...};
bool g_bInPushTrigger[MAXPLAYERS + 1] = {false, ...};
bool g_bJumpZoneTimer[MAXPLAYERS + 1] = {false, ...};
bool g_bInStartZone[MAXPLAYERS + 1] = {false, ...};
bool g_bInStageZone[MAXPLAYERS + 1];
Expand Down Expand Up @@ -684,20 +683,6 @@ char g_szZoneDefaultNames[ZONEAMOUNT][128] = { "Stop", "Start", "End", "Stage",
int g_BeamSprite;
int g_HaloSprite;

/*---------- PushFix by Mev, George & Blacky ----------*/
// https://forums.alliedmods.net/showthread.php?t=267131
ConVar g_hTriggerPushFixEnable;
bool g_bPushing[MAXPLAYERS + 1];

/*---------- Slope Boost Fix by Mev & Blacky ----------*/
// https://forums.alliedmods.net/showthread.php?t=266888
float g_vCurrent[MAXPLAYERS + 1][3];
float g_vLast[MAXPLAYERS + 1][3];
bool g_bOnGround[MAXPLAYERS + 1];
bool g_bLastOnGround[MAXPLAYERS + 1];
bool g_bFixingRamp[MAXPLAYERS + 1];
ConVar g_hSlopeFixEnable;

/*---------- Forwards ----------*/
GlobalForward g_MapFinishForward;
GlobalForward g_MapCheckpointForward;
Expand Down Expand Up @@ -1767,15 +1752,6 @@ public void OnMapStart()

int iEnt;

// PushFix by Mev, George, & Blacky
// https://forums.alliedmods.net/showthread.php?t=267131
iEnt = -1;
while ((iEnt = FindEntityByClassname(iEnt, "trigger_push")) != -1)
{
SDKHook(iEnt, SDKHook_Touch, OnTouchPushTrigger);
SDKHook(iEnt, SDKHook_EndTouch, OnEndTouchPushTrigger);
}

// Trigger Gravity Fix
iEnt = -1;
while ((iEnt = FindEntityByClassname(iEnt, "trigger_gravity")) != -1)
Expand Down
2 changes: 0 additions & 2 deletions addons/sourcemod/scripting/surftimer/convars.sp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ void CreateConVars()
g_henableChatProcessing = AutoExecConfig_CreateConVar("ck_chat_enable", "1", "(1 / 0) Enable or disable SurfTimers chat processing.", FCVAR_NOTIFY);
g_hMultiServerMapcycle = AutoExecConfig_CreateConVar("ck_multi_server_mapcycle", "0", "0 = Use mapcycle.txt to load servers maps, 1 = use configs/surftimer/multi_server_mapcycle.txt to load maps", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_hDBMapcycle = AutoExecConfig_CreateConVar("ck_db_mapcycle", "1", "0 = use non-db map cycles, 1 use maps from ck_maptier", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_hTriggerPushFixEnable = AutoExecConfig_CreateConVar("ck_triggerpushfix_enable", "1", "Enables trigger push fix.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_hSlopeFixEnable = AutoExecConfig_CreateConVar("ck_slopefix_enable", "1", "Enables slope fix.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_hDoubleRestartCommand = AutoExecConfig_CreateConVar("ck_double_restart_command", "1", "(1 / 0) Requires 2 successive !r commands to restart the player to prevent accidental usage.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_hBackupReplays = AutoExecConfig_CreateConVar("ck_replay_backup", "1", "(1 / 0) Back up replay files, when they are being replaced", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_hReplaceReplayTime = AutoExecConfig_CreateConVar("ck_replay_replace_faster", "1", "(1 / 0) Replace record bots if a players time is faster than the bot, even if the time is not a server record.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
Expand Down
189 changes: 3 additions & 186 deletions addons/sourcemod/scripting/surftimer/hooks.sp
Original file line number Diff line number Diff line change
Expand Up @@ -674,15 +674,6 @@ public Action Event_OnRoundStart(Handle event, const char[] name, bool dontBroad

db_viewMapSettings();

// PushFix by Mev, George, & Blacky
// https://forums.alliedmods.net/showthread.php?t=267131
iEnt = -1;
while ((iEnt = FindEntityByClassname(iEnt, "trigger_push")) != -1)
{
SDKHook(iEnt, SDKHook_Touch, OnTouchPushTrigger);
SDKHook(iEnt, SDKHook_EndTouch, OnEndTouchPushTrigger);
}

// fluffys gravity
iEnt = -1;
while ((iEnt = FindEntityByClassname(iEnt, "trigger_gravity")) != -1)
Expand Down Expand Up @@ -777,50 +768,6 @@ public Action OnEndTouchAllTriggers(int entity, int other)
return Plugin_Continue;
}

// PushFix by Mev, George, & Blacky
// https://forums.alliedmods.net/showthread.php?t=267131
public Action OnTouchPushTrigger(int entity, int other)
{
if (IsValidClient(other) && GetConVarBool(g_hTriggerPushFixEnable) == true)
{
if (IsFakeClient(other))
return Plugin_Handled;

// fluffys
g_bInPushTrigger[other] = true;

if (IsValidEntity(entity))
{
float m_vecPushDir[3];
GetEntPropVector(entity, Prop_Data, "m_vecPushDir", m_vecPushDir);
if (m_vecPushDir[2] == 0.0)
return Plugin_Continue;
else
DoPush(entity, other, m_vecPushDir);
}
return Plugin_Handled;
}

return Plugin_Continue;
}

public Action OnEndTouchPushTrigger(int entity, int other)
{
if (IsValidClient(other) && GetConVarBool(g_hTriggerPushFixEnable) == true)
{
if (IsFakeClient(other))
return Plugin_Handled;

if (IsValidEntity(entity))
{
g_bInPushTrigger[other] = false;
}
return Plugin_Handled;
}

return Plugin_Continue;
}

public Action OnEndTouchGravityTrigger(int entity, int other)
{
if (IsValidClient(other) && !IsFakeClient(other))
Expand Down Expand Up @@ -882,16 +829,10 @@ public Action OnLogAction(Handle source, Identity ident, int client, int target,

public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
{

if (buttons & IN_DUCK && g_bInDuck[client] == true)
{
CPrintToChat(client, "%t", "Hooks11", g_szChatPrefix);
}
else if (buttons & IN_DUCK && g_bInPushTrigger[client] == true)
{
buttons &= ~IN_DUCK;
g_bInPushTrigger[client] = false;
}
else if (g_bInMaxSpeed[client])
{
if (g_iClientInZone[client][3] >= 0)
Expand Down Expand Up @@ -1043,125 +984,13 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3

if (IsPlayerAlive(client))
{
g_bLastOnGround[client] = g_bOnGround[client];
if (GetEntityFlags(client) & FL_ONGROUND)
g_bOnGround[client] = true;
else
g_bOnGround[client] = false;

float newVelocity[3];
// Slope Boost Fix by Mev, & Blacky
// https://forums.alliedmods.net/showthread.php?t=266888
if (GetConVarBool(g_hSlopeFixEnable) == true && !IsFakeClient(client))
{
g_vLast[client][0] = g_vCurrent[client][0];
g_vLast[client][1] = g_vCurrent[client][1];
g_vLast[client][2] = g_vCurrent[client][2];
g_vCurrent[client][0] = GetEntPropFloat(client, Prop_Send, "m_vecVelocity[0]");
g_vCurrent[client][1] = GetEntPropFloat(client, Prop_Send, "m_vecVelocity[1]");
g_vCurrent[client][2] = GetEntPropFloat(client, Prop_Send, "m_vecVelocity[2]");

// Check if player landed on the ground
if (g_bOnGround[client] == true && g_bLastOnGround[client] == false)
{
// Set up and do tracehull to find out if the player landed on a slope
float vPos[3];
GetEntPropVector(client, Prop_Data, "m_vecOrigin", vPos);

float vMins[3];
GetEntPropVector(client, Prop_Send, "m_vecMins", vMins);

float vMaxs[3];
GetEntPropVector(client, Prop_Send, "m_vecMaxs", vMaxs);

float vEndPos[3];
vEndPos[0] = vPos[0];
vEndPos[1] = vPos[1];
vEndPos[2] = vPos[2] - FindConVar("sv_maxvelocity").FloatValue;

TR_TraceHullFilter(vPos, vEndPos, vMins, vMaxs, MASK_PLAYERSOLID_BRUSHONLY, TraceRayDontHitSelf, client);

if (TR_DidHit())
{
// Gets the normal vector of the surface under the player
float vPlane[3], vLast[3];
TR_GetPlaneNormal(INVALID_HANDLE, vPlane);

// Make sure it's not flat ground and not a surf ramp (1.0 = flat ground, < 0.7 = surf ramp)
if (0.7 <= vPlane[2] < 1.0)
{
/*
Copy the ClipVelocity function from sdk2013
(https://mxr.alliedmods.net/hl2sdk-sdk2013/source/game/shared/gamemovement.cpp#3145)
With some minor changes to make it actually work
*/
vLast[0] = g_vLast[client][0];
vLast[1] = g_vLast[client][1];
vLast[2] = g_vLast[client][2];
vLast[2] -= (FindConVar("sv_gravity").FloatValue * GetTickInterval() * 0.5);

float fBackOff = GetVectorDotProduct(vLast, vPlane);

float change, vVel[3];
for (int i; i < 2; i++)
{
change = vPlane[i] * fBackOff;
vVel[i] = vLast[i] - change;
}

float fAdjust = GetVectorDotProduct(vVel, vPlane);
if (fAdjust < 0.0)
{
for (int i; i < 2; i++)
{
vVel[i] -= (vPlane[i] * fAdjust);
}
}

vVel[2] = 0.0;
vLast[2] = 0.0;

// Make sure the player is going down a ramp by checking if they actually will gain speed from the boost
if (GetVectorLength(vVel) > GetVectorLength(vLast))
{
// Teleport the player, also adds basevelocity
if (GetEntityFlags(client) & FL_BASEVELOCITY)
{
float vBase[3];
GetEntPropVector(client, Prop_Data, "m_vecBaseVelocity", vBase);

AddVectors(vVel, vBase, vVel);
}
g_bFixingRamp[client] = true;
Array_Copy(vVel, newVelocity, 3);
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vVel);
}
}
}
}
}

if (newVelocity[0] == 0.0 && newVelocity[1] == 0.0 && newVelocity[2] == 0.0)
if (IsFakeClient(client))
{
if (IsFakeClient(client))
{
PlayReplay(client, buttons, subtype, seed, impulse, weapon, angles, vel);
}
else
{
RecordReplay(client, buttons, subtype, seed, impulse, weapon, angles, vel);
}
PlayReplay(client, buttons, subtype, seed, impulse, weapon, angles, vel);
}
else
{
if (IsFakeClient(client))
{
PlayReplay(client, buttons, subtype, seed, impulse, weapon, angles, newVelocity);
}
else
{
RecordReplay(client, buttons, subtype, seed, impulse, weapon, angles, vel);
}
RecordReplay(client, buttons, subtype, seed, impulse, weapon, angles, vel);
}

// Strafe Sync taken from shavit's bhoptimer
Expand Down Expand Up @@ -1280,18 +1109,6 @@ public MRESReturn DHooks_OnTeleport(int client, Handle hParams)
if (!IsValidClient(client))
return MRES_Ignored;

if (g_bPushing[client])
{
g_bPushing[client] = false;
return MRES_Ignored;
}

if (g_bFixingRamp[client])
{
g_bFixingRamp[client] = false;
return MRES_Ignored;
}

// This one is currently mimicing something.
if (g_aReplayFrame[client] != null)
{
Expand Down
Loading

0 comments on commit 75cee57

Please sign in to comment.