just turning it from hard coded 50 to a cvar setting

This commit is contained in:
jenz
2026-11-16 14:45:35 +01:00
parent ac3ffd5be2
commit 6c6b577c2c
@@ -146,6 +146,7 @@ int g_iNextmapState = 0; //0 = nothing. 1 = rtv succesfull. 2 = admin used setne
int g_mapFileSerial = -1;
int g_iSkipAllRestrictions;
int g_iDontCooldownMap;
int g_iImpactMapsToCasualPool;
int g_iMapsFromCasualPool;
int g_iImpactExtraCooldownTime;
@@ -292,7 +293,7 @@ public void OnPluginStart()
ConVar cvar2;
HookConVarChange((cvar2 = CreateConVar("mce_randomized_maps_from_casual_pool", "2", "do we have space left over for randomized maps at the mapvote. how many should be prioritized from the casual pool?")), Cvar_mapsFromCasualPool);
HookConVarChange((cvar2 = CreateConVar("mce_randomized_maps_from_casual_pool", "3", "do 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;
@@ -307,15 +308,20 @@ public void OnPluginStart()
delete cvar2_1;
ConVar cvar1;
HookConVarChange((cvar1 = CreateConVar("mce_skip_map_restrictions_player_count", "15", "Amount of players required for any restrictions are enabled.")), Cvar_playerActiveRequired);
HookConVarChange((cvar1 = CreateConVar("mce_skip_map_restrictions_player_count", "10", "Amount of players required for any restrictions are enabled.")), Cvar_playerActiveRequired);
g_iSkipAllRestrictions = cvar1.IntValue;
delete cvar1;
ConVar cvar4;
HookConVarChange((cvar4 = CreateConVar("mce_enable_map_cooldowns_player_count", "30", "Amount of players required for applying cooldowns.")), Cvar_CooldownPlayerRequired);
HookConVarChange((cvar4 = CreateConVar("mce_enable_map_cooldowns_player_count", "10", "Amount of players required for applying cooldowns.")), Cvar_CooldownPlayerRequired);
g_iDontCooldownMap = cvar4.IntValue;
delete cvar4;
ConVar cvar5;
HookConVarChange((cvar5 = CreateConVar("mce_impact_pool_size", "50", "How many of the highest avg rated maps to take from the impact pool to the casualpool")), Cvar_ImpactPoolToCasualPool);
g_iImpactMapsToCasualPool = cvar5.IntValue;
delete cvar5;
// MapChooser Extended cvars
CreateConVar("mce_version", MCE_VERSION, "MapChooser Extended Version", FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
@@ -342,7 +348,6 @@ public void OnPluginStart()
RegAdminCmd("sm_mapvote", Command_Mapvote, ADMFLAG_CHANGEMAP, "sm_mapvote - Forces MapChooser to attempt to run a map vote now.");
RegAdminCmd("sm_setnextmap", Command_SetNextmap, ADMFLAG_CHANGEMAP, "sm_setnextmap <map>");
RegAdminCmd("sm_unsetnextmap", Command_UnsetNextmap, ADMFLAG_CHANGEMAP, "sm_unsetnextmap - Unsets an admin-set next map and re-enables the end of map vote.");
// Mapchooser Extended Commands
RegAdminCmd("mce_reload_maplist", Command_ReloadMaps, ADMFLAG_CHANGEMAP, "mce_reload_maplist - Reload the Official Maplist file.");
@@ -472,6 +477,11 @@ public void Cvar_playerActiveRequired(ConVar convar, const char[] oldValue, cons
g_iSkipAllRestrictions = convar.IntValue;
}
public void Cvar_ImpactPoolToCasualPool(ConVar convar, const char[] oldValue, const char[] newValue)
{
g_iImpactMapsToCasualPool = convar.IntValue;
}
public void Cvar_CooldownPlayerRequired(ConVar convar, const char[] oldValue, const char[] newValue)
{
g_iDontCooldownMap = convar.IntValue;
@@ -652,7 +662,7 @@ public void OnTransferComplete(HTTPResponse response, int offset)
}
delete entry;
if (GetArraySize(g_hTopImpactMaps) >= 50)
if (GetArraySize(g_hTopImpactMaps) >= g_iImpactMapsToCasualPool)
{
break;
}
@@ -661,9 +671,9 @@ public void OnTransferComplete(HTTPResponse response, int offset)
delete root;
delete maps;
if (GetArraySize(g_hTopImpactMaps) < 50)
if (GetArraySize(g_hTopImpactMaps) < g_iImpactMapsToCasualPool)
{
FillMapsByImpact(offset + 50); //did not get enough maps from the public maplist, set offset to pick the next.
FillMapsByImpact(offset + g_iImpactMapsToCasualPool); //did not get enough maps from the public maplist, set offset to pick the next.
}
}
@@ -886,23 +896,6 @@ public Action Command_SetNextmap(int client, int args)
return Plugin_Handled;
}
public Action Command_UnsetNextmap(int client, int args)
{
if(g_iNextmapState != 2)
{
CReplyToCommand(client, "[MCE] No admin-set next map to unset.");
return Plugin_Handled;
}
g_iNextmapState = 0;
g_MapVoteCompleted = false;
FindConVar("sm_nextmap").SetString("");
ShowActivity(client, "unset the next map");
LogAction(client, -1, "\"%L\" unset the nextmap", client);
return Plugin_Handled;
}
public Action Command_ReloadMaps(int client, int args)
{
InitializeOfficialMapList();