Skip to content

Commit 3a77a67

Browse files
committed
Add map history and history-based exclusions
Add support for history-based map/group exclusions and a map-history command. - Introduces two ConVars: multimode_vote_default_groupexclude and multimode_vote_default_mapexclude to provide default behavior when vote calls pass -1. - Adds utility helpers in utils.inc: MMC_KeyIsSubgroupOfBase, MMC_ResolveVoteGroupExclude, MMC_ResolveVoteMapExclude. - Adds vote-history helpers in multimode_core.sp: VoteHistory_IsGroupRecentlyPlayed, VoteHistory_IsMapRecentlyPlayed, VoteHistory_MapEverPlayed and integrates them into native checks and vote preparation routines so maps/groups are correctly excluded based on recent play history and resolved ConVar defaults. - Adds console commands multimode_maphistory and sm_maphistory to list played maps per group/subgroup. - Fixes include documentation text for groupexclude/mapexclude. - Compiled plugin binary (multimode_core.smx) updated. These changes ensure votes respect configurable recent-play exclusions and provide an admin-visible history of played maps.
1 parent 4828c43 commit 3a77a67

4 files changed

Lines changed: 246 additions & 65 deletions

File tree

2.45 KB
Binary file not shown.

addons/sourcemod/scripting/include/multimode.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ typedef VoteCancelCallback = function void ();
5656
* @param timestep Amount of time to extend the time limit when "Extend Map" is selected.
5757
* @param fragstep Amount of frag limit to extend when "Extend Map" is selected.
5858
* @param roundstep Amount of round limit to extend when "Extend Map" is selected.
59-
* @param groupexclude Determines if a previously played group can appear in the vote. (-1 = Use default config)
60-
* @param mapexclude Determines if a previously played map can appear in the vote. (-1 = Use default config)
59+
* @param groupexclude Determines if a previously played group can appear in the vote. (-1 uses core ConVar multimode_vote_default_mapexclude. 0 = Off.)
60+
* @param mapexclude Determines if a previously played map can appear in the vote. (-1 uses core ConVar multimode_vote_default_groupexclude. 0 = Off.)
6161
* @param handlenominations Specifies how nominations should be handled. (1 - Handle player's nominations, 0 - Do not handle player's nominations)
6262
* @param threshold Percentage required for a vote to win.
6363
* @param maxRunoffs Maximum number of runoff votes allowed. (0 = No limit)

addons/sourcemod/scripting/include/multimode/utils.inc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,37 @@ stock KeyValues MMC_GetMapCycle()
6969
return kv;
7070
}
7171

72+
stock bool MMC_KeyIsSubgroupOfBase(const char[] key, const char[] baseGroup)
73+
{
74+
int bl = strlen(baseGroup);
75+
if (bl == 0 || strlen(key) < bl + 2)
76+
return false;
77+
if (key[bl] != '/')
78+
return false;
79+
char buf[128];
80+
strcopy(buf, sizeof(buf), key);
81+
buf[bl] = '\0';
82+
return StrEqual(buf, baseGroup);
83+
}
84+
85+
stock int MMC_ResolveVoteGroupExclude(int raw)
86+
{
87+
if (raw != -1)
88+
return (raw < 0) ? 0 : raw;
89+
ConVar cv = FindConVar("multimode_vote_default_groupexclude");
90+
int v = (cv != null) ? cv.IntValue : 0;
91+
return (v < 0) ? 0 : v;
92+
}
93+
94+
stock int MMC_ResolveVoteMapExclude(int raw)
95+
{
96+
if (raw != -1)
97+
return (raw < 0) ? 0 : raw;
98+
ConVar cv = FindConVar("multimode_vote_default_mapexclude");
99+
int v = (cv != null) ? cv.IntValue : 0;
100+
return (v < 0) ? 0 : v;
101+
}
102+
72103
stock bool MMC_IsWildcardEntry(const char[] mapname)
73104
{
74105
int len = strlen(mapname);

0 commit comments

Comments
 (0)