Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for tf2c/of #119

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
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
4 changes: 3 additions & 1 deletion .github/workflows/blank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ jobs:
run: |
cd ./scripting
pwd
spcomp -i"./include/" stac.sp -o ../plugins/stac.smx
spcomp -i"./include/" stac.sp -o ../plugins/stac.smx
spcomp TF2C=yep -i"./include/" stac.sp -o ../plugins/disabled/stac_tf2c.smx
spcomp OF=yep -i"./include/" stac.sp -o ../plugins/disabled/stac_of.smx
ls -la

- name: Zip packages
Expand Down
Binary file added plugins/disabled/stac_of.smx
Binary file not shown.
Binary file added plugins/disabled/stac_tf2c.smx
Binary file not shown.
Binary file modified plugins/stac.smx
Binary file not shown.
998 changes: 998 additions & 0 deletions scripting/include/openfortress.inc

Large diffs are not rendered by default.

858 changes: 858 additions & 0 deletions scripting/include/tf2c.inc

Large diffs are not rendered by default.

24 changes: 20 additions & 4 deletions scripting/stac.sp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@
#pragma semicolon 1
#pragma newdecls required

// #define TF2C
// #define OF

#include <sourcemod>
#include <regex>
#include <sdktools>
#include <sdkhooks>
#include <tf2_stocks>
#if defined TF2C
#include <tf2c>
#elseif defined OF
#include <openfortress>
#else
#include <tf2_stocks>
#endif

// external incs
#include <achievements>
#include <morecolors>
Expand All @@ -27,9 +37,15 @@
#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_VERSION "5.4.1"
#define PLUGIN_VERSION "5.5.0"

#define UPDATE_URL "https://raw.githubusercontent.com/sapphonie/StAC-tf2/master/updatefile.txt"
#if defined TF2C
#define UPDATE_URL "https://raw.githubusercontent.com/sapphonie/StAC-tf2/master/updatefile_tf2c.txt"
#elseif defined OF
#define UPDATE_URL "https://raw.githubusercontent.com/sapphonie/StAC-tf2/master/updatefile_of.txt"
#else
#define UPDATE_URL "https://raw.githubusercontent.com/sapphonie/StAC-tf2/master/updatefile.txt"
#endif

public Plugin myinfo =
{
Expand Down Expand Up @@ -78,7 +94,7 @@ public void OnPluginStart()

if (MaxClients > TFMAXPLAYERS)
{
SetFailState("[StAC] This plugin (and TF2 in general) does not support more than 33 players (32 + 1 for STV). Aborting!");
SetFailState("[StAC] This plugin (and TF2 in general) does not support more than %i players. Aborting!", TFMAXPLAYERS);
}

LoadTranslations("common.phrases");
Expand Down
11 changes: 11 additions & 0 deletions scripting/stac/stac_cvar_checks.sp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ char miscVars[][] =
"snd_visualize",
// must be == 1
"fog_enable",
#if !defined OF
// must be == 0
"cl_thirdperson",
#endif
// must be == 0
"r_portalsopenall",
// must be == 1.0
Expand Down Expand Up @@ -143,7 +145,14 @@ public void ConVarCheck(QueryCookie cookie, int Cl, ConVarQueryResult result, co
{
int fovDesired = StringToInt(cvarValue);
// check just in case

// of max fov is 160
#if defined OF
if (fovDesired < 20 || fovDesired > 160)
// tf2 max fov is 90
#else
if (fovDesired < 20 || fovDesired > 90)
#endif
{
oobVarsNotify(userid, cvarName, cvarValue);
if (banForMiscCheats)
Expand Down Expand Up @@ -224,6 +233,7 @@ public void ConVarCheck(QueryCookie cookie, int Cl, ConVarQueryResult result, co
}
}

#if !defined OF
// cl_thirdperson (hidden cvar! should NEVER not be 0)
// used for enabling thirdperson
else if (StrEqual(cvarName, "cl_thirdperson"))
Expand All @@ -237,6 +247,7 @@ public void ConVarCheck(QueryCookie cookie, int Cl, ConVarQueryResult result, co
}
}
}
#endif

// r_portalsopenall (cheat cvar! should NEVER not be 0)
// used for disabling areaportal checks, so you can see the entire world at once. essentially "far esp"
Expand Down
3 changes: 3 additions & 0 deletions scripting/stac/stac_cvars.sp
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,8 @@ void RunOptimizeCvars()
// limit fakelag abuse / backtracking (CS:GO default value!)
SetConVarFloat(FindConVar("sv_maxunlag"), 0.2);

// these cvars don't exist outside of tf2 (atm)
#if !defined OF && !defined TF2C
// print dc reasons to clients
SetConVarBool(FindConVar("net_disconnect_reason"), true);

Expand All @@ -666,6 +668,7 @@ void RunOptimizeCvars()
{
SetConVarInt(net_chan_limit_msec, 75);
}
#endif

// fix backtracking
ConVar jay_backtrack_enable = FindConVar("jay_backtrack_enable");
Expand Down
8 changes: 6 additions & 2 deletions scripting/stac/stac_globals.sp
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#pragma semicolon 1

// we don't need 64 maxplayers because this is only for tf2. saves some memory.
#define TFMAXPLAYERS 33
#if defined TF2C
#define TFMAXPLAYERS 65
#else
#define TFMAXPLAYERS 33
#endif


/********** GLOBAL VARS **********/

Expand Down
6 changes: 5 additions & 1 deletion scripting/stac/stac_mapchange.sp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ Action checkNativesEtc(Handle timer)
{
waitStatus = true;
}

#if defined OF
MVM = false;
#else
// are we in mann vs machine?
if (GameRules_GetProp("m_bPlayingMannVsMachine") == 1)
{
Expand All @@ -66,7 +70,7 @@ Action checkNativesEtc(Handle timer)
{
MVM = false;
}

#endif
// check natives!

// sourcebans
Expand Down
7 changes: 7 additions & 0 deletions scripting/stac/stac_onplayerruncmd.sp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,14 @@ void cmdnumspikeCheck(int userid)
{
int spikeamt = clcmdnum[Cl][0] - clcmdnum[Cl][1];
// https://github.com/sapphonie/StAC-tf2/issues/74

// clients in OF can trigger this by lagging, hackers tend to hit ~1000
// -rowedahelicon
#if defined OF
if (spikeamt >= 999 || spikeamt < 0)
#else
if (spikeamt >= 32 || spikeamt < 0)
#endif
{
char heldWeapon[256];
GetClientWeapon(Cl, heldWeapon, sizeof(heldWeapon));
Expand Down