Skip to content

Commit

Permalink
Some autobhop zone fixes
Browse files Browse the repository at this point in the history
commit d451cee
Author: rtldg <rtldg@protonmail.com>
Date:   Fri Feb 28 12:18:37 2025 +0000

    add another customzones cookie womp

commit d1395bc
Author: rtldg <rtldg@protonmail.com>
Date:   Fri Feb 28 12:18:29 2025 +0000

    Fix Autobhop zones not replicating sv_autobunnyhopping

commit c225702
Author: rtldg <rtldg@protonmail.com>
Date:   Fri Feb 28 12:18:11 2025 +0000

    make autobhop & nojump zones visible by default
  • Loading branch information
rtldg committed Feb 28, 2025
1 parent ad008dc commit 8ecc2a7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
8 changes: 4 additions & 4 deletions addons/sourcemod/configs/shavit-zones.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
"No Jump"
{
"visible" "0"
"visible" "1"
"red" "255"
"green" "0"
Expand All @@ -209,7 +209,7 @@
"Autobhop"
{
"visible" "0"
"visible" "1"
"red" "255"
"green" "0"
Expand Down Expand Up @@ -401,7 +401,7 @@
"Bonus 1 No Jump"
{
"visible" "0"
"visible" "1"
"red" "255"
"green" "0"
Expand All @@ -413,7 +413,7 @@
"Bonus 1 Autobhop"
{
"visible" "0"
"visible" "1"
"red" "255"
"green" "0"
Expand Down
16 changes: 13 additions & 3 deletions addons/sourcemod/scripting/shavit-core.sp
Original file line number Diff line number Diff line change
Expand Up @@ -2903,7 +2903,7 @@ public void Shavit_OnEnterZone(int client, int type, int track, int id, int enti
{
gF_ZoneSpeedLimit[client] = float(data);
}
else
else if (type != Zone_Autobhop)
{
return;
}
Expand All @@ -2917,7 +2917,7 @@ public void Shavit_OnLeaveZone(int client, int type, int track, int id, int enti
// Probably so very niche that it doesn't matter.
if (track != gA_Timers[client].iTimerTrack)
return;
if (type != Zone_Airaccelerate && type != Zone_CustomSpeedLimit)
if (type != Zone_Airaccelerate && type != Zone_CustomSpeedLimit && type != Zone_Autobhop)
return;

UpdateStyleSettings(client);
Expand Down Expand Up @@ -3835,7 +3835,17 @@ void UpdateStyleSettings(int client)
{
if(sv_autobunnyhopping != null)
{
sv_autobunnyhopping.ReplicateToClient(client, (GetStyleSettingBool(gA_Timers[client].bsStyle, "autobhop") && gB_Auto[client])? "1":"0");
sv_autobunnyhopping.ReplicateToClient(client,
(
gB_Auto[client]
&&
(
GetStyleSettingBool(gA_Timers[client].bsStyle, "autobhop")
|| (gB_Zones && Shavit_InsideZone(client, Zone_Autobhop, gA_Timers[client].iTimerTrack))
)
)
? "1":"0"
);
}

if(sv_enablebunnyhopping != null)
Expand Down
22 changes: 13 additions & 9 deletions addons/sourcemod/scripting/shavit-zones.sp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ bool gB_AdminMenu = false;
#define CZONE_VER 'c'
// custom zone stuff
Cookie gH_CustomZoneCookie = null;
Cookie gH_CustomZoneCookie2 = null; // fuck
int gI_ZoneDisplayType[MAXPLAYERS+1][ZONETYPES_SIZE][TRACKS_SIZE];
int gI_ZoneColor[MAXPLAYERS+1][ZONETYPES_SIZE][TRACKS_SIZE];
int gI_ZoneWidth[MAXPLAYERS+1][ZONETYPES_SIZE][TRACKS_SIZE];
Expand Down Expand Up @@ -300,6 +301,7 @@ public void OnPluginStart()
RegConsoleCmd("sm_customzones", Command_CustomZones, "Customize start and end zone for each track");

gH_CustomZoneCookie = new Cookie("shavit_customzones", "Cookie for storing custom zone stuff", CookieAccess_Private);
gH_CustomZoneCookie2 = new Cookie("shavit_customzones2", "Cooke (AGAIN) for storing custom zone stuff", CookieAccess_Private);

for (int i = 0; i <= 9; i++)
{
Expand Down Expand Up @@ -1782,8 +1784,10 @@ public void OnClientCookiesCached(int client)
gH_DrawAllZonesCookie.Get(client, setting, sizeof(setting));
gB_DrawAllZones[client] = view_as<bool>(StringToInt(setting));

char czone[100]; // #define MAX_VALUE_LENGTH 100
gH_CustomZoneCookie.Get(client, czone, sizeof(czone));
// we have to go through some pain because cookies can only fit into a char[100] buffer...
char czone[200];
gH_CustomZoneCookie.Get(client, czone, 100);
gH_CustomZoneCookie2.Get(client, czone[99], 100);

char ver = czone[0];

Expand Down Expand Up @@ -1815,14 +1819,11 @@ public void OnClientCookiesCached(int client)
else if (ver == 'c') // back to the original :pensive:
{
// c = [1 + ZONETYPES_SIZE*2*3 + 1] // version = (ZONETYPES_SIZE * (main+bonus) * 3 chars) + NUL terminator
// char[98] as of right now....
// char[109] as of right now....

int p = 1;

// TODO: ZONETYPES_SIZE is too big now so we'll have to come back to do something about this...
// Just make another cookie :pepega: or maybe store the settings in the DB rather than cookie.
//for (int type = Zone_Start; type < ZONETYPES_SIZE; type++)
for (int type = Zone_Start; type <= Zone_Speedmod; type++)
for (int type = Zone_Start; type < ZONETYPES_SIZE; type++)
{
for (int track = Track_Main; track <= Track_Bonus; track++)
{
Expand Down Expand Up @@ -3327,7 +3328,7 @@ void OpenCustomZoneMenu(int client, int pos=0)
menu.SetTitle("%T", "CustomZone_MainMenuTitle", client);

// Only start zone and end zone are customizable imo, why do you even want to customize the zones that arent often used/seen???
#if CZONE_VER == 'b'
#if CZONE_VER != 'a'
for (int i = 0; i <= Track_Bonus; i++)
{
for (int j = 0; j < ZONETYPES_SIZE; j++)
Expand Down Expand Up @@ -3439,7 +3440,7 @@ void OpenSubCustomZoneMenu(int client, int track, int zoneType)

void HandleCustomZoneCookie(int client)
{
char buf[100]; // #define MAX_VALUE_LENGTH 100
char buf[200];
int p = 0;

#if CZONE_VER >= 'b'
Expand Down Expand Up @@ -3469,7 +3470,10 @@ void HandleCustomZoneCookie(int client)
}
}

Format(buf[100], 100, "%s", buf[99]); // shift that bitch over...
buf[99] = 0;
gH_CustomZoneCookie.Set(client, buf);
gH_CustomZoneCookie2.Set(client, buf[100]);
}

public int MenuHandler_SubCustomZones(Menu menu, MenuAction action, int client, int param2)
Expand Down

0 comments on commit 8ecc2a7

Please # to comment.