Skip to content

Commit

Permalink
Merge branch 'SirPlease:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
altair-sossai authored Aug 13, 2024
2 parents 6c060c2 + b2a47fd commit d5f2f66
Show file tree
Hide file tree
Showing 34 changed files with 513 additions and 30 deletions.
Binary file modified addons/sourcemod/plugins/optional/current.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d2_horde_equaliser.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d2_tank_horde_monitor.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d2_tankrage.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d_tank_control_eq.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d_weapon_limits.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/readyup.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/si_class_announce.smx
Binary file not shown.
36 changes: 34 additions & 2 deletions addons/sourcemod/scripting/current.sp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <sourcemod>
#include <left4dhooks>
#include <colors>

#define TEAM_SURVIVORS 2

Expand All @@ -13,12 +14,13 @@ public Plugin myinfo =
name = "L4D2 Survivor Progress",
author = "CanadaRox, Visor",
description = "Print survivor progress in flow percents ",
version = "2.0.3",
version = "2.0.4",
url = "https://github.com/SirPlease/L4D2-Competitive-Rework"
};

public void OnPluginStart()
{
LoadTranslation("current.phrases");
g_hVsBossBuffer = FindConVar("versus_boss_buffer");

RegConsoleCmd("sm_cur", CurrentCmd);
Expand All @@ -28,17 +30,27 @@ public void OnPluginStart()
Action CurrentCmd(int client, int args)
{
int boss_proximity = RoundToNearest(GetBossProximity() * 100.0);
PrintToChat(client, "\x01Current: \x04%d%%", boss_proximity);
CPrintToChat(client, "%t %t", "Tag", "Current", boss_proximity);
return Plugin_Handled;
}

/**
* Calculates the proximity of the boss to the survivors.
*
* @return The proximity value, ranging from 0.0 to 1.0.
*/
float GetBossProximity()
{
float proximity = GetMaxSurvivorCompletion() + g_hVsBossBuffer.FloatValue / L4D2Direct_GetMapMaxFlowDistance();

return (proximity > 1.0) ? 1.0 : proximity;
}

/**
* Calculates the maximum completion flow for survivors in the game.
*
* @return The maximum completion flow for survivors.
*/
float GetMaxSurvivorCompletion()
{
float flow = 0.0, tmp_flow = 0.0, origin[3];
Expand All @@ -56,3 +68,23 @@ float GetMaxSurvivorCompletion()

return (flow / L4D2Direct_GetMapMaxFlowDistance());
}

/**
* Check if the translation file exists
*
* @param translation Translation name.
* @noreturn
*/
stock void LoadTranslation(const char[] translation)
{
char
sPath[PLATFORM_MAX_PATH],
sName[64];

Format(sName, sizeof(sName), "translations/%s.txt", translation);
BuildPath(Path_SM, sPath, sizeof(sPath), sName);
if (!FileExists(sPath))
SetFailState("Missing translation file %s.txt", translation);

LoadTranslations(translation);
}
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/include/colors.inc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define CSOURCETV 1 // Enable print for SourceTV

#define MAX_MESSAGE_LENGTH 250

#define MAX_COLORS 12

#define SERVER_INDEX 0
Expand Down
29 changes: 25 additions & 4 deletions addons/sourcemod/scripting/l4d2_horde_equaliser.sp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ public Plugin myinfo =
name = "L4D2 Horde Equaliser",
author = "Visor (original idea by Sir), A1m`",
description = "Make certain event hordes finite",
version = "3.0.9",
version = "3.0.10",
url = "https://github.com/SirPlease/L4D2-Competitive-Rework"
};

public void OnPluginStart()
{
LoadTranslation("l4d2_horde_equaliser.phrases");
InitGameData();

hCvarNoEventHordeDuringTanks = CreateConVar("l4d2_heq_no_tank_horde", "0", "Put infinite hordes on a 'hold up' during Tank fights");
Expand Down Expand Up @@ -114,7 +115,7 @@ public void OnEntityCreated(int entity, const char[] classname)
// Our job here is done
if (commonTotal >= commonLimit) {
if (!announcedEventEnd){
CPrintToChatAll("<{olive}Horde{default}> {red}No {default}common remaining!");
CPrintToChatAll("%t %t", "Tag", "NoCommonRemaining");
announcedEventEnd = true;
}
return;
Expand All @@ -130,7 +131,7 @@ public void OnEntityCreated(int entity, const char[] classname)

int remaining = commonLimit - commonTotal;
if (remaining != 0) {
CPrintToChatAll("<{olive}Horde{default}> {red}%i {default}common remaining..", remaining);
CPrintToChatAll("%t %t", "Tag", "CommonRemaining", remaining);
}

checkpointAnnounced[lastCheckpoint] = true;
Expand Down Expand Up @@ -168,7 +169,7 @@ public Action L4D_OnSpawnMob(int &amount)
// If it's a "finite" infinite horde...
if (IsInfiniteHordeActive()) {
if (!announcedInChat) {
CPrintToChatAll("<{olive}Horde{default}> A {blue}finite event{default} of {olive}%i{default} commons has started! Rush or wait it out, the choice is yours!", commonLimit);
CPrintToChatAll("%t %t", "Tag", "FiniteEventStarted", commonLimit);
announcedInChat = true;
}

Expand Down Expand Up @@ -219,4 +220,24 @@ bool IsTankUp()
}

return false;
}

/**
* Check if the translation file exists
*
* @param translation Translation name.
* @noreturn
*/
stock void LoadTranslation(const char[] translation)
{
char
sPath[PLATFORM_MAX_PATH],
sName[64];

Format(sName, sizeof(sName), "translations/%s.txt", translation);
BuildPath(Path_SM, sPath, sizeof(sPath), sName);
if (!FileExists(sPath))
SetFailState("Missing translation file %s.txt", translation);

LoadTranslations(translation);
}
31 changes: 26 additions & 5 deletions addons/sourcemod/scripting/l4d2_tank_horde_monitor.sp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public Plugin myinfo =

public void OnPluginStart()
{
LoadTranslation("l4d2_tank_horde_monitor.phrases");
InitGameData();

g_hBypassFlowDistance = FindConVar("director_tank_bypass_max_flow_travel");
Expand Down Expand Up @@ -159,7 +160,7 @@ Action Timer_CheckTank(Handle timer)
void AnnounceTankSpawn()
{
fProgressFlowPercent = GetFlowUntilBypass(fFurthestFlow, fBypassFlow);
CPrintToChatAll("<{olive}Horde{default}> Horde has {blue}paused{default} due to tank in play! Progressing by {blue}%0.1f%%{default} will start the horde.", fProgressFlowPercent);
CPrintToChatAll("%t %t", "Tag", "TankPlay", fProgressFlowPercent);
announcedTankSpawn = true;

// Begin repeating flow checker
Expand All @@ -186,7 +187,7 @@ Action FlowCheckTimer(Handle hTimer)

if (fProgressFlowPercent - fWarningPercent >= 1.0){
fProgressFlowPercent = fWarningPercent;
CPrintToChatAll("<{olive}Horde{default}> {blue}%0.1f%%{default} left until horde starts...", fWarningPercent);
CPrintToChatAll("%t %t", "Tag", "UntilHordeStarts", fWarningPercent);
}

return Plugin_Continue;
Expand Down Expand Up @@ -224,20 +225,20 @@ public Action L4D_OnSpawnMob(int &amount)
if (!announcedHordeResume && tankInPlayDelay && fPushAmount >= 0.05){
fPushWarningPercent = fPushAmount;
int iPushPercent = RoundToNearest(fPushAmount * 100.0);
CPrintToChatAll("<{olive}Horde{default}> Horde has {blue}resumed{default} at {green}%i%% strength{default}, pushing will increase the horde.", iPushPercent);
CPrintToChatAll("%t %t", "Tag", "HordeResumed", iPushPercent);
announcedHordeResume = true;
}

// Horde strength prints
if (fPushAmount - fPushWarningPercent >= 0.20 && fPushAmount != 1.0 && announcedHordeResume){
fPushWarningPercent = fPushAmount;
int iPushPercent = RoundToNearest(fPushAmount * 100.0);
CPrintToChatAll("<{olive}Horde{default}> Horde is at {green}%i%% strength{default}...", iPushPercent);
CPrintToChatAll("%t %t", "Tag", "HordeStrength", iPushPercent);
}

// Have survivors have pushed past the extra distance we allow?
if (fPushAmount == 1.0){
CPrintToChatAll("<{olive}Horde{default}> Survivors have pushed too far, horde is at {green}100%% strength{default}!");
CPrintToChatAll("%t %t", "Tag", "HordeVeryStrength");
announcedHordeMax = true;
}

Expand Down Expand Up @@ -328,4 +329,24 @@ void ResetWarnings()
announcedHordeResume = false;
announcedHordeMax = false;
fPushWarningPercent = 0.0;
}

/**
* Check if the translation file exists
*
* @param translation Translation name.
* @noreturn
*/
stock void LoadTranslation(const char[] translation)
{
char
sPath[PLATFORM_MAX_PATH],
sName[64];

Format(sName, sizeof(sName), "translations/%s.txt", translation);
BuildPath(Path_SM, sPath, sizeof(sPath), sName);
if (!FileExists(sPath))
SetFailState("Missing translation file %s.txt", translation);

LoadTranslations(translation);
}
25 changes: 23 additions & 2 deletions addons/sourcemod/scripting/l4d2_tankrage.sp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ public Plugin myinfo =
name = "L4D2 Tank Rage",
author = "Sir",
description = "Manage Tank Rage when Survivors are running back.",
version = "1.0",
version = "1.0.1",
url = "https://github.com/SirPlease/L4D2-Competitive-Rework"
};

public void OnPluginStart()
{
LoadTranslation("l4d2_tankrage.phrases");
g_hVsBossBuffer = FindConVar("versus_boss_buffer");
convarRageFlowPercent = CreateConVar("l4d2_tankrage_flowpercent", "7", "The percentage in flow the survival have to run back to grant frustration freeze (Furthest Survivor)");
convarRageFreezeTime = CreateConVar("l4d2_tankrage_freezetime", "4.0", "Time in seconds to freeze the Tank's frustration when survivors have ran back per <flowpercent>.");
Expand Down Expand Up @@ -86,7 +87,7 @@ void Event_TankSpawn(Event hEvent, char[] sEventName, bool dontBroadcast)

if (!IsFakeClient(iTank))
{
CPrintToChatAll("{red}[{default}Tank Rage{red}] {default}For every {olive}%i{green}%% {default}Survivors run back, the Tank will have their frustration frozen for {olive}%0.1f {green}seconds{default}.", convarRageFlowPercent.IntValue, convarRageFreezeTime.FloatValue);
CPrintToChatAll("%t %t", "Tag", "SurvivorsRunBack", convarRageFlowPercent.IntValue, convarRageFreezeTime.FloatValue);
hTankTimer = CreateTimer(0.1, timerTank, _, TIMER_REPEAT)
bHaveHadFlowOrStaticTank = true;
}
Expand Down Expand Up @@ -206,3 +207,23 @@ int min(int a, int b)
{
return a < b ? a : b;
}

/**
* Check if the translation file exists
*
* @param translation Translation name.
* @noreturn
*/
stock void LoadTranslation(const char[] translation)
{
char
sPath[PLATFORM_MAX_PATH],
sName[64];

Format(sName, sizeof(sName), "translations/%s.txt", translation);
BuildPath(Path_SM, sPath, sizeof(sPath), sName);
if (!FileExists(sPath))
SetFailState("Missing translation file %s.txt", translation);

LoadTranslations(translation);
}
42 changes: 31 additions & 11 deletions addons/sourcemod/scripting/l4d_tank_control_eq.sp
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public Plugin myinfo =
name = "L4D2 Tank Control",
author = "arti, (Contributions by: Sheo, Sir, Altair-Sossai)",
description = "Distributes the role of the tank evenly throughout the team, allows for overrides. (Includes forwards)",
version = "0.0.23",
version = "0.0.24",
url = "https://github.com/SirPlease/L4D2-Competitive-Rework"
}

public void OnPluginStart()
{
// Load translations (for targeting player)
LoadTranslation("l4d_tank_control_eq.phrases");
LoadTranslations("common.phrases");

// Event hooks
Expand Down Expand Up @@ -123,16 +123,16 @@ public Action L4D_OnTryOfferingTankBot(int tank_index, bool &enterStatis)
// Reset the tank's frustration if need be
if (!IsFakeClient(tank_index))
{
PrintHintText(tank_index, "Rage Meter Refilled");
PrintHintText(tank_index, "%t", "HintText");
for (int i = 1; i <= MaxClients; i++)
{
if (!IS_VALID_INFECTED(i) && !IS_VALID_SPECTATOR(i))
continue;

if (tank_index == i)
CPrintToChat(i, "{red}<{default}Tank Rage{red}> {olive}Rage Meter {red}Refilled");
CPrintToChat(i, "%t %t", "TagRage", "RefilledBot");
else
CPrintToChat(i, "{red}<{default}Tank Rage{red}> {default}({green}%N{default}'s) {olive}Rage Meter {red}Refilled", tank_index);
CPrintToChat(i, "%t %t", "TagRage", "Refilled", tank_index);
}

SetTankFrustration(tank_index, 100);
Expand Down Expand Up @@ -395,9 +395,9 @@ Action Tank_Cmd(int client, int args)
if (tankClientId != -1 && (hTankPrint.BoolValue || IS_INFECTED(client) || IS_SPECTATOR(client)))
{
if (client == tankClientId)
CPrintToChat(client, "{red}<{default}Tank Selection{red}> {green}You {default}will become the {red}Tank{default}!");
CPrintToChat(client, "%t %t", "TagSelection", "YouBecomeTank");
else
CPrintToChat(client, "{red}<{default}Tank Selection{red}> {olive}%N {default}will become the {red}Tank!", tankClientId);
CPrintToChat(client, "%t %t", "TagSelection", "BecomeTank", tankClientId);
}

return Plugin_Handled;
Expand Down Expand Up @@ -431,14 +431,14 @@ Action GiveTank_Cmd(int client, int args)

if (target == -1 || !IsClientInGame(target) || IsFakeClient(target))
{
CPrintToChat(client, "{green}[{olive}Tank Control{green}] {default}Invalid Target. Unable to give tank");
CPrintToChat(client, "%t %t", "TagControl", "InvalidTarget");
return Plugin_Handled;
}

// Checking if on our desired team
if (!IS_INFECTED(target))
{
CPrintToChat(client, "{green}[{olive}Tank Control{green}] {olive}%N {default}is not on the infected team. Unable to give tank", target);
CPrintToChat(client, "%t %t", "TagControl", "NoInfected", target);
return Plugin_Handled;
}

Expand Down Expand Up @@ -539,9 +539,9 @@ void outputTankToAll(any data)
continue;

if (tankClientId == i)
CPrintToChat(i, "{red}<{default}Tank Selection{red}> {green}You {default}will become the {red}Tank{default}!");
CPrintToChat(i, "%t %t", "TagSelection", "YouBecomeTank");
else
CPrintToChat(i, "{red}<{default}Tank Selection{red}> {olive}%N {default}will become the {red}Tank!", tankClientId);
CPrintToChat(i, "%t %t", "TagSelection", "BecomeTank", tankClientId);
}
}
}
Expand Down Expand Up @@ -695,4 +695,24 @@ void ShuffleArray(ArrayList arrayList, int start, int end)

arrayList.SwapAt(index1, index2);
}
}

/**
* Check if the translation file exists
*
* @param translation Translation name.
* @noreturn
*/
stock void LoadTranslation(const char[] translation)
{
char
sPath[PLATFORM_MAX_PATH],
sName[64];

Format(sName, sizeof(sName), "translations/%s.txt", translation);
BuildPath(Path_SM, sPath, sizeof(sPath), sName);
if (!FileExists(sPath))
SetFailState("Missing translation file %s.txt", translation);

LoadTranslations(translation);
}
Loading

0 comments on commit d5f2f66

Please sign in to comment.