Skip to content

Commit

Permalink
Confoglcompmod: Hotfix for tank going out of bounds (#552)
Browse files Browse the repository at this point in the history
* Confoglcompmod: Hotfix for tank going out of bounds

* Confoglcompmod: Small oversight

`BS_bExpectTankSpawn` always becomes true whenever `L4D_OnSpawnTank` triggers.
  • Loading branch information
jensewe authored Oct 24, 2022
1 parent ee53372 commit 5f553ac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
Binary file modified addons/sourcemod/plugins/confoglcompmod.smx
Binary file not shown.
4 changes: 2 additions & 2 deletions addons/sourcemod/scripting/confoglcompmod.sp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define DEBUG_ALL 0

#define PLUGIN_VERSION "2.3.1"
#define PLUGIN_VERSION "2.3.2"

// Using these macros, you can disable unnecessary modules,
// and they will not be included in the plugin at compile time,
Expand Down Expand Up @@ -414,7 +414,7 @@ public Action L4D_OnSpawnTank(const float vector[3], const float qangle[3])
public void L4D_OnSpawnTank_Post(int client, const float vecPos[3], const float vecAng[3])
{
//Modules
BS_OnTankSpawnPost_Forward(); //BossSpawning
BS_OnTankSpawnPost_Forward(client); //BossSpawning
}
#endif

Expand Down
23 changes: 2 additions & 21 deletions addons/sourcemod/scripting/confoglcompmod/BossSpawning.sp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ static bool
BS_bEnabled = true,
BS_bIsFirstRound = true,
BS_bDeleteWitches = false,
BS_bFinaleStarted = false,
BS_bExpectTankSpawn = false;
BS_bFinaleStarted = false;

static int
BS_iTankCount[ROUND_MAX_COUNT] = {0, ...},
Expand All @@ -38,7 +37,6 @@ void BS_OnModuleStart()
BS_bEnabled = BS_hEnabled.BoolValue;
BS_hEnabled.AddChangeHook(BS_ConVarChange);

HookEvent("tank_spawn", BS_TankSpawn);
HookEvent("witch_spawn", BS_WitchSpawn);
HookEvent("round_end", BS_RoundEnd, EventHookMode_PostNoCopy);
HookEvent("finale_start", BS_FinaleStart, EventHookMode_PostNoCopy);
Expand All @@ -50,7 +48,6 @@ void BS_OnMapStart()
{
BS_bIsFirstRound = true;
BS_bFinaleStarted = false;
BS_bExpectTankSpawn = false;

for (int i = 0; i < ROUND_MAX_COUNT; i++) {
BS_iTankCount[i] = 0;
Expand Down Expand Up @@ -99,14 +96,7 @@ public void BS_WitchSpawn(Event hEvent, const char[] sEventName, bool bDontBroad
}
}

void BS_OnTankSpawnPost_Forward()
{
if (BS_bEnabled && IsPluginEnabled()) {
BS_bExpectTankSpawn = true;
}
}

public void BS_TankSpawn(Event hEvent, const char[] sEventName, bool bDontBroadcast)
void BS_OnTankSpawnPost_Forward(int iTankClient)
{
if (!BS_bEnabled || !IsPluginEnabled()) {
return;
Expand All @@ -117,20 +107,11 @@ public void BS_TankSpawn(Event hEvent, const char[] sEventName, bool bDontBroadc
return;
}

// Stop if this isn't the first tank_spawn for this tank
if (!BS_bExpectTankSpawn) {
return;
}

BS_bExpectTankSpawn = false;

// Don't track tank spawns on c5m5 or tank can spawn behind other team.
if (strcmp(BS_sMap, "c5m5_bridge") == 0) {
return;
}

int iTankClient = GetClientOfUserId(hEvent.GetInt("userid"));

if (GetMapValueInt("tank_z_fix")) {
FixZDistance(iTankClient); // fix stuck tank spawns, ex c1m1
}
Expand Down

0 comments on commit 5f553ac

Please sign in to comment.