From e945ce0f7bd4d792b0293d341f3fd2c97029244c Mon Sep 17 00:00:00 2001 From: "zer0.k" Date: Mon, 21 Mar 2022 02:16:45 +0100 Subject: [PATCH 01/21] Use server sided footsteps --- cfg/sourcemod/gokz/gokz.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg/sourcemod/gokz/gokz.cfg b/cfg/sourcemod/gokz/gokz.cfg index f7b14f41..a1a9e012 100644 --- a/cfg/sourcemod/gokz/gokz.cfg +++ b/cfg/sourcemod/gokz/gokz.cfg @@ -53,7 +53,7 @@ mp_ignore_round_win_conditions 1 mp_match_end_changelevel 1 sv_ignoregrenaderadio 1 sv_disable_radar 1 -mp_footsteps_serverside 0 +mp_footsteps_serverside 1 sv_mincmdrate 128 sv_minupdaterate 128 mp_warmuptime_all_players_connected 0 From 1418233bb9329356a7100b9ab2e8ba4cabac9984 Mon Sep 17 00:00:00 2001 From: GameChaos Date: Fri, 8 Apr 2022 16:32:30 +0300 Subject: [PATCH 02/21] Fix TP triggers TP'ing the player multiple times --- .../scripting/gokz-core/map/triggers.sp | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/addons/sourcemod/scripting/gokz-core/map/triggers.sp b/addons/sourcemod/scripting/gokz-core/map/triggers.sp index 0c0f642a..7defbaf9 100644 --- a/addons/sourcemod/scripting/gokz-core/map/triggers.sp +++ b/addons/sourcemod/scripting/gokz-core/map/triggers.sp @@ -191,7 +191,14 @@ void OnPlayerRunCmd_MapTriggers(int client, int &buttons) } else if (touched.triggerType == TriggerType_Teleport) { - TouchTeleportTrigger(client, touched, flags); + // Sometimes due to lag or whatever, the player can be + // teleported twice by the same trigger. This fixes that. + if (TouchTeleportTrigger(client, touched, flags)) + { + RemoveTriggerFromTouchList(client, EntRefToEntIndex(touched.entRef)); + i--; + triggerTouchListLength--; + } } } } @@ -582,22 +589,24 @@ static void TouchAntibhopTrigger(TouchedTrigger touched, int &newButtons, int fl } } -static void TouchTeleportTrigger(int client, TouchedTrigger touched, int flags) +static bool TouchTeleportTrigger(int client, TouchedTrigger touched, int flags) { + bool shouldTeleport = false; + char key[32]; GetEntityHammerIDString(touched.entRef, key, sizeof(key)); TeleportTrigger trigger; if (!teleportTriggers.GetArray(key, trigger, sizeof(trigger))) { // Couldn't get the teleport trigger from the trigger array for some reason. - return; + return shouldTeleport; } bool isBhopTrigger = IsBhopTrigger(trigger.type); // NOTE: Player hasn't touched the ground inside this trigger yet. if (touched.groundTouchTick == -1 && isBhopTrigger) { - return; + return shouldTeleport; } float destOrigin[3]; @@ -615,11 +624,10 @@ static void TouchTeleportTrigger(int client, TouchedTrigger touched, int flags) || (!gotTriggerOrigin && trigger.relativeDestination)) { PrintToConsole(client, "[KZ] Invalid teleport destination \"%s\" on trigger with hammerID %i.", trigger.tpDestination, trigger.hammerID); - return; + return shouldTeleport; } // NOTE: Find out if we should actually teleport. - bool shouldTeleport = false; if (isBhopTrigger && (flags & FL_ONGROUND)) { float touchTime = CalculateGroundTouchTime(touched); @@ -653,7 +661,7 @@ static void TouchTeleportTrigger(int client, TouchedTrigger touched, int flags) if (!shouldTeleport) { - return; + return shouldTeleport; } bool shouldReorientPlayer = trigger.reorientPlayer @@ -708,6 +716,8 @@ static void TouchTeleportTrigger(int client, TouchedTrigger touched, int flags) { TeleportPlayer(client, finalOrigin, finalPlayerAngles, gotDestAngles && trigger.useDestAngles, trigger.resetSpeed); } + + return shouldTeleport; } static float CalculateGroundTouchTime(TouchedTrigger touched) From c8e9844deda48b9b583562cf16795409d1767110 Mon Sep 17 00:00:00 2001 From: GameChaos Date: Mon, 11 Apr 2022 16:09:23 +0300 Subject: [PATCH 03/21] Add checks for reversed start/endtouch output pairs --- .../scripting/gokz-core/map/triggers.sp | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/addons/sourcemod/scripting/gokz-core/map/triggers.sp b/addons/sourcemod/scripting/gokz-core/map/triggers.sp index 7defbaf9..ab12102a 100644 --- a/addons/sourcemod/scripting/gokz-core/map/triggers.sp +++ b/addons/sourcemod/scripting/gokz-core/map/triggers.sp @@ -18,6 +18,7 @@ static int antiJumpstatTriggerTouchCount[MAXPLAYERS + 1]; static int mapMappingApiVersion = GOKZ_MAPPING_API_VERSION_NONE; static int bhopTouchCount[MAXPLAYERS + 1]; 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. static StringMap teleportTriggers; // stringmap of TeleportTrigger with key being a string of the m_iHammerID entprop. static StringMap timerButtonTriggers; // stringmap of legacy timer zone triggers with key being a string of the m_iHammerID entprop. @@ -143,6 +144,15 @@ void OnClientPutInServer_MapTriggers(int client) triggerTouchList[client].Clear(); } + if (triggerTouchCounts[client] == null) + { + triggerTouchCounts[client] = new StringMap(); + } + else + { + triggerTouchCounts[client].Clear(); + } + bhopTouchCount[client] = 0; if (lastTouchSequentialBhopEntRefs[client] == null) @@ -306,6 +316,14 @@ public void OnAntiBhopTrigTouchStart_MapTriggers(const char[] output, int entity return; } + int touchCount = IncrementTriggerTouchCount(other, entity); + if (touchCount <= 0) + { + // The trigger has fired a matching endtouch output before + // the starttouch output, so ignore it. + return; + } + AddTriggerToTouchList(other, entity, TriggerType_Antibhop); } @@ -316,6 +334,7 @@ public void OnAntiBhopTrigTouchEnd_MapTriggers(const char[] output, int entity, return; } + DecrementTriggerTouchCount(other, entity); RemoveTriggerFromTouchList(other, entity); } @@ -326,6 +345,14 @@ public void OnTeleportTrigTouchStart_MapTriggers(const char[] output, int entity return; } + int touchCount = IncrementTriggerTouchCount(other, entity); + if (touchCount <= 0) + { + // The trigger has fired a matching endtouch output before + // the starttouch output, so ignore it. + return; + } + char key[32]; GetEntityHammerIDString(entity, key, sizeof(key)); TeleportTrigger trigger; @@ -345,6 +372,8 @@ public void OnTeleportTrigTouchEnd_MapTriggers(const char[] output, int entity, return; } + DecrementTriggerTouchCount(other, entity); + char key[32]; GetEntityHammerIDString(entity, key, sizeof(key)); TeleportTrigger trigger; @@ -559,6 +588,34 @@ static void RemoveTriggerFromTouchList(int client, int trigger) } } +static int IncrementTriggerTouchCount(int client, int trigger) +{ + int entref = EntIndexToEntRef(trigger); + char szEntref[64]; + FormatEx(szEntref, sizeof(szEntref), "%i", entref); + + int value = 0; + triggerTouchCounts[client].GetValue(szEntref, value); + + value += 1; + triggerTouchCounts[client].SetValue(szEntref, value); + + return value; +} + +static void DecrementTriggerTouchCount(int client, int trigger) +{ + int entref = EntIndexToEntRef(trigger); + char szEntref[64]; + FormatEx(szEntref, sizeof(szEntref), "%i", entref); + + int value = 0; + triggerTouchCounts[client].GetValue(szEntref, value); + + value -= 1; + triggerTouchCounts[client].SetValue(szEntref, value); +} + static void TouchAntibhopTrigger(TouchedTrigger touched, int &newButtons, int flags) { if (!(flags & FL_ONGROUND)) From 78135c7b0becdb6b5306bce1753fb9b5372266e7 Mon Sep 17 00:00:00 2001 From: GameChaos Date: Mon, 11 Apr 2022 16:16:42 +0300 Subject: [PATCH 04/21] Block going to spec instead of stopping the timer --- addons/sourcemod/scripting/gokz-core/misc.sp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/sourcemod/scripting/gokz-core/misc.sp b/addons/sourcemod/scripting/gokz-core/misc.sp index 8ef86d2b..58104b1c 100644 --- a/addons/sourcemod/scripting/gokz-core/misc.sp +++ b/addons/sourcemod/scripting/gokz-core/misc.sp @@ -252,6 +252,11 @@ void JoinTeam(int client, int newTeam, bool restorePos) if (newTeam == CS_TEAM_SPECTATOR && currentTeam != CS_TEAM_SPECTATOR) { + if (!player.Paused && !player.CanPause) + { + return; + } + if (currentTeam != CS_TEAM_NONE) { player.GetOrigin(savedOrigin[client]); @@ -259,11 +264,7 @@ void JoinTeam(int client, int newTeam, bool restorePos) savedOnLadder[client] = player.Movetype == MOVETYPE_LADDER; hasSavedPosition[client] = true; } - - if (!player.Paused && !player.CanPause) - { - player.StopTimer(); - } + ChangeClientTeam(client, CS_TEAM_SPECTATOR); Call_GOKZ_OnJoinTeam(client, newTeam); } From 2ab9b7cd46f052dae89e55510641a0377918f3ec Mon Sep 17 00:00:00 2001 From: GameChaos Date: Mon, 11 Apr 2022 16:41:11 +0300 Subject: [PATCH 05/21] Only block team change in jointeam hook. This won't change the behaviour of GOKZ_Jointeam, that will still stop your timer if you go to spectator. --- addons/sourcemod/scripting/gokz-core/commands.sp | 9 +++++++++ addons/sourcemod/scripting/gokz-core/misc.sp | 11 +++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/addons/sourcemod/scripting/gokz-core/commands.sp b/addons/sourcemod/scripting/gokz-core/commands.sp index c08c9252..5de384ae 100644 --- a/addons/sourcemod/scripting/gokz-core/commands.sp +++ b/addons/sourcemod/scripting/gokz-core/commands.sp @@ -75,6 +75,15 @@ public Action CommandJoinTeam(int client, const char[] command, int argc) char teamString[4]; GetCmdArgString(teamString, sizeof(teamString)); int team = StringToInt(teamString); + + if (team == CS_TEAM_SPECTATOR) + { + if (!GOKZ_GetPaused(client) && !GOKZ_GetCanPause(client)) + { + return Plugin_Handled; + } + } + GOKZ_JoinTeam(client, team); return Plugin_Handled; } diff --git a/addons/sourcemod/scripting/gokz-core/misc.sp b/addons/sourcemod/scripting/gokz-core/misc.sp index 58104b1c..8ef86d2b 100644 --- a/addons/sourcemod/scripting/gokz-core/misc.sp +++ b/addons/sourcemod/scripting/gokz-core/misc.sp @@ -252,11 +252,6 @@ void JoinTeam(int client, int newTeam, bool restorePos) if (newTeam == CS_TEAM_SPECTATOR && currentTeam != CS_TEAM_SPECTATOR) { - if (!player.Paused && !player.CanPause) - { - return; - } - if (currentTeam != CS_TEAM_NONE) { player.GetOrigin(savedOrigin[client]); @@ -264,7 +259,11 @@ void JoinTeam(int client, int newTeam, bool restorePos) savedOnLadder[client] = player.Movetype == MOVETYPE_LADDER; hasSavedPosition[client] = true; } - + + if (!player.Paused && !player.CanPause) + { + player.StopTimer(); + } ChangeClientTeam(client, CS_TEAM_SPECTATOR); Call_GOKZ_OnJoinTeam(client, newTeam); } From 3c3acd47dad2b5316c4cad24c262b3625cb72750 Mon Sep 17 00:00:00 2001 From: Walliski Date: Mon, 11 Apr 2022 20:29:31 +0300 Subject: [PATCH 06/21] Check if map is running also when Demofix is disabled The check is done before accessing the gamerules in the EnableDemoRecord function when the demofix is enabled. When you have set Demofix to be disabled it will attempt to access the Gamerules too early during map load, causing an "Couldn't find gamerules proxy entity" exception. This commit fixes that issue by making sure that we are only running the SetProp when the map is actually running. --- addons/sourcemod/scripting/gokz-core/demofix.sp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/sourcemod/scripting/gokz-core/demofix.sp b/addons/sourcemod/scripting/gokz-core/demofix.sp index fe8c83a1..a37c80f1 100644 --- a/addons/sourcemod/scripting/gokz-core/demofix.sp +++ b/addons/sourcemod/scripting/gokz-core/demofix.sp @@ -72,6 +72,11 @@ static void DoDemoFix() { case 0: { + if (!mapRunning) + { + return; + } + GameRules_SetProp("m_bWarmupPeriod", 0); } case 1: From 3a847b973672ceb8de3cf0b53a50de9e11bf8998 Mon Sep 17 00:00:00 2001 From: Walliski Date: Mon, 11 Apr 2022 21:29:05 +0300 Subject: [PATCH 07/21] Add warning message when starting a non-global run In case the map is the wrong version, or the server is not updated the user might not realize that the run will not be saved in the global api. To avoid the confusion, we show them an error message. To prevent spam of the message, we first check if the server is intended to be global, by verifying that the GlobalApi plugin has a key set. Further if the user already has a run going when resetting the timer, they will not get the message again. If they stop the timer and start it again, it will show the message again. --- addons/sourcemod/scripting/gokz-global.sp | 15 +++++++++++++++ .../translations/gokz-global.phrases.txt | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/addons/sourcemod/scripting/gokz-global.sp b/addons/sourcemod/scripting/gokz-global.sp index 82abe48b..67977d84 100644 --- a/addons/sourcemod/scripting/gokz-global.sp +++ b/addons/sourcemod/scripting/gokz-global.sp @@ -259,6 +259,21 @@ public void GlobalAPI_OnInitialized() SetupAPI(); } + +public Action GOKZ_OnTimerStart(int client, int course) +{ + KZPlayer player = KZPlayer(client); + int mode = player.Mode; + + // We check the timer running to prevent spam when standing inside VB. + if (GlobalAPI_HasAPIKey() && !GlobalsEnabled(mode) && !GOKZ_GetTimerRunning(client)) + { + GOKZ_PrintToChat(client, true, "%t", "Warn Player Not Global Run"); + } + + return Plugin_Continue; +} + public void GOKZ_OnTimerStart_Post(int client, int course) { KZPlayer player = KZPlayer(client); diff --git a/addons/sourcemod/translations/gokz-global.phrases.txt b/addons/sourcemod/translations/gokz-global.phrases.txt index a9e07e62..a4e2694e 100644 --- a/addons/sourcemod/translations/gokz-global.phrases.txt +++ b/addons/sourcemod/translations/gokz-global.phrases.txt @@ -200,6 +200,10 @@ "en" "Your m_yaw value must be less or equal to 0.3 to play on this server" "ru" "Ваше значение m_yaw должно быть меньше или равно 0.3 для игры на этом сервере." } + "Warn Player Not Global Run" + { + "en" "{yellow}Warning{grey}: The current map did not pass the Global check. Global times will not save. See {default}!globalcheck{grey} for more information." + } // =====[ GLOBAL TOP MENU ]===== From 0bd0b3cae45b401a161ee800c4a31272153d0bd6 Mon Sep 17 00:00:00 2001 From: Walliski Date: Mon, 11 Apr 2022 21:45:07 +0300 Subject: [PATCH 08/21] Add gokz_warn_for_non_global_map cvar This allows server owners to disable the warnings for non-global maps. This is useful in cases where you host a lot of non-global maps on your server. The default value is to warn users about non-global times, as most servers that have the GlobalAPI Key set mainly host global maps. --- addons/sourcemod/scripting/gokz-global.sp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/gokz-global.sp b/addons/sourcemod/scripting/gokz-global.sp index 67977d84..c7d6eabc 100644 --- a/addons/sourcemod/scripting/gokz-global.sp +++ b/addons/sourcemod/scripting/gokz-global.sp @@ -54,6 +54,7 @@ int gI_MapFileSize; int gI_MapTier; ConVar gCV_gokz_settings_enforcer; +ConVar gCV_gokz_warn_for_non_global_map; ConVar gCV_EnforcedCVar[ENFORCEDCVAR_COUNT]; #include "gokz-global/api.sp" @@ -266,7 +267,10 @@ public Action GOKZ_OnTimerStart(int client, int course) int mode = player.Mode; // We check the timer running to prevent spam when standing inside VB. - if (GlobalAPI_HasAPIKey() && !GlobalsEnabled(mode) && !GOKZ_GetTimerRunning(client)) + if (gCV_gokz_warn_for_non_global_map.BoolValue + && GlobalAPI_HasAPIKey() + && !GlobalsEnabled(mode) + && !GOKZ_GetTimerRunning(client)) { GOKZ_PrintToChat(client, true, "%t", "Warn Player Not Global Run"); } @@ -527,6 +531,7 @@ static void CreateConVars() AutoExecConfig_SetCreateFile(true); gCV_gokz_settings_enforcer = AutoExecConfig_CreateConVar("gokz_settings_enforcer", "1", "Whether GOKZ enforces convars required for global records.", _, true, 0.0, true, 1.0); + gCV_gokz_warn_for_non_global_map = AutoExecConfig_CreateConVar("gokz_warn_for_non_global_map", "1", "Whether or not GOKZ should warn players if the global check does not pass.", _, true, 0.0, true, 1.0); gCV_gokz_settings_enforcer.AddChangeHook(OnConVarChanged); AutoExecConfig_ExecuteFile(); From b718d2870ac24485a56c6861f07a732e9a84ef45 Mon Sep 17 00:00:00 2001 From: Walliski Date: Mon, 11 Apr 2022 20:00:07 +0300 Subject: [PATCH 09/21] Show warning on CP in non-cp area Adds a message that will show in case a player has the timer off and creates a CP in an area that is marked to have CPs disabled. If the timer is running, the player will not be able to create a CP. It adds the message so that the user can test in what places its possible to create CPs without having the timer on. This reduces confusion and makes the routing process easier. --- addons/sourcemod/scripting/gokz-core/teleports.sp | 7 ++++++- addons/sourcemod/translations/gokz-core.phrases.txt | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/gokz-core/teleports.sp b/addons/sourcemod/scripting/gokz-core/teleports.sp index 7346e00d..4996e762 100644 --- a/addons/sourcemod/scripting/gokz-core/teleports.sp +++ b/addons/sourcemod/scripting/gokz-core/teleports.sp @@ -115,7 +115,12 @@ void MakeCheckpoint(int client) { GOKZ_PrintToChat(client, true, "%t", "Make Checkpoint", checkpointCount[client]); } - + + if (!GetTimerRunning(client) && AntiCpTriggerIsTouched(client)) + { + GOKZ_PrintToChat(client, true, "%t", "Anti Checkpoint Area Warning"); + } + // Call Post Forward Call_GOKZ_OnMakeCheckpoint_Post(client); } diff --git a/addons/sourcemod/translations/gokz-core.phrases.txt b/addons/sourcemod/translations/gokz-core.phrases.txt index b3b3a9c6..bc0ac654 100644 --- a/addons/sourcemod/translations/gokz-core.phrases.txt +++ b/addons/sourcemod/translations/gokz-core.phrases.txt @@ -53,6 +53,10 @@ "chi" "{grey}你存储了一个存点 (#{default}{1}{grey})." "ru" "{grey}Вы поставили чекпойнт (#{default}{1}{grey})." } + "Anti Checkpoint Area Warning" + { + "en" "{yellow}Warning{grey}: Checkpoint created in checkpoint disabled area." + } "Can't Checkpoint (Midair)" { "en" "{darkred}You can't make a checkpoint mid-air." From ef1f15c9d6918fc7d62d14c5da5ead4d7678a6f2 Mon Sep 17 00:00:00 2001 From: Szwagi Date: Wed, 13 Apr 2022 17:43:11 +0100 Subject: [PATCH 10/21] Fix bot being stuck at 0,0,0 caused by invalid ArrayList size --- addons/sourcemod/scripting/gokz-replays/playback.sp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/sourcemod/scripting/gokz-replays/playback.sp b/addons/sourcemod/scripting/gokz-replays/playback.sp index 5fb1e695..b2d41c49 100644 --- a/addons/sourcemod/scripting/gokz-replays/playback.sp +++ b/addons/sourcemod/scripting/gokz-replays/playback.sp @@ -409,7 +409,7 @@ static void LoadFormatVersion1Replay(File file, int bot) // Setup playback tick data array list if (playbackTickData[bot] == null) { - playbackTickData[bot] = new ArrayList(RP_V1_TICK_DATA_BLOCKSIZE, length); + playbackTickData[bot] = new ArrayList(IntMax(RP_V1_TICK_DATA_BLOCKSIZE, sizeof(ReplayTickData)), length); } else { // Make sure it's all clear and the correct size @@ -603,10 +603,10 @@ static bool LoadFormatVersion2Replay(File file, int client, int bot) // Setup playback tick data array list if (playbackTickData[bot] == null) { - playbackTickData[bot] = new ArrayList(sizeof(ReplayTickData)); + playbackTickData[bot] = new ArrayList(IntMax(RP_V1_TICK_DATA_BLOCKSIZE, sizeof(ReplayTickData)); } else - { // Make sure it's all clear and the correct size + { playbackTickData[bot].Clear(); } From 8b13c7be70491831411c8b35ee2d2bd3562c8b19 Mon Sep 17 00:00:00 2001 From: Szwagi Date: Wed, 13 Apr 2022 17:59:48 +0100 Subject: [PATCH 11/21] Add missing ), oops! --- addons/sourcemod/scripting/gokz-replays/playback.sp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/gokz-replays/playback.sp b/addons/sourcemod/scripting/gokz-replays/playback.sp index b2d41c49..02e52762 100644 --- a/addons/sourcemod/scripting/gokz-replays/playback.sp +++ b/addons/sourcemod/scripting/gokz-replays/playback.sp @@ -603,7 +603,7 @@ static bool LoadFormatVersion2Replay(File file, int client, int bot) // Setup playback tick data array list if (playbackTickData[bot] == null) { - playbackTickData[bot] = new ArrayList(IntMax(RP_V1_TICK_DATA_BLOCKSIZE, sizeof(ReplayTickData)); + playbackTickData[bot] = new ArrayList(IntMax(RP_V1_TICK_DATA_BLOCKSIZE, sizeof(ReplayTickData))); } else { From 9458bd78ba829d4f3712f13f22d554eaeced6b8d Mon Sep 17 00:00:00 2001 From: "zer0.k" Date: Sat, 23 Apr 2022 22:11:59 +0200 Subject: [PATCH 12/21] Update the first tick takeoff info in case of jumpbug --- addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp b/addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp index ee576d6b..aa7fd25a 100644 --- a/addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp +++ b/addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp @@ -116,6 +116,8 @@ enum struct JumpTracker // Reset pose history this.poseIndex = 0; + // Update the first tick if it is a jumpbug. + this.UpdateOnGround(); } void Begin() From 1a590b2c20b6043f6ec89ef09326d4ff6b63a909 Mon Sep 17 00:00:00 2001 From: zealain Date: Sun, 1 May 2022 13:22:14 +0200 Subject: [PATCH 13/21] Fixed message for jump replays that aren't found --- addons/sourcemod/scripting/gokz-localranks/db/js_top.sp | 6 +----- addons/sourcemod/scripting/gokz-replays/playback.sp | 3 +-- addons/sourcemod/translations/gokz-localranks.phrases.txt | 4 ---- addons/sourcemod/translations/gokz-replays.phrases.txt | 4 ++++ 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/addons/sourcemod/scripting/gokz-localranks/db/js_top.sp b/addons/sourcemod/scripting/gokz-localranks/db/js_top.sp index 37528e12..d07b676c 100644 --- a/addons/sourcemod/scripting/gokz-localranks/db/js_top.sp +++ b/addons/sourcemod/scripting/gokz-localranks/db/js_top.sp @@ -268,11 +268,7 @@ public int MenuHandler_JumpTopList(Menu menu, MenuAction action, int param1, int "%s/%d/%s/%d_%d_%s_%s.%s", RP_DIRECTORY_JUMPS, jumpInfo[param1][param2][0], RP_DIRECTORY_BLOCKJUMPS, jumpTopType[param1], blockNums[param1][param2], gC_ModeNamesShort[jumpInfo[param1][param2][2]], gC_StyleNamesShort[0], RP_FILE_EXTENSION); } - - if (GOKZ_RP_LoadJumpReplay(param1, path) == -1) - { - GOKZ_PrintToChat(param1, true, "%t", "No Replay for Jump"); - } + GOKZ_RP_LoadJumpReplay(param1, path); } if (action == MenuAction_Cancel && param2 == MenuCancel_Exit) diff --git a/addons/sourcemod/scripting/gokz-replays/playback.sp b/addons/sourcemod/scripting/gokz-replays/playback.sp index 07391b98..c41bd878 100644 --- a/addons/sourcemod/scripting/gokz-replays/playback.sp +++ b/addons/sourcemod/scripting/gokz-replays/playback.sp @@ -311,8 +311,7 @@ static bool LoadPlayback(int client, int bot, char[] path) { if (!FileExists(path)) { - // This can happen relatively frequently, e.g. for jumps without a replay, - // therefore we're not logging it for now to avoid clutter. + GOKZ_PrintToChat(client, true, "%t", "No Replay Found"); return false; } diff --git a/addons/sourcemod/translations/gokz-localranks.phrases.txt b/addons/sourcemod/translations/gokz-localranks.phrases.txt index 4f6b0434..ba1e3d73 100644 --- a/addons/sourcemod/translations/gokz-localranks.phrases.txt +++ b/addons/sourcemod/translations/gokz-localranks.phrases.txt @@ -380,10 +380,6 @@ "en" "{grey}No jumpstats were found!" "ru" "{grey}Статистика прыжков не найдена!" } - "No Replay for Jump" - { - "en" "{red}No replay for jump found!" - } "Jump Record" { "#format" "{1:s},{2:s},{3:s},{4:.4f}" diff --git a/addons/sourcemod/translations/gokz-replays.phrases.txt b/addons/sourcemod/translations/gokz-replays.phrases.txt index a7f39004..fed68a4b 100644 --- a/addons/sourcemod/translations/gokz-replays.phrases.txt +++ b/addons/sourcemod/translations/gokz-replays.phrases.txt @@ -21,6 +21,10 @@ "chi" "{darkred}当前没有可用的回放机器人." "ru" "{darkred}В настоящее время нет доступных ботов воспроизведения." } + "No Replay Found" + { + "en" "{red}No replay found!" + } // =====[ REPLAY MENU ]===== From 8b28945abba71c4bb04724e73c103e2f1079b2b4 Mon Sep 17 00:00:00 2001 From: Ferex Date: Tue, 10 May 2022 23:16:12 +0100 Subject: [PATCH 14/21] Dynamically add bots to server when needed instead of leaving them sitting in spectator mode --- addons/sourcemod/scripting/gokz-replays.sp | 18 ------------- .../scripting/gokz-replays/playback.sp | 26 +++++-------------- 2 files changed, 6 insertions(+), 38 deletions(-) diff --git a/addons/sourcemod/scripting/gokz-replays.sp b/addons/sourcemod/scripting/gokz-replays.sp index c8468545..c2b95761 100644 --- a/addons/sourcemod/scripting/gokz-replays.sp +++ b/addons/sourcemod/scripting/gokz-replays.sp @@ -41,7 +41,6 @@ int gI_CurrentMapFileSize; bool gB_HideNameChange; bool gB_NubRecordMissed[MAXPLAYERS + 1]; ArrayList g_ReplayInfoCache; -ConVar gCV_bot_quota; #include "gokz-replays/commands.sp" #include "gokz-replays/nav.sp" @@ -68,7 +67,6 @@ public void OnPluginStart() LoadTranslations("gokz-replays.phrases"); CreateGlobalForwards(); - CreateConVars(); HookEvents(); RegisterCommands(); } @@ -126,7 +124,6 @@ public void OnConfigsExecuted() FindConVar("bot_zombie").BoolValue = true; FindConVar("bot_join_after_player").BoolValue = false; FindConVar("bot_quota_mode").SetString("normal"); - gCV_bot_quota.IntValue = RP_MAX_BOTS; } public void OnEntityCreated(int entity, const char[] classname) @@ -175,15 +172,6 @@ public Action Hook_SayText2(UserMsg msg_id, any msg, const int[] players, int pl return Plugin_Continue; } -public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] intValue) -{ - // Keep the bots in the server - if (convar == gCV_bot_quota) - { - gCV_bot_quota.IntValue = RP_MAX_BOTS; - } -} - // =====[ CLIENT EVENTS ]===== @@ -282,12 +270,6 @@ public void GOKZ_DB_OnJumpstatPB(int client, int jumptype, int mode, float dista // =====[ PRIVATE ]===== -static void CreateConVars() -{ - gCV_bot_quota = FindConVar("bot_quota"); - gCV_bot_quota.Flags &= ~FCVAR_NOTIFY; - gCV_bot_quota.AddChangeHook(OnConVarChanged); -} static void HookEvents() { diff --git a/addons/sourcemod/scripting/gokz-replays/playback.sp b/addons/sourcemod/scripting/gokz-replays/playback.sp index c41bd878..cd6258b4 100644 --- a/addons/sourcemod/scripting/gokz-replays/playback.sp +++ b/addons/sourcemod/scripting/gokz-replays/playback.sp @@ -254,7 +254,6 @@ void OnClientPutInServer_Playback(int client) { botInGame[bot] = true; botClient[bot] = client; - ResetBotStuff(bot); break; } } @@ -715,7 +714,7 @@ static void PlaybackVersion1(int client, int bot, int &buttons) playbackTickData[bot].Clear(); // Clear it all out botDataLoaded[bot] = false; CancelReplayControlsForBot(bot); - ResetBotStuff(bot); + KickClient(botClient[bot]); } } } @@ -735,7 +734,7 @@ static void PlaybackVersion1(int client, int bot, int &buttons) playbackTickData[bot].Clear(); botDataLoaded[bot] = false; CancelReplayControlsForBot(bot); - ResetBotStuff(bot); + KickClient(botClient[bot]); return; } @@ -880,7 +879,7 @@ void PlaybackVersion2(int client, int bot, int &buttons) playbackTickData[bot].Clear(); // Clear it all out botDataLoaded[bot] = false; CancelReplayControlsForBot(bot); - ResetBotStuff(bot); + KickClient(botClient[bot]); } } } @@ -900,7 +899,7 @@ void PlaybackVersion2(int client, int bot, int &buttons) playbackTickData[bot].Clear(); botDataLoaded[bot] = false; CancelReplayControlsForBot(bot); - ResetBotStuff(bot); + KickClient(botClient[bot]); return; } @@ -1090,20 +1089,6 @@ void PlaybackVersion2(int client, int bot, int &buttons) } } -// Reset the bot client's clan tag and name to the default, unused state -static void ResetBotStuff(int bot) -{ - int client = botClient[bot]; - - CS_SetClientClanTag(client, "!REPLAY"); - char name[MAX_NAME_LENGTH]; - FormatEx(name, sizeof(name), "%d", bot + 1); - gB_HideNameChange = true; - SetClientName(client, name); - - GOKZ_JoinTeam(client, CS_TEAM_SPECTATOR); -} - // Set the bot client's GOKZ options, clan tag and name based on the loaded replay data static void SetBotStuff(int bot) { @@ -1266,8 +1251,9 @@ static int GetUnusedBot() { for (int bot = 0; bot < RP_MAX_BOTS; bot++) { - if (botInGame[bot] && !botDataLoaded[bot]) + if (!botInGame[bot]) { + CreateFakeClient("botName"); return bot; } } From 99f4bd4e2e6cfe744597f56a33da17d458d28993 Mon Sep 17 00:00:00 2001 From: Ferex Date: Wed, 11 May 2022 22:04:20 +0100 Subject: [PATCH 15/21] Resolves #154 --- .../sourcemod/scripting/gokz-hud/options.sp | 18 +++++ .../scripting/gokz-hud/options_menu.sp | 6 ++ .../sourcemod/scripting/gokz-hud/tp_menu.sp | 76 ++++++++++++++++++- .../sourcemod/scripting/include/gokz/hud.inc | 31 ++++++-- .../scripting/include/gokz/kzplayer.inc | 18 +++++ .../translations/gokz-hud.phrases.txt | 34 +++++++++ 6 files changed, 176 insertions(+), 7 deletions(-) diff --git a/addons/sourcemod/scripting/gokz-hud/options.sp b/addons/sourcemod/scripting/gokz-hud/options.sp index 694b97a2..a7eb5a15 100644 --- a/addons/sourcemod/scripting/gokz-hud/options.sp +++ b/addons/sourcemod/scripting/gokz-hud/options.sp @@ -122,5 +122,23 @@ static void PrintOptionChangeMessage(int client, HUDOption option, any newValue) } } } + case HUDOption_ShowSpectators: + { + switch (newValue) + { + case ShowSpecs_Disabled: + { + GOKZ_PrintToChat(client, true, "%t", "Option - Show Spectators - Disable"); + } + case ShowSpecs_Number: + { + GOKZ_PrintToChat(client, true, "%t", "Option - Show Spectators - Number"); + } + case ShowSpecs_Full: + { + GOKZ_PrintToChat(client, true, "%t", "Option - Show Spectators - Full"); + } + } + } } } \ No newline at end of file diff --git a/addons/sourcemod/scripting/gokz-hud/options_menu.sp b/addons/sourcemod/scripting/gokz-hud/options_menu.sp index 851e6b92..7eb01c5e 100644 --- a/addons/sourcemod/scripting/gokz-hud/options_menu.sp +++ b/addons/sourcemod/scripting/gokz-hud/options_menu.sp @@ -120,6 +120,12 @@ public void TopMenuHandler_HUD(TopMenu topmenu, TopMenuAction action, TopMenuObj gC_HUDOptionPhrases[option], param, gC_ShowControlsPhrases[GOKZ_HUD_GetOption(param, option)], param); } + case HUDOption_ShowSpectators: + { + FormatEx(buffer, maxlength, "%T - %T", + gC_HUDOptionPhrases[option], param, + gC_ShowSpecsPhrases[GOKZ_HUD_GetOption(param, option)], param); + } default:FormatToggleableOptionDisplay(param, option, buffer, maxlength); } } diff --git a/addons/sourcemod/scripting/gokz-hud/tp_menu.sp b/addons/sourcemod/scripting/gokz-hud/tp_menu.sp index 54c1b8f5..26072504 100644 --- a/addons/sourcemod/scripting/gokz-hud/tp_menu.sp +++ b/addons/sourcemod/scripting/gokz-hud/tp_menu.sp @@ -112,9 +112,25 @@ static void ShowTPMenu(KZPlayer player, HUDInfo info) static void TPMenuSetTitle(KZPlayer player, Menu menu, HUDInfo info) { + switch (player.ShowSpectators) + { + case ShowSpecs_Number: + { + menu.SetTitle("%T\n \n", "TP Menu - Spectators - Number", player.ID, GetNumSpectators(player)); + } + case ShowSpecs_Full: + { + char display[512]; + FormatSpectatorNames(player, display); + menu.SetTitle("%T\n \n", "TP Menu - Spectators - Full", player.ID, GetNumSpectators(player), display); + } + } + if (player.TimerRunning && player.TimerText == TimerText_TPMenu) { - menu.SetTitle(FormatTimerTextForMenu(player, info)); + char display[512]; + menu.GetTitle(display, sizeof(display)); + menu.SetTitle("%s%s", display, FormatTimerTextForMenu(player,info)); } } @@ -248,4 +264,60 @@ static void TPMenuAddItemStart(KZPlayer player, Menu menu) FormatEx(display, sizeof(display), "%T", "TP Menu - Start", player.ID); menu.AddItem(ITEM_INFO_START, display, ITEMDRAW_DEFAULT); } -} \ No newline at end of file +} + +static int GetNumSpectators(KZPlayer player) +{ + int count; + + for(int i = 1; i <= MaxClients; i++) + { + if (IsValidClient(i) && !IsPlayerAlive(i)) + { + int SpecMode = GetEntProp(i, Prop_Send, "m_iObserverMode"); + if (SpecMode == 4 || SpecMode == 5) + { + int target = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget"); + if (target == player.ID) + { + count++; + } + } + } + } + + return count; +} + +static void FormatSpectatorNames(KZPlayer player, char display[512]) +{ + int count; + + for(int i = 1; i <= MaxClients; i++) + { + if (IsValidClient(i) && !IsPlayerAlive(i)) + { + int SpecMode = GetEntProp(i, Prop_Send, "m_iObserverMode"); + if (SpecMode == 4 || SpecMode == 5) + { + int target = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget"); + if (target == player.ID) + { + count++; + //strip pound symbol from names + char cleanName[MAX_NAME_LENGTH]; + GetClientName(i, cleanName, sizeof(cleanName)); + ReplaceString(cleanName, sizeof(cleanName), "#", "", false); + if (count < 6) + { + Format(display, sizeof(display), "%s%s\n", display, cleanName); + } + } + if (count == 6) + { + Format(display, sizeof(display), "%s...", display); + } + } + } + } +} \ No newline at end of file diff --git a/addons/sourcemod/scripting/include/gokz/hud.inc b/addons/sourcemod/scripting/include/gokz/hud.inc index 9c229794..c5d43ecd 100644 --- a/addons/sourcemod/scripting/include/gokz/hud.inc +++ b/addons/sourcemod/scripting/include/gokz/hud.inc @@ -25,6 +25,7 @@ enum HUDOption: HUDOption_SpeedText, HUDOption_ShowWeapon, HUDOption_ShowControls, + HUDOption_ShowSpectators, HUDOPTION_COUNT }; @@ -97,6 +98,14 @@ enum REPLAYCONTROLS_COUNT }; +enum +{ + ShowSpecs_Disabled = 0, + ShowSpecs_Number, + ShowSpecs_Full, + SHOWSPECS_COUNT +}; + // =====[ STRUCTS ]====== @@ -140,7 +149,8 @@ stock char gC_HUDOptionNames[HUDOPTION_COUNT][] = "GOKZ HUD - Show Time Type", "GOKZ HUD - Speed Text", "GOKZ HUD - Show Weapon", - "GOKZ HUD - Show Controls" + "GOKZ HUD - Show Controls", + "GOKZ HUD - Show Spectators" }; stock char gC_HUDOptionDescriptions[HUDOPTION_COUNT][] = @@ -153,7 +163,8 @@ stock char gC_HUDOptionDescriptions[HUDOPTION_COUNT][] = "Timer Type - 0 = Disabled, 1 = Enabled", "Speed Display - 0 = Disabled, 1 = Centre Panel, 2 = Bottom", "Weapon Viewmodel - 0 = Disabled, 1 = Enabled", - "Replay Controls Display - 0 = Disbled, 1 = Enabled" + "Replay Controls Display - 0 = Disabled, 1 = Enabled", + "Show Spectators - 0 = Disabled, 1 = Number Only, 2 = Number and Names" }; stock char gC_HUDOptionPhrases[HUDOPTION_COUNT][] = @@ -166,7 +177,8 @@ stock char gC_HUDOptionPhrases[HUDOPTION_COUNT][] = "Options Menu - Timer Type", "Options Menu - Speed Text", "Options Menu - Show Weapon", - "Options Menu - Show Controls" + "Options Menu - Show Controls", + "Options Menu - Show Spectators" }; stock int gI_HUDOptionCounts[HUDOPTION_COUNT] = @@ -179,7 +191,8 @@ stock int gI_HUDOptionCounts[HUDOPTION_COUNT] = TIMERTYPE_COUNT, SPEEDTEXT_COUNT, SHOWWEAPON_COUNT, - REPLAYCONTROLS_COUNT + REPLAYCONTROLS_COUNT, + SHOWSPECS_COUNT }; stock int gI_HUDOptionDefaults[HUDOPTION_COUNT] = @@ -192,7 +205,8 @@ stock int gI_HUDOptionDefaults[HUDOPTION_COUNT] = TimerType_Enabled, SpeedText_InfoPanel, ShowWeapon_Enabled, - ReplayControls_Enabled + ReplayControls_Enabled, + ShowSpecs_Disabled }; stock char gC_TPMenuPhrases[TPMENU_COUNT][] = @@ -237,6 +251,13 @@ stock char gC_ShowControlsPhrases[REPLAYCONTROLS_COUNT][] = "Options Menu - Enabled" }; +stock char gC_ShowSpecsPhrases[SHOWSPECS_COUNT][] = +{ + "Options Menu - Disabled", + "Options Menu - Number", + "Options Menu - Number and Names" +} + // =====[ STOCKS ]===== diff --git a/addons/sourcemod/scripting/include/gokz/kzplayer.inc b/addons/sourcemod/scripting/include/gokz/kzplayer.inc index cca3ac63..c4900d6e 100644 --- a/addons/sourcemod/scripting/include/gokz/kzplayer.inc +++ b/addons/sourcemod/scripting/include/gokz/kzplayer.inc @@ -421,6 +421,24 @@ methodmap KZPlayer < MovementAPIPlayer { } } + property int ReplayControls { + public get() { + return this.GetHUDOption(HUDOption_ShowControls); + } + public set(int value) { + this.SetHUDOption(HUDOption_ShowControls, value); + } + } + + property int ShowSpectators { + public get() { + return this.GetHUDOption(HUDOption_ShowSpectators); + } + public set(int value) { + this.SetHUDOption(HUDOption_ShowSpectators, value); + } + } + #endif // =====[ END HUD ]===== diff --git a/addons/sourcemod/translations/gokz-hud.phrases.txt b/addons/sourcemod/translations/gokz-hud.phrases.txt index 00817a12..b34da411 100644 --- a/addons/sourcemod/translations/gokz-hud.phrases.txt +++ b/addons/sourcemod/translations/gokz-hud.phrases.txt @@ -71,6 +71,18 @@ { "en" "{grey}Replay controls are now hidden." } + "Option - Show Spectators - Disable" + { + "en" "{grey}Spectators are now not shown." + } + "Option - Show Spectators - Number" + { + "en" "{grey}Number of spectators is now shown." + } + "Option - Show Spectators - Full" + { + "en" "{grey}Number and names of spectators are now shown." + } // =====[ INFO PANEL ]===== @@ -107,6 +119,16 @@ // =====[ TELEPORT MENU ]===== + "TP Menu - Spectators - Full" + { + "#format" "{1:d},{2:s}" + "en" "Specs ({1}):\n{2}" + } + "TP Menu - Spectators - Number" + { + "#format" "{1:d}" + "en" "Specs: {1}" + } "TP Menu - Checkpoint" { "en" "Checkpoint" @@ -230,6 +252,18 @@ { "en" "Show replay controls" } + "Options Menu - Show Spectators" + { + "en" "Show spectators" + } + "Options Menu - Number" + { + "en" "Number" + } + "Options Menu - Number and Names" + { + "en" "Number and Names" + } // =====[ RACING ]===== From b8378a67fa601492cf73b0635c06d478f9bc4ff5 Mon Sep 17 00:00:00 2001 From: "zer0.k" Date: Sun, 15 May 2022 17:12:22 +0200 Subject: [PATCH 16/21] Fix broken ladderhop detection --- .../scripting/gokz-jumpstats/jump_tracking.sp | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp b/addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp index 61b599f9..c0639645 100644 --- a/addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp +++ b/addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp @@ -26,6 +26,7 @@ static int entityTouchCount[MAXPLAYERS + 1]; static int entityTouchDuration[MAXPLAYERS + 1]; static int lastNoclipTime[MAXPLAYERS + 1]; static int lastDuckbugTime[MAXPLAYERS + 1]; +static float lastJumpButtonTime[MAXPLAYERS + 1]; static bool validCmd[MAXPLAYERS + 1]; // Whether no illegal action is detected static const float playerMins[3] = { -16.0, -16.0, 0.0 }; static const float playerMaxs[3] = { 16.0, 16.0, 0.0 }; @@ -283,21 +284,22 @@ enum struct JumpTracker } else if (ladderJump) { - if (this.tickCount - this.lastJumpTick <= JS_MAX_BHOP_GROUND_TICKS) + // Check for ladder gliding. + float curtime = GetGameTime(); + float ignoreLadderJumpTime = GetEntPropFloat(this.jumper, Prop_Data, "m_ignoreLadderJumpTime"); + // Check if the ladder glide period is still active and if the player held jump in that period. + if (ignoreLadderJumpTime > curtime && + ignoreLadderJumpTime - 0.2 < lastJumpButtonTime[this.jumper] && lastJumpButtonTime[this.jumper] < ignoreLadderJumpTime) { - return this.tickCount - this.ladderGrabTick > JS_MAX_BHOP_GROUND_TICKS ? JumpType_Ladderhop : JumpType_Invalid; + return JumpType_Invalid; + } + if (jumped) + { + return JumpType_Ladderhop; } else { - // Check for ladder gliding. - if (GetClientButtons(this.jumper) & IN_JUMP) - { - return JumpType_Invalid; - } - else - { - return JumpType_LadderJump; - } + return JumpType_LadderJump; } } else if (!jumped) @@ -1274,6 +1276,7 @@ void OnClientPutInServer_JumpTracking(int client) entityTouchCount[client] = 0; lastNoclipTime[client] = 0; lastDuckbugTime[client] = 0; + lastJumpButtonTime[client] = 0.0; jumpTrackers[client].Init(client); } @@ -1291,15 +1294,6 @@ void OnJumpValidated_JumpTracking(int client, bool jumped, bool ladderJump, bool return; } - // Check if this change of move type is caused by ladder hopping in the air. - // If it is then this is not a valid jumpstat. - int buttons = GetClientButtons(client); - float ignoreLadderJumpTime = GetEntPropFloat(client, Prop_Data, "m_ignoreLadderJumpTime"); - if (ladderJump && buttons & IN_JUMP && ignoreLadderJumpTime <= GetGameTime()) - { - return; - } - // Update: Takeoff speed should be always correct with the new MovementAPI. if (jumped) { @@ -1354,6 +1348,11 @@ void OnPlayerRunCmd_JumpTracking(int client, int buttons, int tickcount) jumpTrackers[client].tickCount = tickcount; + if (GetClientButtons(client) & IN_JUMP) + { + lastJumpButtonTime[client] = GetGameTime(); + } + if (CheckNoclip(client)) { lastNoclipTime[client] = GetGameTickCount(); From 75f2314795e2299e1805c3c373ad0b7affa9e04c Mon Sep 17 00:00:00 2001 From: "zer0.k" Date: Sun, 15 May 2022 21:38:44 +0200 Subject: [PATCH 17/21] use IGNORE_JUMP_TIME define for ladderglide --- addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp | 2 +- addons/sourcemod/scripting/include/gokz.inc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp b/addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp index c0639645..bb026efb 100644 --- a/addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp +++ b/addons/sourcemod/scripting/gokz-jumpstats/jump_tracking.sp @@ -289,7 +289,7 @@ enum struct JumpTracker float ignoreLadderJumpTime = GetEntPropFloat(this.jumper, Prop_Data, "m_ignoreLadderJumpTime"); // Check if the ladder glide period is still active and if the player held jump in that period. if (ignoreLadderJumpTime > curtime && - ignoreLadderJumpTime - 0.2 < lastJumpButtonTime[this.jumper] && lastJumpButtonTime[this.jumper] < ignoreLadderJumpTime) + ignoreLadderJumpTime - IGNORE_JUMP_TIME < lastJumpButtonTime[this.jumper] && lastJumpButtonTime[this.jumper] < ignoreLadderJumpTime) { return JumpType_Invalid; } diff --git a/addons/sourcemod/scripting/include/gokz.inc b/addons/sourcemod/scripting/include/gokz.inc index f1087a51..b1e23444 100644 --- a/addons/sourcemod/scripting/include/gokz.inc +++ b/addons/sourcemod/scripting/include/gokz.inc @@ -40,6 +40,7 @@ enum ObsMode #define PI 3.14159265359 #define SPEED_NORMAL 250.0 #define SPEED_NO_WEAPON 260.0 +#define IGNORE_JUMP_TIME 0.2 stock float PLAYER_MINS[3] = {-16.0, -16.0, 0.0}; stock float PLAYER_MAXS[3] = {16.0, 16.0, 72.0}; stock float PLAYER_MAXS_DUCKED[3] = {16.0, 16.0, 54.0}; From 2e0dffc4491b629960e471cddb55655aa7e5b62a Mon Sep 17 00:00:00 2001 From: "zer0.k" Date: Wed, 25 May 2022 18:41:49 +0200 Subject: [PATCH 18/21] No longer validate jump if it was invalidated in the same tick --- addons/sourcemod/scripting/gokz-core/misc.sp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/sourcemod/scripting/gokz-core/misc.sp b/addons/sourcemod/scripting/gokz-core/misc.sp index 8ef86d2b..5b74ffcc 100644 --- a/addons/sourcemod/scripting/gokz-core/misc.sp +++ b/addons/sourcemod/scripting/gokz-core/misc.sp @@ -312,7 +312,7 @@ void JoinTeam(int client, int newTeam, bool restorePos) static bool validJump[MAXPLAYERS + 1]; static float validJumpTeleportOrigin[MAXPLAYERS + 1][3]; - +static int lastInvalidatedTick[MAXPLAYERS + 1]; bool GetValidJump(int client) { return validJump[client]; @@ -320,6 +320,7 @@ bool GetValidJump(int client) static void InvalidateJump(int client) { + lastInvalidatedTick[client] = GetGameTickCount(); if (validJump[client]) { validJump[client] = false; @@ -329,7 +330,7 @@ static void InvalidateJump(int client) void OnStopTouchGround_ValidJump(int client, bool jumped, bool ladderJump, bool jumpbug) { - if (Movement_GetMovetype(client) == MOVETYPE_WALK) + if (Movement_GetMovetype(client) == MOVETYPE_WALK && lastInvalidatedTick[client] != GetGameTickCount()) { validJump[client] = true; Call_GOKZ_OnJumpValidated(client, jumped, ladderJump, jumpbug); @@ -350,7 +351,7 @@ void OnPlayerRunCmdPost_ValidJump(int client) void OnChangeMovetype_ValidJump(int client, MoveType oldMovetype, MoveType newMovetype) { - if (oldMovetype == MOVETYPE_LADDER && newMovetype == MOVETYPE_WALK) // Ladderjump + if (oldMovetype == MOVETYPE_LADDER && newMovetype == MOVETYPE_WALK && lastInvalidatedTick[client] != GetGameTickCount()) // Ladderjump { validJump[client] = true; Call_GOKZ_OnJumpValidated(client, false, true, false); From 4fb7ce0e45ea59668d0820e4ebb051138a351c6e Mon Sep 17 00:00:00 2001 From: "zer0.k" Date: Thu, 26 May 2022 15:42:21 +0200 Subject: [PATCH 19/21] Revert space to tab changes in jump reports --- addons/sourcemod/scripting/gokz-jumpstats/jump_reporting.sp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/sourcemod/scripting/gokz-jumpstats/jump_reporting.sp b/addons/sourcemod/scripting/gokz-jumpstats/jump_reporting.sp index c625f444..4e1c5282 100644 --- a/addons/sourcemod/scripting/gokz-jumpstats/jump_reporting.sp +++ b/addons/sourcemod/scripting/gokz-jumpstats/jump_reporting.sp @@ -240,12 +240,12 @@ static void DoConsoleReport(int client, bool isFailstat, Jump jump, int tier, ch PrintToConsole(client, " #. %12t%12t%12t%12t%12t%9t%t", "Sync (Table)", "Gain (Table)", "Loss (Table)", "Airtime (Table)", "Width (Table)", "Overlap (Table)", "Dead Air (Table)"); if (jump.strafes_ticks[0] > 0) { - PrintToConsole(client, " 0. ---- ----- ----- %3.0f%% ----- -- --", GetStrafeAirtime(jump, 0)); + PrintToConsole(client, " 0. ---- ----- ----- %3.0f%% ----- -- --", GetStrafeAirtime(jump, 0)); } for (int strafe = 1; strafe <= jump.strafes && strafe < JS_MAX_TRACKED_STRAFES; strafe++) { - PrintToConsole(client, - " %2d. %3.0f%% %5.2f %5.2f %3.0f%% %5.1f° %2d %2d", + PrintToConsole(client, + " %2d. %3.0f%% %5.2f %5.2f %3.0f%% %5.1f° %2d %2d", strafe, GetStrafeSync(jump, strafe), jump.strafes_gain[strafe], From 5d2d8a47867fb3f51e2f403bd0e0c15a8ba44c47 Mon Sep 17 00:00:00 2001 From: "zer0.k" Date: Sun, 29 May 2022 00:59:01 +0200 Subject: [PATCH 20/21] Ignore triggerfix for trigger_push --- addons/sourcemod/scripting/gokz-core/triggerfix.sp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sourcemod/scripting/gokz-core/triggerfix.sp b/addons/sourcemod/scripting/gokz-core/triggerfix.sp index f9103f56..0379a950 100644 --- a/addons/sourcemod/scripting/gokz-core/triggerfix.sp +++ b/addons/sourcemod/scripting/gokz-core/triggerfix.sp @@ -342,9 +342,9 @@ static bool DoTriggerFix(int client, bool filterFix = false) { char className[64]; GetEntityClassname(trigger, className, sizeof(className)); - if (GetEntityFlags(client) & FL_BASEVELOCITY && StrEqual(className, "trigger_push")) + if (StrEqual(className, "trigger_push")) { - // We are currently affected by a push trigger, do not try to touch it again to prevent double boost. + // Completely ignore push triggers. continue; } // If the player is still touching the trigger on this tick, and Touch was not called for whatever reason From 972a2850c4fb0ae2c0f22f4f992f666c4d37fa1b Mon Sep 17 00:00:00 2001 From: "zer0.k" <61156310+zer0k-z@users.noreply.github.com> Date: Mon, 30 May 2022 10:50:34 +0200 Subject: [PATCH 21/21] Increase and optimize HUD update speed, add advanced speed color options, track jumpbugs in HUD (#296) * Increase and optimize HUD update speed, add advanced speed color options, track jumpbugs in HUD * Put jumpbug indicator into default speed panel, renamed deadstrafe indicator, add HUD updaterate options * Cache updaterate option as global variable, add default options for update rate * Merge branch 'dev' of https://github.com/KZGlobalTeam/gokz into better-hud --- addons/sourcemod/scripting/gokz-hud.sp | 32 ++++++++++- .../scripting/gokz-hud/info_panel.sp | 44 +++++++++++---- .../sourcemod/scripting/gokz-hud/options.sp | 14 +++++ .../scripting/gokz-hud/options_menu.sp | 12 +++++ .../scripting/gokz-hud/racing_text.sp | 3 +- .../scripting/gokz-hud/speed_text.sp | 30 +++++++---- .../scripting/gokz-hud/timer_text.sp | 3 +- .../sourcemod/scripting/gokz-hud/tp_menu.sp | 3 +- .../sourcemod/scripting/include/gokz/hud.inc | 54 +++++++++++++++---- .../translations/gokz-common.phrases.txt | 8 +++ .../translations/gokz-hud.phrases.txt | 16 ++++++ cfg/sourcemod/gokz/options_menu_sorting.cfg | 2 + 12 files changed, 189 insertions(+), 32 deletions(-) diff --git a/addons/sourcemod/scripting/gokz-hud.sp b/addons/sourcemod/scripting/gokz-hud.sp index 188cf511..04a3a84a 100644 --- a/addons/sourcemod/scripting/gokz-hud.sp +++ b/addons/sourcemod/scripting/gokz-hud.sp @@ -1,5 +1,6 @@ #include +#include #include #include @@ -30,6 +31,8 @@ public Plugin myinfo = bool gB_GOKZRacing; bool gB_GOKZReplays; bool gB_MenuShowing[MAXPLAYERS + 1]; +bool gB_JBTakeoff[MAXPLAYERS + 1]; +bool gB_FastUpdateRate[MAXPLAYERS + 1]; #include "gokz-hud/commands.sp" #include "gokz-hud/hide_weapon.sp" @@ -43,7 +46,6 @@ bool gB_MenuShowing[MAXPLAYERS + 1]; #include "gokz-hud/tp_menu.sp" - // =====[ PLUGIN EVENTS ]===== public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) @@ -80,6 +82,13 @@ public void OnAllPluginsLoaded() gB_GOKZRacing = LibraryExists("gokz-racing"); gB_GOKZReplays = LibraryExists("gokz-replays"); + for (int client = 1; client <= MaxClients; client++) + { + if (IsClientInGame(client)) + { + OnClientPutInServer(client); + } + } } public void OnLibraryAdded(const char[] name) @@ -103,6 +112,17 @@ public void OnLibraryRemoved(const char[] name) // =====[ CLIENT EVENTS ]===== +public void OnClientPutInServer(int client) +{ + SDKHook(client, SDKHook_PostThinkPost, OnPlayerPostThinkPost); +} + +public void OnPlayerPostThinkPost(int client) +{ + KZPlayer player = KZPlayer(client); + gB_JBTakeoff[client] = (gB_JBTakeoff[client] && !player.OnGround && !player.OnLadder && !player.Noclipping) || Movement_GetJumpbugged(client); +} + public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float vel[3], const float angles[3], int weapon, int subtype, int cmdnum, int tickcount, int seed, const int mouse[2]) { if (!IsValidClient(client)) @@ -216,10 +236,17 @@ public void GOKZ_OnOptionChanged(int client, const char[] option, any newValue) OnOptionChanged_Menu(client, hudOption); OnOptionChanged_HideWeapon(client, hudOption); OnOptionChanged_Options(client, hudOption, newValue); + if (hudOption == HUDOption_UpdateRate) + { + gB_FastUpdateRate[client] = GOKZ_HUD_GetOption(client, HUDOption_UpdateRate) == UpdateRate_Fast; + } } } - +public void GOKZ_OnOptionsLoaded(int client) +{ + gB_FastUpdateRate[client] = GOKZ_HUD_GetOption(client, HUDOption_UpdateRate) == UpdateRate_Fast; +} // =====[ OTHER EVENTS ]===== @@ -264,6 +291,7 @@ static void SetHUDInfo(KZPlayer player, HUDInfo info, int cmdnum) info.ID = player.ID; info.Jumped = player.Jumped; info.HitPerf = player.GOKZHitPerf; + info.HitJB = gB_JBTakeoff[info.ID]; info.TakeoffSpeed = player.GOKZTakeoffSpeed; info.IsTakeoff = Movement_GetTakeoffCmdNum(player.ID) == cmdnum; info.Buttons = player.Buttons; diff --git a/addons/sourcemod/scripting/gokz-hud/info_panel.sp b/addons/sourcemod/scripting/gokz-hud/info_panel.sp index 54e8f94a..d4393fa2 100644 --- a/addons/sourcemod/scripting/gokz-hud/info_panel.sp +++ b/addons/sourcemod/scripting/gokz-hud/info_panel.sp @@ -12,7 +12,6 @@ static bool infoPanelOnGroundLast[MAXPLAYERS + 1]; static bool infoPanelShowDuckString[MAXPLAYERS + 1]; - // =====[ PUBLIC ]===== bool IsDrawingInfoPanel(int client) @@ -28,7 +27,15 @@ bool IsDrawingInfoPanel(int client) void OnPlayerRunCmdPost_InfoPanel(int client, int cmdnum, HUDInfo info) { - if (cmdnum % 10 == 0 || info.IsTakeoff) + int updateSpeed = 10; + if (gB_FastUpdateRate[client]) + { + // The hint text panel update speed depends on the client ping. + // To optimize resource usage, we scale the update speed with it. + // The fastest speed the client can get is around once every 2 ticks. + updateSpeed = RoundToFloor(GetClientAvgLatency(client, NetFlow_Outgoing) / GetTickInterval()); + } + if (cmdnum % updateSpeed == 0 || info.IsTakeoff) { UpdateInfoPanel(client, info); } @@ -159,11 +166,23 @@ static char[] GetSpeedString(KZPlayer player, HUDInfo info) } else { - FormatEx(speedString, sizeof(speedString), - "%T: %.0f %s\n", - "Info Panel Text - Speed", player.ID, - RoundToPowerOfTen(info.Speed, -2), - GetTakeoffString(info)); + if (GOKZ_HUD_GetOption(player.ID, HUDOption_DeadstrafeColor) == DeadstrafeColor_Enabled + && Movement_GetVerticalVelocity(info.ID) > 0.0 && Movement_GetVerticalVelocity(info.ID) < 140.0) + { + FormatEx(speedString, sizeof(speedString), + "%T: %.0f %s\n", + "Info Panel Text - Speed", player.ID, + RoundToPowerOfTen(info.Speed, -2), + GetTakeoffString(info)); + } + else + { + FormatEx(speedString, sizeof(speedString), + "%T: %.0f %s\n", + "Info Panel Text - Speed", player.ID, + RoundToPowerOfTen(info.Speed, -2), + GetTakeoffString(info)); + } } } return speedString; @@ -189,8 +208,15 @@ static char[] GetTakeoffString(HUDInfo info) duckString = ""; infoPanelShowDuckString[info.ID] = false; } - - if (info.HitPerf) + + if (info.HitJB) + { + FormatEx(takeoffString, sizeof(takeoffString), + "(%.0f)%s", + RoundToPowerOfTen(info.TakeoffSpeed, -2), + duckString); + } + else if (info.HitPerf) { FormatEx(takeoffString, sizeof(takeoffString), "(%.0f)%s", diff --git a/addons/sourcemod/scripting/gokz-hud/options.sp b/addons/sourcemod/scripting/gokz-hud/options.sp index a7eb5a15..d8f603bb 100644 --- a/addons/sourcemod/scripting/gokz-hud/options.sp +++ b/addons/sourcemod/scripting/gokz-hud/options.sp @@ -122,6 +122,20 @@ static void PrintOptionChangeMessage(int client, HUDOption option, any newValue) } } } + case HUDOption_DeadstrafeColor: + { + switch (newValue) + { + case DeadstrafeColor_Disabled: + { + GOKZ_PrintToChat(client, true, "%t", "Option - Dead Strafe - Disable"); + } + case DeadstrafeColor_Enabled: + { + GOKZ_PrintToChat(client, true, "%t", "Option - Dead Strafe - Enable"); + } + } + } case HUDOption_ShowSpectators: { switch (newValue) diff --git a/addons/sourcemod/scripting/gokz-hud/options_menu.sp b/addons/sourcemod/scripting/gokz-hud/options_menu.sp index 7eb01c5e..b68999de 100644 --- a/addons/sourcemod/scripting/gokz-hud/options_menu.sp +++ b/addons/sourcemod/scripting/gokz-hud/options_menu.sp @@ -120,6 +120,18 @@ public void TopMenuHandler_HUD(TopMenu topmenu, TopMenuAction action, TopMenuObj gC_HUDOptionPhrases[option], param, gC_ShowControlsPhrases[GOKZ_HUD_GetOption(param, option)], param); } + case HUDOption_DeadstrafeColor: + { + FormatEx(buffer, maxlength, "%T - %T", + gC_HUDOptionPhrases[option], param, + gC_DeadstrafeColorPhrases[GOKZ_HUD_GetOption(param, option)], param); + } + case HUDOption_UpdateRate: + { + FormatEx(buffer, maxlength, "%T - %T", + gC_HUDOptionPhrases[option], param, + gC_HUDUpdateRatePhrases[GOKZ_HUD_GetOption(param, option)], param); + } case HUDOption_ShowSpectators: { FormatEx(buffer, maxlength, "%T - %T", diff --git a/addons/sourcemod/scripting/gokz-hud/racing_text.sp b/addons/sourcemod/scripting/gokz-hud/racing_text.sp index 732cb425..a341a14e 100644 --- a/addons/sourcemod/scripting/gokz-hud/racing_text.sp +++ b/addons/sourcemod/scripting/gokz-hud/racing_text.sp @@ -21,7 +21,8 @@ void OnPluginStart_RacingText() void OnPlayerRunCmdPost_RacingText(int client, int cmdnum) { - if (gB_GOKZRacing && cmdnum % 6 == 3) + int updateSpeed = gB_FastUpdateRate[client] ? 3 : 6; + if (gB_GOKZRacing && cmdnum % updateSpeed == 2) { UpdateRacingText(client); } diff --git a/addons/sourcemod/scripting/gokz-hud/speed_text.sp b/addons/sourcemod/scripting/gokz-hud/speed_text.sp index 8272aa3a..e4b30ccf 100644 --- a/addons/sourcemod/scripting/gokz-hud/speed_text.sp +++ b/addons/sourcemod/scripting/gokz-hud/speed_text.sp @@ -24,7 +24,8 @@ void OnPluginStart_SpeedText() void OnPlayerRunCmdPost_SpeedText(int client, int cmdnum, HUDInfo info) { - if (cmdnum % 6 == 0 || info.IsTakeoff) + int updateSpeed = gB_FastUpdateRate[client] ? 3 : 6; + if (cmdnum % updateSpeed == 0 || info.IsTakeoff) { UpdateSpeedText(client, info); } @@ -69,16 +70,27 @@ static void ShowSpeedText(KZPlayer player, HUDInfo info) return; } - int colour[4]; // RGBA - if (info.HitPerf && !info.OnGround && !info.OnLadder && !info.Noclipping) + int colour[4] = { 255, 255, 255, 0 }; // RGBA + float velZ = Movement_GetVerticalVelocity(info.ID); + if (!info.OnGround && !info.OnLadder && !info.Noclipping) { - colour = { 64, 255, 64, 0 }; - } - else - { - colour = { 255, 255, 255, 0 }; + if (GOKZ_HUD_GetOption(player.ID, HUDOption_DeadstrafeColor) == DeadstrafeColor_Enabled && velZ > 0.0 && velZ < 140.0) + { + colour = { 255, 32, 32, 0 }; + } + else if (info.HitPerf) + { + if (info.HitJB) + { + colour = { 255, 255, 32, 0 }; + } + else + { + colour = { 64, 255, 64, 0 }; + } + } } - + switch (player.SpeedText) { case SpeedText_Bottom: diff --git a/addons/sourcemod/scripting/gokz-hud/timer_text.sp b/addons/sourcemod/scripting/gokz-hud/timer_text.sp index 866e9aad..6785a648 100644 --- a/addons/sourcemod/scripting/gokz-hud/timer_text.sp +++ b/addons/sourcemod/scripting/gokz-hud/timer_text.sp @@ -43,7 +43,8 @@ void OnPluginStart_TimerText() void OnPlayerRunCmdPost_TimerText(int client, int cmdnum, HUDInfo info) { - if (cmdnum % 6 == 3) + int updateSpeed = gB_FastUpdateRate[client] ? 3 : 6; + if (cmdnum % updateSpeed == 1) { UpdateTimerText(client, info); } diff --git a/addons/sourcemod/scripting/gokz-hud/tp_menu.sp b/addons/sourcemod/scripting/gokz-hud/tp_menu.sp index 26072504..ac74f220 100644 --- a/addons/sourcemod/scripting/gokz-hud/tp_menu.sp +++ b/addons/sourcemod/scripting/gokz-hud/tp_menu.sp @@ -21,7 +21,8 @@ void OnPlayerRunCmdPost_TPMenu(int client, int cmdnum, HUDInfo info) { - if (cmdnum % 6 == 3) + int updateSpeed = gB_FastUpdateRate[client] ? 3 : 6; + if (cmdnum % updateSpeed == 2) { UpdateTPMenu(client, info); } diff --git a/addons/sourcemod/scripting/include/gokz/hud.inc b/addons/sourcemod/scripting/include/gokz/hud.inc index c5d43ecd..7ca88a90 100644 --- a/addons/sourcemod/scripting/include/gokz/hud.inc +++ b/addons/sourcemod/scripting/include/gokz/hud.inc @@ -22,9 +22,11 @@ enum HUDOption: HUDOption_TimerText, HUDOption_TimerStyle, HUDOption_TimerType, - HUDOption_SpeedText, + HUDOption_SpeedText, HUDOption_ShowWeapon, - HUDOption_ShowControls, + HUDOption_ShowControls, + HUDOption_DeadstrafeColor, + HUDOption_UpdateRate, HUDOption_ShowSpectators, HUDOPTION_COUNT }; @@ -98,6 +100,13 @@ enum REPLAYCONTROLS_COUNT }; +enum +{ + DeadstrafeColor_Disabled = 0, + DeadstrafeColor_Enabled, + DEADSTRAFECOLOR_COUNT +}; + enum { ShowSpecs_Disabled = 0, @@ -107,6 +116,12 @@ enum }; +enum +{ + UpdateRate_Slow = 0, + UpdateRate_Fast, + UPDATERATE_COUNT, +}; // =====[ STRUCTS ]====== @@ -126,6 +141,7 @@ enum struct HUDInfo int ID; bool Jumped; bool HitPerf; + bool HitJB; float TakeoffSpeed; int Buttons; int CurrentTeleport; @@ -150,6 +166,8 @@ stock char gC_HUDOptionNames[HUDOPTION_COUNT][] = "GOKZ HUD - Speed Text", "GOKZ HUD - Show Weapon", "GOKZ HUD - Show Controls", + "GOKZ HUD - Dead Strafe", + "GOKZ HUD - Update Rate", "GOKZ HUD - Show Spectators" }; @@ -161,9 +179,11 @@ stock char gC_HUDOptionDescriptions[HUDOPTION_COUNT][] = "Timer Display - 0 = Disabled, 1 = Centre Panel, 2 = Teleport Menu, 3 = Bottom, 4 = Top", "Timer Style - 0 = Standard, 1 = Precise", "Timer Type - 0 = Disabled, 1 = Enabled", - "Speed Display - 0 = Disabled, 1 = Centre Panel, 2 = Bottom", + "Speed Display - 0 = Disabled, 1 = Centre Panel, 2 = Bottom", "Weapon Viewmodel - 0 = Disabled, 1 = Enabled", - "Replay Controls Display - 0 = Disabled, 1 = Enabled", + "Replay Controls Display - 0 = Disbled, 1 = Enabled", + "Dead Strafe Indicator - 0 = Disabled, 1 = Enabled", + "HUD Update Rate - 0 = Slow, 1 = Fast", "Show Spectators - 0 = Disabled, 1 = Number Only, 2 = Number and Names" }; @@ -175,9 +195,11 @@ stock char gC_HUDOptionPhrases[HUDOPTION_COUNT][] = "Options Menu - Timer Text", "Options Menu - Timer Style", "Options Menu - Timer Type", - "Options Menu - Speed Text", + "Options Menu - Speed Text", "Options Menu - Show Weapon", "Options Menu - Show Controls", + "Options Menu - Dead Strafe Indicator", + "Options Menu - Update Rate", "Options Menu - Show Spectators" }; @@ -189,9 +211,11 @@ stock int gI_HUDOptionCounts[HUDOPTION_COUNT] = TIMERTEXT_COUNT, TIMERSTYLE_COUNT, TIMERTYPE_COUNT, - SPEEDTEXT_COUNT, + SPEEDTEXT_COUNT, SHOWWEAPON_COUNT, REPLAYCONTROLS_COUNT, + DEADSTRAFECOLOR_COUNT, + UPDATERATE_COUNT, SHOWSPECS_COUNT }; @@ -203,9 +227,11 @@ stock int gI_HUDOptionDefaults[HUDOPTION_COUNT] = TimerText_InfoPanel, TimerStyle_Standard, TimerType_Enabled, - SpeedText_InfoPanel, + SpeedText_InfoPanel, ShowWeapon_Enabled, ReplayControls_Enabled, + DeadstrafeColor_Disabled, + UpdateRate_Slow, ShowSpecs_Disabled }; @@ -251,14 +277,24 @@ stock char gC_ShowControlsPhrases[REPLAYCONTROLS_COUNT][] = "Options Menu - Enabled" }; +stock char gC_DeadstrafeColorPhrases[DEADSTRAFECOLOR_COUNT][] = +{ + "Options Menu - Disabled", + "Options Menu - Enabled" +}; + stock char gC_ShowSpecsPhrases[SHOWSPECS_COUNT][] = { "Options Menu - Disabled", "Options Menu - Number", "Options Menu - Number and Names" -} - +}; +stock char gC_HUDUpdateRatePhrases[UPDATERATE_COUNT][]= +{ + "Options Menu - Slow", + "Options Menu - Fast" +}; // =====[ STOCKS ]===== diff --git a/addons/sourcemod/translations/gokz-common.phrases.txt b/addons/sourcemod/translations/gokz-common.phrases.txt index 1f50a834..5b373251 100644 --- a/addons/sourcemod/translations/gokz-common.phrases.txt +++ b/addons/sourcemod/translations/gokz-common.phrases.txt @@ -110,4 +110,12 @@ "chi" "高级" "ru" "Продвинутый" } + "Options Menu - Slow" + { + "en" "Slow" + } + "Options Menu - Fast" + { + "en" "Fast" + } } \ No newline at end of file diff --git a/addons/sourcemod/translations/gokz-hud.phrases.txt b/addons/sourcemod/translations/gokz-hud.phrases.txt index b34da411..1e94e16b 100644 --- a/addons/sourcemod/translations/gokz-hud.phrases.txt +++ b/addons/sourcemod/translations/gokz-hud.phrases.txt @@ -71,6 +71,14 @@ { "en" "{grey}Replay controls are now hidden." } + "Option - Dead Strafe - Enable" + { + "en" "{grey}The speed text now indicates period with low airstrafe gain." + } + "Option - Dead Strafe - Disable" + { + "en" "{grey}Dead strafe period indicator disabled." + } "Option - Show Spectators - Disable" { "en" "{grey}Spectators are now not shown." @@ -242,6 +250,10 @@ "chi" "空速文字" "ru" "Текст скорости" } + "Options Menu - Dead Strafe Indicator" + { + "en" "Dead strafe period" + } "Options Menu - Show Weapon" { "en" "Show weapon" @@ -252,6 +264,10 @@ { "en" "Show replay controls" } + "Options Menu - Update Rate" + { + "en" "Update rate" + } "Options Menu - Show Spectators" { "en" "Show spectators" diff --git a/cfg/sourcemod/gokz/options_menu_sorting.cfg b/cfg/sourcemod/gokz/options_menu_sorting.cfg index 01b49c23..1dffd7d7 100644 --- a/cfg/sourcemod/gokz/options_menu_sorting.cfg +++ b/cfg/sourcemod/gokz/options_menu_sorting.cfg @@ -23,11 +23,13 @@ } "HUD" { + "item" "GOKZ HUD - Update Rate" "item" "GOKZ HUD - Teleport Menu" "item" "GOKZ HUD - Centre Panel" "item" "GOKZ HUD - Timer Text" "item" "GOKZ HUD - Timer Style" "item" "GOKZ HUD - Speed Text" + "item" "GOKZ HUD - Dead Strafe" "item" "GOKZ HUD - Show Keys" "item" "GOKZ HUD - Show Weapon" "item" "GOKZ HUD - Show Controls"