Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
rtldg authored Jan 6, 2024
2 parents efb659a + 945282d commit db62ed4
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
.vscode/tasks.json

\.vscode/settings\.json
*.bak
51 changes: 49 additions & 2 deletions addons/sourcemod/scripting/include/shavit/core.inc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ enum struct stylestrings_t

enum struct chatstrings_t
{
char sPrefix[64];
char sPrefix[128];
char sText[16];
char sWarning[16];
char sVariable[16];
Expand Down Expand Up @@ -378,7 +378,54 @@ stock void FormatSeconds(float time, char[] newtime, int newtimesize, bool preci
}
else
{
FormatEx(sSeconds, 8, precise? "%.3f":"%.1f", fSeconds);
FormatEx(sSeconds, 8, precise? "%.4f":"%.1f", fSeconds);
}

if (!full_hms && fTempTime < 60.0)
{
strcopy(newtime, newtimesize, sSeconds);
FormatEx(newtime, newtimesize, "%s%s", (time < 0.0) ? "-":"", sSeconds);
}
else
{
int iMinutes = (iRounded / 60);

if (!full_hms && fTempTime < 3600.0)
{
FormatEx(newtime, newtimesize, "%s%d:%s%s", (time < 0.0)? "-":"", iMinutes, (fSeconds < 10)? "0":"", sSeconds);
}
else
{
int iHours = (iMinutes / 60);
iMinutes %= 60;

FormatEx(newtime, newtimesize, "%s%d:%s%d:%s%s", (time < 0.0)? "-":"", iHours, (iMinutes < 10)? "0":"", iMinutes, (fSeconds < 10)? "0":"", sSeconds);
}
}
}

stock void FormatSecondsHud(float time, char[] newtime, int newtimesize, bool precise = true, bool nodecimal = false, bool full_hms = false)
{
float fTempTime = time;

if(fTempTime < 0.0)
{
fTempTime = -fTempTime;
}

int iRounded = RoundToFloor(fTempTime);
int iSeconds = (iRounded % 60);
float fSeconds = iSeconds + fTempTime - iRounded;

char sSeconds[8];

if (nodecimal)
{
FormatEx(sSeconds, 8, "%d", iSeconds);
}
else
{
FormatEx(sSeconds, 8, precise? "%.2f":"%.1f", fSeconds);
}

if (!full_hms && fTempTime < 60.0)
Expand Down
25 changes: 23 additions & 2 deletions addons/sourcemod/scripting/shavit-hud.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,15 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
AddHUDLine(buffer, maxlen, sLine, iLines);
}

if(data.iZoneHUD == ZoneHUD_Start)
if(data.iZoneHUD == ZoneHUD_Start && !(Shavit_GetPoints(GetSpectatorTarget(client, client)) == 0.0))
{
FormatEx(sLine, 128, "%T ", "HudInStartZoneimretardedandafaggot", client, Shavit_GetPoints(GetSpectatorTarget(client, client)), Shavit_GetRank(GetSpectatorTarget(client, client)), Shavit_GetRankedPlayers(), data.iSpeed);
}
else if(!(Shavit_GetPoints(GetSpectatorTarget(client, client)) == 0.0))
{
FormatEx(sLine, 128, "%T ", "HudInEndZoneimretardedandafaggot", client, Shavit_GetPoints(GetSpectatorTarget(client, client)), Shavit_GetRank(GetSpectatorTarget(client, client)), Shavit_GetRankedPlayers(), data.iSpeed);
}
else if(data.iZoneHUD == ZoneHUD_Start)
{
FormatEx(sLine, 128, "%T ", (gI_HUD2Settings[client] & HUD2_SPEED) ? "HudInStartZoneNoSpeed" : "HudInStartZone", client, data.iSpeed);
}
Expand All @@ -1320,7 +1328,14 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
FormatEx(sLine, 128, "%T ", (gI_HUD2Settings[client] & HUD2_SPEED) ? "HudInEndZoneNoSpeed" : "HudInEndZone", client, data.iSpeed);
}

/*if(!Shavit_GetPoints(client) == 0.0)
{
FormatEx(sLine, 128, "Rank: %i/%i", Shavit_GetRank(client), Shavit_GetRankedPlayers());
AddHUDLine(buffer, maxlen, sLine, iLines);
}*/

AddHUDLine(buffer, maxlen, sLine, iLines);

return iLines;
}

Expand All @@ -1340,7 +1355,7 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
if((gI_HUD2Settings[client] & HUD2_TIME) == 0)
{
char sTime[32];
FormatSeconds(data.fTime, sTime, 32, false);
FormatSecondsHud(data.fTime, sTime, 32, true);

char sTimeDiff[32];

Expand Down Expand Up @@ -1423,6 +1438,12 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
AddHUDLine(buffer, maxlen, sLine, iLines);
}
}

if(data.iTimerStatus != Timer_Stopped && (gI_HUD2Settings[client] & HUD2_TIMEDIFFERENCE) == 0 && data.fClosestReplayTime != -1.0)
{
FormatEx(sLine, 128, "Run: %.1f", (((data.fTime - (data.fTime - data.fClosestReplayTime)) / data.fWR) * 100.0));
AddHUDLine(buffer, maxlen, sLine, iLines);
}

if(data.iTimerStatus != Timer_Stopped && data.iTrack != Track_Main && (gI_HUD2Settings[client] & HUD2_TRACK) == 0)
{
Expand Down
47 changes: 24 additions & 23 deletions addons/sourcemod/scripting/shavit-mapchooser.sp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int gI_LastEnhancedMenuPos[MAXPLAYERS+1];
Menu g_hNominateMenu;
Menu g_hEnhancedMenu;

Menu g_aTierMenus[10+1];
Menu g_aTierMenus[20+1];
bool g_bWaitingForTiers = false;
bool g_bTiersAssigned = false;

Expand Down Expand Up @@ -233,8 +233,8 @@ public void OnPluginStart()

g_cvMapChangeSound = new Convar("smc_mapchange_sound", "0", "Play the Dr. Kleiner `3,2,1 Intializing` sound");

g_cvMinTier = new Convar("smc_min_tier", "0", "The minimum tier to show on the enhanced menu", _, true, 0.0, true, 10.0);
g_cvMaxTier = new Convar("smc_max_tier", "10", "The maximum tier to show on the enhanced menu", _, true, 0.0, true, 10.0);
g_cvMinTier = new Convar("smc_min_tier", "0", "The minimum tier to show on the enhanced menu", _, true, 0.0, true, 20.0);
g_cvMaxTier = new Convar("smc_max_tier", "10", "The maximum tier to show on the enhanced menu", _, true, 0.0, true, 20.0);

g_cvAntiSpam = new Convar("smc_anti_spam", "15.0", "The number of seconds a player needs to wait before rtv/unrtv/nominate/unnominate.", 0, true, 0.0, true, 300.0);

Expand Down Expand Up @@ -472,7 +472,7 @@ public Action Timer_SpecCooldown(Handle timer)

if(needed > 0)
{
PrintToChatAll("%s%N no longer wants to rock the vote! (%i more votes needed)", g_cPrefix, i, needed);
Shavit_PrintToChatAll("%N no longer wants to rock the vote! (%i more votes needed)", i, needed);
}
}
}
Expand All @@ -494,18 +494,18 @@ public Action Timer_OnMapTimeLeftChanged(Handle Timer)
{
case (10 * 60), (5 * 60):
{
PrintToChatAll("%s%d minutes until map vote", g_cPrefix, mapvoteTime/60);
Shavit_PrintToChatAll("%d minutes until map vote", mapvoteTime/60);
}
}
switch(mapvoteTime)
{
case (10 * 60) - 3:
{
PrintToChatAll("%s10 minutes until map vote", g_cPrefix);
Shavit_PrintToChatAll("10 minutes until map vote");
}
case 60, 30, 5:
{
PrintToChatAll("%s%d seconds until map vote", g_cPrefix, mapvoteTime);
Shavit_PrintToChatAll("%d seconds until map vote", mapvoteTime);
}
}
}
Expand Down Expand Up @@ -797,15 +797,15 @@ void InitiateMapVote(MapChange when)
menu.AddItem("dontchange", "Don't Change");
}

PrintToChatAll("%s%t", g_cPrefix, "Nextmap Voting Started");
Shavit_PrintToChatAll("%t", "Nextmap Voting Started");

for (int i = 1; i <= MaxClients; i++)
{
g_bVoteDelayed[i] = (IsClientInGame(i) && !IsFakeClient(i) && GetClientMenu(i) != MenuSource_None);

if (g_bVoteDelayed[i])
{
PrintToChat(i, "%sYou had a menu open. Waiting %.2fs before accepting input", g_cPrefix, g_fVoteDelayTime);
Shavit_PrintToChat(i, "You had a menu open. Waiting %.2fs before accepting input", g_fVoteDelayTime);
}
}

Expand Down Expand Up @@ -865,7 +865,8 @@ public void Handler_MapVoteFinished(Menu menu, int num_votes, int num_clients, c
float map2percent = float(item_info[1][VOTEINFO_ITEM_VOTES])/ float(num_votes) * 100;


PrintToChatAll("%s%t", g_cPrefix, "Starting Runoff", g_cvMapVoteRunOffPerc.FloatValue, info1, map1percent, info2, map2percent);
Shavit_PrintToChatAll("%t", "Starting Runoff", g_cvMapVoteRunOffPerc.FloatValue, info1, map1percent, info2, map2percent);

LogMessage("Voting for next map was indecisive, beginning runoff vote");

return;
Expand Down Expand Up @@ -901,7 +902,7 @@ public void Handler_VoteFinishedGeneric(Menu menu, int num_votes, int num_client

menu.GetItem(item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map), _, displayName, sizeof(displayName));

//PrintToChatAll("#1 vote was %s (%s)", map, (g_ChangeTime == MapChange_Instant) ? "instant" : "map end");
//Shavit_PrintToChatAll("#1 vote was %s (%s)", map, (g_ChangeTime == MapChange_Instant) ? "instant" : "map end");

if(StrEqual(map, "extend"))
{
Expand All @@ -916,7 +917,7 @@ public void Handler_VoteFinishedGeneric(Menu menu, int num_votes, int num_client
}
}

PrintToChatAll("%s%t", g_cPrefix, "Current Map Extended", RoundToFloor(float(item_info[0][VOTEINFO_ITEM_VOTES])/float(num_votes)*100), num_votes);
Shavit_PrintToChatAll("%t", "Current Map Extended", RoundToFloor(float(item_info[0][VOTEINFO_ITEM_VOTES])/float(num_votes)*100), num_votes);
LogAction(-1, -1, "Voting for next map has finished. The current map has been extended.");

// We extended, so we'll have to vote again.
Expand All @@ -927,7 +928,7 @@ public void Handler_VoteFinishedGeneric(Menu menu, int num_votes, int num_client
}
else if(StrEqual(map, "dontchange"))
{
PrintToChatAll("%s%t", g_cPrefix, "Current Map Stays", RoundToFloor(float(item_info[0][VOTEINFO_ITEM_VOTES])/float(num_votes)*100), num_votes);
Shavit_PrintToChatAll("%t", "Current Map Stays", RoundToFloor(float(item_info[0][VOTEINFO_ITEM_VOTES])/float(num_votes)*100), num_votes);
LogAction(-1, -1, "Voting for next map has finished. 'No Change' was the winner");

g_bMapVoteFinished = false;
Expand Down Expand Up @@ -978,7 +979,7 @@ void DoMapChangeAfterMapVote(char map[PLATFORM_MAX_PATH], char displayName[PLATF
g_bMapVoteStarted = false;
g_bMapVoteFinished = true;

PrintToChatAll("%s%t", g_cPrefix, "Nextmap Voting Finished", displayName, percentage_of_votes, num_votes);
Shavit_PrintToChatAll("%t", "Nextmap Voting Finished", displayName, percentage_of_votes, num_votes);
LogAction(-1, -1, "Voting for next map has finished. Nextmap: %s.", map);
}

Expand Down Expand Up @@ -1851,7 +1852,7 @@ void Nominate(int client, const char mapname[PLATFORM_MAX_PATH])
char name[MAX_NAME_LENGTH];
SanerGetClientName(client, name);

PrintToChatAll("%s%t", g_cPrefix, "Map Nominated", name, mapname);
Shavit_PrintToChatAll("%t", "Map Nominated", name, mapname);
}

public Action Command_RockTheVote(int client, int args)
Expand Down Expand Up @@ -1920,7 +1921,7 @@ int CheckRTV(int client = 0)
{
if(client != 0)
{
PrintToChatAll("%s%t", g_cPrefix, "RTV Requested", name, rtvcount, total);
Shavit_PrintToChatAll("%t", "RTV Requested", name, rtvcount, total);
}
}
else
Expand All @@ -1932,11 +1933,11 @@ int CheckRTV(int client = 0)

if(client != 0)
{
PrintToChatAll("%s%N wants to rock the vote! Map will now change to %s ...", g_cPrefix, client, map);
Shavit_PrintToChatAll("%N wants to rock the vote! Map will now change to %s ...", client, map);
}
else
{
PrintToChatAll("%sRTV vote now majority, map changing to %s ...", g_cPrefix, map);
Shavit_PrintToChatAll("RTV vote now majority, map changing to %s ...", map);
}

StartMapChange(MapChangeDelay(), map, "rtv after map vote");
Expand All @@ -1945,11 +1946,11 @@ int CheckRTV(int client = 0)
{
if(client != 0)
{
PrintToChatAll("%s%N wants to rock the vote! Map vote will now start ...", g_cPrefix, client);
Shavit_PrintToChatAll("%N wants to rock the vote! Map vote will now start ...", client);
}
else
{
PrintToChatAll("%sRTV vote now majority, map vote starting ...", g_cPrefix);
Shavit_PrintToChatAll("RTV vote now majority, map vote starting ...");
}

InitiateMapVote(MapChange_Instant);
Expand Down Expand Up @@ -1989,7 +1990,7 @@ public Action Command_UnRockTheVote(int client, int args)

if(needed > 0)
{
PrintToChatAll("%s%N no longer wants to rock the vote! (%i more votes needed)", g_cPrefix, client, needed);
Shavit_PrintToChatAll("%N no longer wants to rock the vote! (%i more votes needed)", client, needed);
}
}

Expand Down Expand Up @@ -2090,7 +2091,7 @@ public Action Command_LoadUnzonedMap(int client, int args)

public Action Command_ReloadMap(int client, int args)
{
PrintToChatAll("%sReloading current map..", g_cPrefix);
Shavit_PrintToChatAll("Reloading current map..");
StartMapChange(MapChangeDelay(), g_cMapName, "sm_reloadmap");
return Plugin_Handled;
}
Expand Down Expand Up @@ -2376,7 +2377,7 @@ void DebugPrint(const char[] message, any ...)
{
if (IsClientConnected(i) && CheckCommandAccess(i, "sm_smcdebug", ADMFLAG_RCON))
{
PrintToChat(i, buffer);
Shavit_PrintToChat(i, buffer);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/shavit-rankings.sp
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ public Action Command_SetTier(int client, int args)

int tier = StringToInt(sArg);

if(args == 0 || tier < 1 || tier > 10)
if(args == 0 || tier < 1 || tier > 20)
{
ReplyToCommand(client, "%T", "ArgumentsMissing", client, "sm_settier <tier> (1-10) [map]");

Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/translations/shavit-core.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
"StyleUnranked"
{
"en" "[Unranked]"
"en" "Unranked"
}
// ---------- Misc ---------- //
"LeftRightCheat"
Expand Down
11 changes: 10 additions & 1 deletion addons/sourcemod/translations/shavit-hud.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
"#format" "{1:d}"
"en" "Tier {1}"
}
"HudInStartZoneimretardedandafaggot"
{
"#format" "{1:0.f},{2:d},{3:d},{4:d}"
"en" "In Start Zone\nPoints: {1}\nRank: {2}/{3}\n\n{4}"
}
"HudInStartZone"
{
"#format" "{1:d}"
Expand Down Expand Up @@ -39,6 +44,10 @@
{
"#format" "{1:d}"
"en" "In End Zone"
"HudInEndZoneimretardedandafaggot"
{
"#format" "{1:0.f},{2:d},{3:d},{4:d}"
"en" "In End Zone\nPoints: {1}\nRank: {2}/{3}\n\n{4}"
}
"HudInEndZoneCSGO"
{
Expand All @@ -55,7 +64,7 @@
}
"HudBestText"
{
"en" "Best"
"en" "PB"
}
"HudJumpsText"
{
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/translations/shavit-replay.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"Menu_Replay2X"
{
"#format" "{1:s}"
"en" "[{1}] Toggle 2x speed"
"en" "{1} Toggle 2x speed"
}
"Menu_PlaybackSpeed"
{
Expand Down
6 changes: 3 additions & 3 deletions addons/sourcemod/translations/shavit-stats.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"MapsDoneFor"
{
"#format" "{1:s},{2:s},{3:d}"
"en" "[{1}] Maps done for {2}: ({3})"
"en" "{1} Maps done for {2}: ({3})"
}
"MapsDoneOnStyle"
{
Expand All @@ -37,7 +37,7 @@
"MapsLeftFor"
{
"#format" "{1:s},{2:s},{3:d}"
"en" "[{1}] Maps left for {2}: ({3})"
"en" "{1} Maps left for {2}: ({3})"
}
"MapsLeftOnStyle"
{
Expand All @@ -47,7 +47,7 @@
"MapsMenu"
{
"#format" "{1:s}"
"en" "[{1}] Stats:"
"en" "{1} Stats:"
}
"MapsPoints"
{
Expand Down
Loading

0 comments on commit db62ed4

Please sign in to comment.