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

3.4.0 #378

Merged
merged 50 commits into from
Oct 7, 2022
Merged

3.4.0 #378

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
16b0daf
Track ground entity for savelocs as well
zer0k-z Jun 2, 2022
3a3a006
Use actual bots instead of fakeclient for interpolation, always save …
zer0k-z Jun 5, 2022
47310c2
Use actual bots instead of fakeclient for interpolation, always save …
zer0k-z Jun 5, 2022
a90dfdc
Merge branch 'replay-fix' of https://github.com/zer0k-z/gokz into rep…
zer0k-z Jun 5, 2022
5f01e0e
Fix replay bot having no sound
zer0k-z Jun 6, 2022
70953df
Revert cheater recording logic for another PR
zer0k-z Jun 6, 2022
5fd036a
Always upload replays on personal best
zer0k-z Jun 6, 2022
cce4636
Stop the recording if its duration is too long
zer0k-z Jun 6, 2022
3664158
When in a run disallow starting timer on another course
GameChaos Jun 19, 2022
e1e9f26
Fix antibhop trigger not working sometimes
GameChaos Jun 30, 2022
2270166
Fix bots not spawning
zer0k-z Jul 12, 2022
eae2f80
Merge pull request #349 from KZGlobalTeam/fix-antibhop-trigger
zealain Jul 15, 2022
5b882df
Merge pull request #346 from KZGlobalTeam/dont-restart-timer-on-other…
zealain Jul 15, 2022
29a6da1
Merge pull request #343 from zer0k-z/abort-long-recording
zealain Jul 15, 2022
5a80d96
Merge pull request #340 from zer0k-z/replay-fix
zealain Jul 15, 2022
460a147
Merge pull request #338 from zer0k-z/saveloc-groundent
zealain Jul 15, 2022
7952742
Fix logic error
zer0k-z Jul 24, 2022
7f1d932
Merge pull request #341 from zer0k-z/upload-more-replays
zealain Jul 31, 2022
332b7f9
Fix hud errors
zer0k-z Aug 5, 2022
0a7ecc0
Fix replay bots having no valid ground entity while on the ground
zer0k-z Aug 5, 2022
92f41ae
Fix replay bots joining the incorrect teams, fix OnLadder HudInfo not…
zer0k-z Aug 5, 2022
9214050
Merge pull request #352 from zer0k-z/replay-hud-error
zealain Aug 19, 2022
5143991
Merge pull request #353 from zer0k-z/replay-ground-playback
zealain Aug 19, 2022
d60cc4e
Merge pull request #354 from zer0k-z/replay-misc-fixes
zealain Aug 19, 2022
9152fed
Nerf turnbinds by introducing a cooldown
zealain Aug 19, 2022
dabd95b
Added missing header changes
zealain Aug 19, 2022
34e9fe2
Add dynamic menu, add checkpoint and hud related natives, loadloc now…
zer0k-z Aug 25, 2022
3521203
Use client tick count for touch time calculation
zer0k-z Sep 25, 2022
da09cf8
Fix generic resume error message
zer0k-z Sep 26, 2022
945d7f3
Create RP_DIRECTORY_RUNS_TEMP directory
zer0k-z Sep 27, 2022
b658100
Use ArrayList to track the list of currently touched entities for jum…
zer0k-z Oct 3, 2022
f583356
Limit the maximum update speed to prevent crashes on LAN
zer0k-z Oct 6, 2022
2c444b5
Save valid jumps that have very small offset
zer0k-z Oct 6, 2022
c953b63
Merge pull request #365 from zer0k-z/mapping-api-tickcount
zealain Oct 6, 2022
7f71f78
Use client tick for jump tracking tick and invalidate duckbugged long…
zer0k-z Oct 6, 2022
3c0b6f8
Merge pull request #368 from zer0k-z/patch-1
zealain Oct 6, 2022
4e31701
Merge pull request #370 from zer0k-z/replay-temp-directory
zealain Oct 6, 2022
007999a
Merge pull request #372 from zer0k-z/jumpstats-track-touching-entities
zealain Oct 6, 2022
7ad33e5
Merge pull request #375 from zer0k-z/hud-maxupdatespeed
zealain Oct 6, 2022
b81a19c
Merge pull request #376 from zer0k-z/localdb-save-valid-jumps
zealain Oct 6, 2022
935f91d
Update GOKZ to be 1.11 compatible (#359)
zer0k-z Oct 6, 2022
8b22794
Implement run safeguard, remove unused code from jumpstats playback (…
zer0k-z Oct 7, 2022
ebc6d00
Added missing return value
zealain Oct 7, 2022
eec87d2
Mode version bump
zealain Oct 7, 2022
b41ac2f
Fix unresponsive client menu when players use start timer button zone
zer0k-z Oct 7, 2022
b555ab6
Remove duplicate resume code, fix errors showing up if players try to…
zer0k-z Oct 7, 2022
ac37242
Delay giving the bot the correct weapon by a frame to make sure it go…
zealain Oct 7, 2022
d05767b
Initialize checkpointCount upon client connect
zer0k-z Oct 7, 2022
3fb2f7f
Merge pull request #380 from zer0k-z/patch-1
zealain Oct 7, 2022
d6d9b6e
Merge pull request #379 from zer0k-z/hud-menu-zone-fix
zealain Oct 7, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CI

env:
SM_VERSION: "1.10"
SM_VERSION: "1.11"

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-anticheat/bhop_tracking.sp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static bool JustLanded(int client, int cmdnum)
}

// Records current button inputs
static int RecordButtons(int client, int buttons)
static void RecordButtons(int client, int buttons)
{
gI_ButtonsIndex[client] = NextIndex(gI_ButtonsIndex[client], AC_MAX_BUTTON_SAMPLES);
gI_Buttons[client][gI_ButtonsIndex[client]] = buttons;
Expand Down
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/gokz-chat.sp
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,5 @@ public int Native_SetChatTag(Handle plugin, int numParams)
}

GetNativeString(3, gC_PlayerTagColors[client], sizeof(gC_PlayerTagColors[]));
return 0;
}
19 changes: 15 additions & 4 deletions addons/sourcemod/scripting/gokz-core.sp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Handle gH_DHooks_OnTeleport;
Handle gH_DHooks_SetModel;

int gI_CmdNum[MAXPLAYERS + 1];
int gI_TickCount[MAXPLAYERS + 1];
bool gB_OldOnGround[MAXPLAYERS + 1];
int gI_OldButtons[MAXPLAYERS + 1];
int gI_TeleportCmdNum[MAXPLAYERS + 1];
Expand All @@ -52,8 +53,6 @@ ConVar gCV_gokz_chat_prefix;
ConVar gCV_sv_full_alltalk;

#include "gokz-core/commands.sp"
#include "gokz-core/forwards.sp"
#include "gokz-core/natives.sp"
#include "gokz-core/modes.sp"
#include "gokz-core/misc.sp"
#include "gokz-core/options.sp"
Expand All @@ -77,6 +76,9 @@ ConVar gCV_sv_full_alltalk;
#include "gokz-core/timer/timer.sp"
#include "gokz-core/timer/virtual_buttons.sp"

#include "gokz-core/forwards.sp"
#include "gokz-core/natives.sp"



// =====[ PLUGIN EVENTS ]=====
Expand Down Expand Up @@ -178,7 +180,9 @@ public void OnClientDisconnect(int client)
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])
{
gI_CmdNum[client] = cmdnum;
gI_TickCount[client] = tickcount;
OnPlayerRunCmd_MapTriggers(client, buttons);
OnPlayerRunCmd_Turnbinds(client, buttons, tickcount, angles);
return Plugin_Continue;
}

Expand Down Expand Up @@ -248,6 +252,12 @@ public Action OnPlayerDeath(Event event, const char[] name, bool dontBroadcast)
return Plugin_Continue;
}

public void OnPlayerJump(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
OnPlayerJump_Triggers(client);
}

public MRESReturn DHooks_OnTeleport(int client, Handle params)
{
gB_OriginTeleported[client] = !DHookIsNullParam(params, 1); // Origin affected
Expand Down Expand Up @@ -363,7 +373,7 @@ public void OnConfigsExecuted()
OnConfigsExecuted_OptionsMenu();
}

public Action OnNormalSound(int[] clients, int &numClients, char[] sample, int &entity, int &channel, float &volume, int &level, int &pitch, int &flags, char[] soundEntry, int &seed)
public Action OnNormalSound(int clients[MAXPLAYERS], int &numClients, char sample[PLATFORM_MAX_PATH], int &entity, int &channel, float &volume, int &level, int &pitch, int &flags, char soundEntry[PLATFORM_MAX_PATH], int &seed)
{
if (OnNormalSound_StopSounds(entity) == Plugin_Handled)
{
Expand Down Expand Up @@ -475,8 +485,9 @@ static void HookEvents()
HookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Post);
HookEvent("player_team", OnPlayerJoinTeam, EventHookMode_Pre);
HookEvent("player_death", OnPlayerDeath, EventHookMode_Pre);
HookEvent("player_jump", OnPlayerJump);
HookEvent("round_start", OnRoundStart, EventHookMode_PostNoCopy);
AddNormalSoundHook(view_as<NormalSHook>(OnNormalSound));
AddNormalSoundHook(OnNormalSound);

GameData gameData = new GameData("sdktools.games");
int offset;
Expand Down
46 changes: 33 additions & 13 deletions addons/sourcemod/scripting/gokz-core/commands.sp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ void RegisterCommands()
RegConsoleCmd("sm_ncnt", CommandToggleNoclipNotrigger, "[KZ] Toggle noclip-notrigger.");
RegConsoleCmd("+noclipnt", CommandEnableNoclipNotrigger, "[KZ] Noclip-notrigger on.");
RegConsoleCmd("-noclipnt", CommandDisableNoclipNotrigger, "[KZ] Noclip-notrigger off.");
RegConsoleCmd("sm_sg", CommandSafeGuard, "[KZ] Toggle safeguard.");
RegConsoleCmd("sm_safe", CommandSafeGuard, "[KZ] Toggle safeguard.");
RegConsoleCmd("sm_safeguard", CommandSafeGuard, "[KZ] Toggle safeguard.");
RegConsoleCmd("sm_pro", CommandProSafeGuard, "[KZ] Toggle PRO safeguard.");
}

void AddCommandsListeners()
Expand All @@ -59,6 +63,13 @@ bool SwitchToModeIfAvailable(int client, int mode)
}
else
{
// Safeguard Check
if (GOKZ_GetCoreOption(client, Option_Safeguard) > Safeguard_Disabled && GOKZ_GetTimerRunning(client) && GOKZ_GetValidTimer(client))
{
GOKZ_PrintToChat(client, true, "%t", "Safeguard - Blocked");
GOKZ_PlayErrorSound(client);
return false;
}
GOKZ_SetCoreOption(client, Option_Mode, mode);
return true;
}
Expand All @@ -80,10 +91,17 @@ public Action CommandJoinTeam(int client, const char[] command, int argc)
{
if (!GOKZ_GetPaused(client) && !GOKZ_GetCanPause(client))
{
SendFakeTeamEvent(client);
return Plugin_Handled;
}
}

else if (IsPlayerAlive(client) && GOKZ_GetCoreOption(client, Option_Safeguard) > Safeguard_Disabled && GOKZ_GetTimerRunning(client) && GOKZ_GetValidTimer(client))
{
GOKZ_PrintToChat(client, true, "%t", "Safeguard - Blocked");
GOKZ_PlayErrorSound(client);
SendFakeTeamEvent(client);
return Plugin_Handled;
}
GOKZ_JoinTeam(client, team);
return Plugin_Handled;
}
Expand Down Expand Up @@ -204,21 +222,15 @@ public Action CommandClearStartPos(int client, int args)

public Action CommandMain(int client, int args)
{
if (!TeleportToCourseStart(client, 0))
{
GOKZ_PrintToChat(client, true, "%t", "No Start Found");
}
TeleportToCourseStart(client, 0);
return Plugin_Handled;
}

public Action CommandBonus(int client, int args)
{
if (args == 0)
{ // Go to Bonus 1
if (!TeleportToCourseStart(client, 1))
{
GOKZ_PrintToChat(client, true, "%t", "No Start Found (Bonus)", 1);
}
TeleportToCourseStart(client, 1);
}
else
{ // Go to specified Bonus #
Expand All @@ -227,10 +239,7 @@ public Action CommandBonus(int client, int args)
int bonus = StringToInt(argBonus);
if (GOKZ_IsValidCourse(bonus, true))
{
if (!TeleportToCourseStart(client, bonus))
{
GOKZ_PrintToChat(client, true, "%t", "No Start Found (Bonus)", bonus);
}
TeleportToCourseStart(client, bonus);
}
else
{
Expand Down Expand Up @@ -348,3 +357,14 @@ public Action CommandDisableNoclipNotrigger(int client, int args)
return Plugin_Handled;
}

public Action CommandSafeGuard(int client, int args)
{
ToggleSafeGuard(client);
return Plugin_Handled;
}

public Action CommandProSafeGuard(int client, int args)
{
ToggleProSafeGuard(client);
return Plugin_Handled;
}
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/gokz-core/demofix.sp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void OnRoundStart_Demofix()
public Action Command_Demorestart(int client, const char[] command, int argc)
{
FixRecord(client);
return Plugin_Continue;
}

static void FixRecord(int client)
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-core/map/mapfile.sp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ static int EntlumpGetString(char[] result, int maxLength, int copyCount, char[]
return finalLength;
}

static EntlumpToken[] EntlumpGetToken(char[] entityLump, int &entlumpIndex)
static EntlumpToken EntlumpGetToken(char[] entityLump, int &entlumpIndex)
{
EntlumpToken result;

Expand Down
40 changes: 28 additions & 12 deletions addons/sourcemod/scripting/gokz-core/map/triggers.sp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ static int antiPauseTriggerTouchCount[MAXPLAYERS + 1];
static int antiJumpstatTriggerTouchCount[MAXPLAYERS + 1];
static int mapMappingApiVersion = GOKZ_MAPPING_API_VERSION_NONE;
static int bhopTouchCount[MAXPLAYERS + 1];
static bool jumpedThisTick[MAXPLAYERS + 1];
static float jumpOrigin[MAXPLAYERS + 1][3];
static float jumpVelocity[MAXPLAYERS + 1][3];
static ArrayList triggerTouchList[MAXPLAYERS + 1]; // arraylist of TouchedTrigger that the player is currently touching. this array won't ever get long (unless the mapper does something weird).
static StringMap triggerTouchCounts[MAXPLAYERS + 1]; // stringmap of int touch counts with key being a string of the entity reference.
static StringMap antiBhopTriggers; // stringmap of AntiBhopTrigger with key being a string of the m_iHammerID entprop.
Expand Down Expand Up @@ -197,7 +200,7 @@ void OnPlayerRunCmd_MapTriggers(int client, int &buttons)

if (touched.triggerType == TriggerType_Antibhop)
{
TouchAntibhopTrigger(touched, buttons, flags);
TouchAntibhopTrigger(client, touched, buttons, flags);
}
else if (touched.triggerType == TriggerType_Teleport)
{
Expand All @@ -211,6 +214,7 @@ void OnPlayerRunCmd_MapTriggers(int client, int &buttons)
}
}
}
jumpedThisTick[client] = false;
}

void OnPlayerSpawn_MapTriggers(int client)
Expand All @@ -236,6 +240,13 @@ void OnPlayerSpawn_MapTriggers(int client)
}
}

public void OnPlayerJump_Triggers(int client)
{
jumpedThisTick[client] = true;
GetClientAbsOrigin(client, jumpOrigin[client]);
Movement_GetVelocity(client, jumpVelocity[client]);
}

void OnEntitySpawned_MapTriggers(int entity)
{
char classname[32];
Expand Down Expand Up @@ -324,6 +335,11 @@ public void OnAntiBhopTrigTouchStart_MapTriggers(const char[] output, int entity
return;
}

if (jumpedThisTick[other])
{
TeleportEntity(other, jumpOrigin[other], NULL_VECTOR, jumpVelocity[other]);
}

AddTriggerToTouchList(other, entity, TriggerType_Antibhop);
}

Expand Down Expand Up @@ -507,7 +523,7 @@ void OnStartTouchGround_MapTriggers(int client)
TouchedTrigger touched;
triggerTouchList[client].GetArray(i, touched);
// set the touched tick to the tick that the player touches the ground.
touched.groundTouchTick = GetGameTickCount();
touched.groundTouchTick = gI_TickCount[client];
triggerTouchList[client].SetArray(i, touched);
}
}
Expand Down Expand Up @@ -563,11 +579,11 @@ static void AddTriggerToTouchList(int client, int trigger, TriggerType triggerTy
TouchedTrigger touched;
touched.triggerType = triggerType;
touched.entRef = triggerEntRef;
touched.startTouchTick = GetGameTickCount();
touched.startTouchTick = gI_TickCount[client];
touched.groundTouchTick = -1;
if (GetEntityFlags(client) & FL_ONGROUND)
{
touched.groundTouchTick = GetGameTickCount();
touched.groundTouchTick = gI_TickCount[client];
}

triggerTouchList[client].PushArray(touched);
Expand Down Expand Up @@ -616,7 +632,7 @@ static void DecrementTriggerTouchCount(int client, int trigger)
triggerTouchCounts[client].SetValue(szEntref, value);
}

static void TouchAntibhopTrigger(TouchedTrigger touched, int &newButtons, int flags)
static void TouchAntibhopTrigger(int client, TouchedTrigger touched, int &newButtons, int flags)
{
if (!(flags & FL_ONGROUND))
{
Expand All @@ -637,7 +653,7 @@ static void TouchAntibhopTrigger(TouchedTrigger touched, int &newButtons, int fl
AntiBhopTrigger trigger;
if (antiBhopTriggers.GetArray(key, trigger, sizeof(trigger)))
{
float touchTime = CalculateGroundTouchTime(touched);
float touchTime = CalculateGroundTouchTime(client, touched);
if (trigger.time == 0.0 || touchTime <= trigger.time)
{
// disable jump
Expand Down Expand Up @@ -687,7 +703,7 @@ static bool TouchTeleportTrigger(int client, TouchedTrigger touched, int flags)
// NOTE: Find out if we should actually teleport.
if (isBhopTrigger && (flags & FL_ONGROUND))
{
float touchTime = CalculateGroundTouchTime(touched);
float touchTime = CalculateGroundTouchTime(client, touched);
if (touchTime > trigger.delay)
{
shouldTeleport = true;
Expand All @@ -712,7 +728,7 @@ static bool TouchTeleportTrigger(int client, TouchedTrigger touched, int flags)
}
else if (trigger.type == TeleportType_Normal)
{
float touchTime = CalculateStartTouchTime(touched);
float touchTime = CalculateStartTouchTime(client, touched);
shouldTeleport = touchTime > trigger.delay || (trigger.delay == 0.0);
}

Expand Down Expand Up @@ -777,15 +793,15 @@ static bool TouchTeleportTrigger(int client, TouchedTrigger touched, int flags)
return shouldTeleport;
}

static float CalculateGroundTouchTime(TouchedTrigger touched)
static float CalculateGroundTouchTime(int client, TouchedTrigger touched)
{
float result = float(GetGameTickCount() - touched.groundTouchTick) * GetTickInterval();
float result = float(gI_TickCount[client] - touched.groundTouchTick) * GetTickInterval();
return result;
}

static float CalculateStartTouchTime(TouchedTrigger touched)
static float CalculateStartTouchTime(int client, TouchedTrigger touched)
{
float result = float(GetGameTickCount() - touched.startTouchTick) * GetTickInterval();
float result = float(gI_TickCount[client] - touched.startTouchTick) * GetTickInterval();
return result;
}

Expand Down
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/gokz-core/menus/mode_menu.sp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ public int MenuHandler_Mode(Menu menu, MenuAction action, int param1, int param2
{
delete menu;
}
return 0;
}
6 changes: 6 additions & 0 deletions addons/sourcemod/scripting/gokz-core/menus/options_menu.sp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ public void TopMenuHandler_General(TopMenu topmenu, TopMenuAction action, TopMen
gC_CoreOptionPhrases[option], param,
gC_TimerButtonZoneTypePhrases[GOKZ_GetCoreOption(param, option)], param);
}
case Option_Safeguard:
{
FormatEx(buffer, maxlength, "%T - %T",
gC_CoreOptionPhrases[option], param,
gC_SafeGuardPhrases[GOKZ_GetCoreOption(param, option)], param);
}
default:FormatToggleableOptionDisplay(param, option, buffer, maxlength);
}
}
Expand Down
Loading