added a casual pool feature that will be prioritized when picking random maps for the mapvote
This commit is contained in:
parent
c267fb1457
commit
d9987c554d
@ -147,6 +147,7 @@ bool g_DidRoundTerminate = false;
|
||||
bool g_IniatedLastVote = false;
|
||||
int g_mapFileSerial = -1;
|
||||
int g_iPlayerCount_excludeSpec;
|
||||
int g_iMapsFromCasualPool;
|
||||
int g_iPlayerAFKTime;
|
||||
|
||||
|
||||
@ -294,6 +295,11 @@ public void OnPluginStart()
|
||||
g_Cvar_VoteDuration = CreateConVar("mce_voteduration", "20", "Specifies how long the mapvote should be available for.", _, true, 5.0);
|
||||
|
||||
|
||||
ConVar cvar2;
|
||||
HookConVarChange((cvar2 = CreateConVar("mce_randomized_maps_from_casual_pool", "2", "f we have space left over for randomized maps at the mapvote. how many should be prioritized from the casual pool?")), Cvar_mapsFromCasualPool);
|
||||
g_iMapsFromCasualPool = cvar2.IntValue;
|
||||
delete cvar2;
|
||||
|
||||
ConVar cvar1;
|
||||
HookConVarChange((cvar1 = CreateConVar("sm_active_players_required", "15", "Amount of players required to be considered active before any restrictions are enabled at all.")), Cvar_playerExcludeSpec);
|
||||
g_iPlayerCount_excludeSpec = cvar1.IntValue;
|
||||
@ -436,6 +442,11 @@ public void OnPluginStart()
|
||||
ServerCommand("sm_cvar mp_chattime %i", total_time); //prevents map switching supposedly.
|
||||
}
|
||||
|
||||
public void Cvar_mapsFromCasualPool(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||
{
|
||||
g_iMapsFromCasualPool = convar.IntValue;
|
||||
}
|
||||
|
||||
public void Cvar_playerExcludeSpec(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||
{
|
||||
g_iPlayerCount_excludeSpec = convar.IntValue;
|
||||
@ -1015,13 +1026,8 @@ public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason)
|
||||
|
||||
public Action unfreeze_players(Handle hTimer, Handle dp)
|
||||
{
|
||||
char map[64];
|
||||
GetCurrentMap(map, PLATFORM_MAX_PATH);
|
||||
if (StrContains(map, "ze_", false) != -1)
|
||||
{
|
||||
ServerCommand("sm_testround");
|
||||
CreateTimer(1.0, unfreeze_players2, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
ServerCommand("sm_testround");
|
||||
CreateTimer(1.0, unfreeze_players2, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -2156,14 +2162,29 @@ void CreateNextVote()
|
||||
}
|
||||
|
||||
// find random maps which honor all restrictions
|
||||
int pickedFromCasualPool = 0;
|
||||
for(int i = 0; i < limit; i++)
|
||||
{
|
||||
int b;
|
||||
int b;
|
||||
for(int j = 0; j < 1000; j++)
|
||||
{
|
||||
b = GetRandomInt(0, GetArraySize(tempMaps) - 1);
|
||||
GetArrayString(tempMaps, b, map, PLATFORM_MAX_PATH);
|
||||
|
||||
//if we abandon the feature again its important to just set mce_randomized_maps_from_casual_pool to 0.
|
||||
if (pickedFromCasualPool < g_iMapsFromCasualPool)
|
||||
{
|
||||
if (!InternalGetCasualPool(map))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//requested by keen in september 2024 that we have a pool that is prioritized when taking random maps.
|
||||
//it might be considered micro management which would indeed be bad. i guess this is mostly about pleasing a regular players request
|
||||
//which does not seem too outlandish to make possible.
|
||||
pickedFromCasualPool++;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!InternalAreRestrictionsActive(false))
|
||||
break;
|
||||
|
||||
@ -3307,6 +3328,18 @@ stock int FindIntInArray(int[] array, int size, int value)
|
||||
return -1;
|
||||
}
|
||||
|
||||
stock bool InternalGetCasualPool(const char[] map)
|
||||
{
|
||||
int CasualPool = 0;
|
||||
if(g_Config && g_Config.JumpToKey(map))
|
||||
{
|
||||
CasualPool = g_Config.GetNum("CasualPool", CasualPool);
|
||||
g_Config.Rewind();
|
||||
}
|
||||
|
||||
return view_as<bool>(CasualPool);
|
||||
}
|
||||
|
||||
stock bool InternalGetMapVIPRestriction(const char[] map)
|
||||
{
|
||||
int VIP = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user