Skip to content

Commit

Permalink
Merge pull request #286 from KZGlobalTeam/dev
Browse files Browse the repository at this point in the history
3.2.0
  • Loading branch information
zealain authored Mar 25, 2022
2 parents 977423c + b373cc0 commit 33a3a49
Show file tree
Hide file tree
Showing 41 changed files with 237 additions and 55 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
on:
push:
branches: [ master, dev ]
tags: [ 'v*' ]
pull_request:
branches: [ master, dev ]

Expand Down
6 changes: 6 additions & 0 deletions addons/sourcemod/scripting/gokz-core/natives.sp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ void CreateNatives()
CreateNative("GOKZ_SetValidJumpOrigin", Native_SetValidJumpOrigin);

CreateNative("GOKZ_GetTimerRunning", Native_GetTimerRunning);
CreateNative("GOKZ_GetValidTimer", Native_GetValidTimer);
CreateNative("GOKZ_GetCourse", Native_GetCourse);
CreateNative("GOKZ_SetCourse", Native_SetCourse);
CreateNative("GOKZ_GetPaused", Native_GetPaused);
Expand Down Expand Up @@ -354,6 +355,11 @@ public int Native_GetTimerRunning(Handle plugin, int numParams)
return view_as<int>(GetTimerRunning(GetNativeCell(1)));
}

public int Native_GetValidTimer(Handle plugin, int numParams)
{
return view_as<int>(GetValidTimer(GetNativeCell(1)));
}

public int Native_GetCourse(Handle plugin, int numParams)
{
return GetCurrentCourse(GetNativeCell(1));
Expand Down
3 changes: 3 additions & 0 deletions addons/sourcemod/scripting/gokz-core/timer/pause.sp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ void Resume(int client)
{
Movement_SetMovetype(client, MOVETYPE_WALK);
}

// Prevent noclip exploit
SetEntProp(client, Prop_Send, "m_CollisionGroup", GOKZ_COLLISION_GROUP_STANDARD);
paused[client] = false;
if (GetTimerRunning(client))
{
Expand Down
5 changes: 5 additions & 0 deletions addons/sourcemod/scripting/gokz-core/timer/timer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ bool GetTimerRunning(int client)
return timerRunning[client];
}

bool GetValidTimer(int client)
{
return validTime[client];
}

float GetCurrentTime(int client)
{
return currentTime[client];
Expand Down
9 changes: 8 additions & 1 deletion addons/sourcemod/scripting/gokz-core/triggerfix.sp
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,15 @@ static bool DoTriggerFix(int client, bool filterFix = false)
}
else if (!triggerTouchFired[client][trigger])
{
char className[64];
GetEntityClassname(trigger, className, sizeof(className));
if (GetEntityFlags(client) & FL_BASEVELOCITY && StrEqual(className, "trigger_push"))
{
// We are currently affected by a push trigger, do not try to touch it again to prevent double boost.
continue;
}
// If the player is still touching the trigger on this tick, and Touch was not called for whatever reason
// in the last tick, we make sure that it is called now.
// in the last tick, we make sure that it is called now.
SDKCall(markEntitiesAsTouching, serverGameEnts, client, trigger);
didSomething = true;
}
Expand Down
66 changes: 66 additions & 0 deletions addons/sourcemod/scripting/gokz-errorboxfixer.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include <sourcemod>
#include <sdktools>

#include <gokz>

#undef REQUIRE_PLUGIN
#include <updater>

#pragma newdecls required
#pragma semicolon 1

public Plugin myinfo =
{
name = "GOKZ KZErrorBoxFixer",
author = "1NutWunDeR",
description = "Adds missing models for KZ maps",
version = GOKZ_VERSION,
url = "https://bitbucket.org/kztimerglobalteam/gokz"
};

#define UPDATER_URL GOKZ_UPDATER_BASE_URL..."gokz-errorboxfixer.txt"

public void OnAllPluginsLoaded()
{
if (LibraryExists("updater"))
{
Updater_AddPlugin(UPDATER_URL);
}
}

public void OnLibraryAdded(const char[] name)
{
if (StrEqual(name, "updater"))
{
Updater_AddPlugin(UPDATER_URL);
}
}

public void OnMapStart()
{
AddFileToDownloadsTable("models/kzmod/buttons/stand_button.vtf");
AddFileToDownloadsTable("models/kzmod/buttons/stand_button.vmt");
AddFileToDownloadsTable("models/kzmod/buttons/stand_button_normal.vtf");
AddFileToDownloadsTable("models/kzmod/buttons/standing_button.mdl");
AddFileToDownloadsTable("models/kzmod/buttons/standing_button.dx90.vtx");
AddFileToDownloadsTable("models/kzmod/buttons/standing_button.phy");
AddFileToDownloadsTable("models/kzmod/buttons/standing_button.vvd");
AddFileToDownloadsTable("models/kzmod/buttons/stone_button.mdl");
AddFileToDownloadsTable("models/kzmod/buttons/stone_button.dx90.vtx");
AddFileToDownloadsTable("models/kzmod/buttons/stone_button.phy");
AddFileToDownloadsTable("models/kzmod/buttons/stone_button.vvd");
AddFileToDownloadsTable("models/props_wasteland/pipecluster002a.mdl");
AddFileToDownloadsTable("models/props_wasteland/pipecluster002a.dx90.vtx");
AddFileToDownloadsTable("models/props_wasteland/pipecluster002a.phy");
AddFileToDownloadsTable("models/props_wasteland/pipecluster002a.vvd");
AddFileToDownloadsTable("materials/kzmod/starttimersign.vmt");
AddFileToDownloadsTable("materials/kzmod/starttimersign.vtf");
AddFileToDownloadsTable("materials/kzmod/stoptimersign.vmt");
AddFileToDownloadsTable("materials/kzmod/stoptimersign.vtf");
PrecacheModel("models/kzmod/buttons/stand_button.vmt", true);
PrecacheModel("models/props_wasteland/pipecluster002a.mdl", true);
PrecacheModel("models/kzmod/buttons/standing_button.mdl", true);
PrecacheModel("models/kzmod/buttons/stone_button.mdl", true);
PrecacheModel("materials/kzmod/starttimersign.vmt", true);
PrecacheModel("materials/kzmod/stoptimersign.vmt", true);
}
5 changes: 4 additions & 1 deletion addons/sourcemod/scripting/gokz-global.sp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,10 @@ public Action GOKZ_OnTimerNativeCalledExternally(Handle plugin, int client)
{
char pluginName[64];
GetPluginInfo(plugin, PlInfo_Name, pluginName, sizeof(pluginName));
LogMessage("Invalidated %N's run as gokz-core native was called by \"%s\"", client, pluginName);
if (GOKZ_GetTimerRunning(client) && GOKZ_GetValidTimer(client))
{
LogMessage("Invalidated %N's run as gokz-core native was called by \"%s\"", client, pluginName);
}
GOKZ_InvalidateRun(client);
return Plugin_Continue;
}
Expand Down
8 changes: 3 additions & 5 deletions addons/sourcemod/scripting/gokz-localranks/db/sql.sp
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,9 @@ SELECT b.JumpID, b.JumpType, b.Distance, b.Strafes, b.Sync, b.Pre, b.Max, b.Airt
SELECT a.SteamID32, a.Mode, a.JumpType, MAX(a.Distance) Distance \
FROM Jumpstats a \
WHERE a.SteamID32=%d AND a.Mode=%d AND NOT a.IsBlockJump \
GROUP BY a.JumpType \
GROUP BY a.JumpType, a.Mode, a.SteamID32 \
) a ON a.JumpType=b.JumpType AND a.Distance=b.Distance \
WHERE a.SteamID32=b.SteamID32 AND a.Mode=b.Mode AND NOT b.IsBlockJump \
GROUP BY b.JumpType \
ORDER BY b.JumpType";

char sql_jumpstats_getblockpbs[] = "\
Expand All @@ -403,11 +402,10 @@ SELECT c.JumpID, c.JumpType, c.Block, c.Distance, c.Strafes, c.Sync, c.Pre, c.Ma
SELECT a.SteamID32, a.Mode, a.JumpType, MAX(a.Block) Block \
FROM Jumpstats a \
WHERE a.SteamID32=%d AND a.Mode=%d AND a.IsBlockJump \
GROUP BY a.JumpType \
GROUP BY a.JumpType, a.Mode, a.SteamID32 \
) a ON a.JumpType=b.JumpType AND a.Block=b.Block \
WHERE a.SteamID32=b.SteamID32 AND a.Mode=b.Mode AND b.IsBlockJump \
GROUP BY b.JumpType \
GROUP BY a.JumpType, a.Mode, a.SteamID32, a.Block \
) b ON b.JumpType=c.JumpType AND b.Block=c.Block AND b.Distance=c.Distance \
WHERE b.SteamID32=c.SteamID32 AND b.Mode=c.Mode AND c.IsBlockJump \
GROUP BY c.JumpType \
ORDER BY c.JumpType";
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-mode-kztimer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Plugin myinfo =

#define UPDATER_URL GOKZ_UPDATER_BASE_URL..."gokz-mode-kztimer.txt"

#define MODE_VERSION 211
#define MODE_VERSION 212
#define DUCK_SPEED_NORMAL 8.0
#define PRE_VELMOD_MAX 1.104 // Calculated 276/250
#define PERF_SPEED_CAP 380.0
Expand Down
10 changes: 6 additions & 4 deletions addons/sourcemod/scripting/gokz-mode-simplekz.sp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Plugin myinfo =

#define UPDATER_URL GOKZ_UPDATER_BASE_URL..."gokz-mode-simplekz.txt"

#define MODE_VERSION 15
#define MODE_VERSION 16
#define PS_MAX_REWARD_TURN_RATE 0.703125 // Degrees per tick (90 degrees per second)
#define PS_MAX_TURN_RATE_DECREMENT 0.015625 // Degrees per tick (2 degrees per second)
#define PS_SPEED_MAX 26.54321 // Units
Expand Down Expand Up @@ -586,9 +586,9 @@ public void Movement_OnStopTouchGround(int client)
void NerfRealPerf(KZPlayer player, float origin[3])
{
// Not worth worrying about if player is already falling
// player.VerticalVelocity is not updated yet! Use takeoff velocity.
// player.VerticalVelocity is not updated yet! Use processing velocity.
float velocity[3];
player.GetTakeoffVelocity(velocity);
Movement_GetProcessingVelocity(player.ID, velocity);
if (velocity[2] < EPSILON)
{
return;
Expand Down Expand Up @@ -630,9 +630,11 @@ void ApplyTweakedTakeoffSpeed(KZPlayer player, float velocity[3])
// because current velocity direction can change drastically in just one tick (eg. walls)
// and it doesnt make sense for the new velocity to push you in that direction.

float newVelocity[3];
float newVelocity[3], baseVelocity[3];
player.GetLandingVelocity(newVelocity);
player.GetBaseVelocity(baseVelocity);
SetVectorHorizontalLength(newVelocity, CalcTweakedTakeoffSpeed(player));
AddVectors(newVelocity, baseVelocity, newVelocity); // For backwards compatibility
velocity[0] = newVelocity[0];
velocity[1] = newVelocity[1];
}
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-mode-vanilla.sp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Plugin myinfo =

#define UPDATER_URL GOKZ_UPDATER_BASE_URL..."gokz-mode-vanilla.txt"

#define MODE_VERSION 11
#define MODE_VERSION 12

float gF_ModeCVarValues[MODECVAR_COUNT] =
{
Expand Down
59 changes: 46 additions & 13 deletions addons/sourcemod/scripting/gokz-profile.sp
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ public void OnAllPluginsLoaded()
}
gB_Localranks = LibraryExists("gokz-localranks");
gB_Chat = LibraryExists("gokz-chat");
for (int client = 1; client < MaxClients; client++)

for (int client = 1; client <= MaxClients; client++)
{
if (IsValidClient(client) && !IsFakeClient(client))
{
UpdateRank(client, GOKZ_GetCoreOption(client, Option_Mode));
}
}

TopMenu topMenu;
if (LibraryExists("gokz-core") && ((topMenu = GOKZ_GetOptionsTopMenu()) != null))
{
Expand Down Expand Up @@ -96,6 +97,18 @@ public void OnLibraryRemoved(const char[] name)

// =====[ EVENTS ]=====

public void OnRebuildAdminCache(AdminCachePart part)
{
for (int client = 1; client <= MaxClients; client++)
{
if (IsValidClient(client) && !IsFakeClient(client))
{
int mode = GOKZ_GetCoreOption(client, Option_Mode);
UpdateRank(client, mode);
}
}
}

public void GOKZ_OnOptionsMenuCreated(TopMenu topMenu)
{
OnOptionsMenuCreated_OptionsMenu(topMenu);
Expand All @@ -120,7 +133,7 @@ public void OnClientConnected(int client)
{
for (int mode = 0; mode < MODE_COUNT; mode++)
{
gI_Rank[client][mode] = -1;
gI_Rank[client][mode] = 0;
}
Profile_OnClientConnected(client);
}
Expand Down Expand Up @@ -157,13 +170,13 @@ public void UpdateRank(int client, int mode)
{
return;
}
int tagType = GOKZ_GetOption(client, gC_ProfileOptionNames[ProfileOption_TagType]);

int tagType = GetAvailableTagTypeOrDefault(client);

if (tagType != ProfileTagType_Rank)
{
char clanTag[64], chatTag[32], color[64];

if (tagType == ProfileTagType_Admin)
{
FormatEx(clanTag, sizeof(clanTag), "[%s %T]", gC_ModeNamesShort[mode], "Tag - Admin", client);
Expand All @@ -176,13 +189,13 @@ public void UpdateRank(int client, int mode)
FormatEx(chatTag, sizeof(chatTag), "%T", "Tag - VIP", client);
color = TAG_COLOR_VIP;
}

if (GOKZ_GetOption(client, gC_ProfileOptionNames[ProfileOption_ShowRankClanTag]) != ProfileOptionBool_Enabled)
{
FormatEx(clanTag, sizeof(clanTag), "[%s]", gC_ModeNamesShort[mode]);
}
CS_SetClientClanTag(client, clanTag);

if (gB_Chat)
{
if (GOKZ_GetOption(client, gC_ProfileOptionNames[ProfileOption_ShowRankChat]) == ProfileOptionBool_Enabled)
Expand All @@ -196,7 +209,7 @@ public void UpdateRank(int client, int mode)
}
return;
}

int points = GOKZ_GL_GetRankPoints(client, mode);
int rank;
for (rank = 1; rank < RANK_COUNT; rank++)
Expand All @@ -207,7 +220,7 @@ public void UpdateRank(int client, int mode)
}
}
rank--;

if (GOKZ_GetCoreOption(client, Option_Mode) == mode)
{
if (points == -1)
Expand All @@ -219,7 +232,7 @@ public void UpdateRank(int client, int mode)
UpdateTags(client, rank, mode);
}
}

if (gI_Rank[client][mode] != rank)
{
gI_Rank[client][mode] = rank;
Expand All @@ -241,7 +254,7 @@ void UpdateTags(int client, int rank, int mode)
FormatEx(str, sizeof(str), "[%s]", gC_ModeNamesShort[mode]);
CS_SetClientClanTag(client, str);
}

if (gB_Chat)
{
if (rank != -1 &&
Expand All @@ -256,7 +269,27 @@ void UpdateTags(int client, int rank, int mode)
}
}

bool CanUseTagType(int client, int tagType)
{
switch (tagType)
{
case ProfileTagType_Rank: return true;
case ProfileTagType_VIP: return CheckCommandAccess(client, "gokz_flag_vip", ADMFLAG_CUSTOM1);
case ProfileTagType_Admin: return CheckCommandAccess(client, "gokz_flag_admin", ADMFLAG_GENERIC);
default: return false;
}
}

int GetAvailableTagTypeOrDefault(int client)
{
int tagType = GOKZ_GetOption(client, gC_ProfileOptionNames[ProfileOption_TagType]);
if (!CanUseTagType(client, tagType))
{
return ProfileTagType_Rank;
}

return tagType;
}

// =====[ COMMANDS ]=====

Expand Down
Loading

0 comments on commit 33a3a49

Please sign in to comment.