Skip to content

Commit 8f354d2

Browse files
authored
Implement auto-bhop state management in race settings
Added functionality to store and restore auto-bhop settings during race mode.
1 parent 50c7b77 commit 8f354d2

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

addons/sourcemod/scripting/VScript_ze_ffvii_mako_reactor_v5_3.sp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ bool g_bIsRevote = false;
3636
bool g_bPlayedZM = false;
3737
bool g_bVoteFinished = true;
3838
bool bStartVoteNextRound = false;
39+
bool g_bRaceAutoBhopStored = false;
3940
bool g_bRaceAirAccelerateStored = false;
41+
bool g_bRaceAutoBhopOriginal;
4042
int g_iRaceAirAccelerateOriginal;
4143

4244
ArrayList g_CooldownQueue = null; // FIFO queue of stages on cooldown
@@ -111,6 +113,14 @@ public void OnMapEnd()
111113
delete g_CooldownQueue;
112114
}
113115

116+
public void OnPluginEnd()
117+
{
118+
if (!g_bValidMap)
119+
return;
120+
121+
EndRaceSettings();
122+
}
123+
114124
stock bool VerifyMap()
115125
{
116126
char currentMap[64];
@@ -926,7 +936,15 @@ void TerminateRound()
926936
void StartRaceSettings()
927937
{
928938
if (g_cSvAutoBhop != null)
939+
{
940+
if (!g_bRaceAutoBhopStored)
941+
{
942+
g_bRaceAutoBhopOriginal = g_cSvAutoBhop.BoolValue;
943+
g_bRaceAutoBhopStored = true;
944+
}
945+
929946
g_cSvAutoBhop.BoolValue = true;
947+
}
930948

931949
if (g_cSvAirAccelerate == null)
932950
g_cSvAirAccelerate = FindConVar("sv_airaccelerate");
@@ -945,8 +963,11 @@ void StartRaceSettings()
945963

946964
void EndRaceSettings()
947965
{
948-
if (g_cSvAutoBhop != null)
949-
g_cSvAutoBhop.BoolValue = false;
966+
if (g_cSvAutoBhop != null && g_bRaceAutoBhopStored)
967+
{
968+
g_cSvAutoBhop.BoolValue = g_bRaceAutoBhopOriginal;
969+
g_bRaceAutoBhopStored = false;
970+
}
950971

951972
if (g_cSvAirAccelerate == null)
952973
g_cSvAirAccelerate = FindConVar("sv_airaccelerate");

0 commit comments

Comments
 (0)