Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates MapVote’s map-selection configuration from a prefix list (MapPrefixes) to wildcard-based patterns (MapPatterns), including a migration step to preserve existing configs.
Changes:
- Replace
MapPrefixesconfig field withMapPatternsin the schema + defaults. - Update server-side map filtering to use wildcard patterns.
- Migrate old configs (
MapPrefixes→MapPatterns) on load and resave the config file.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| lua/mapvote/shared/modules/config_schema.lua | Renames the config field and changes defaults for map filtering. |
| lua/mapvote/server/modules/map_vote.lua | Implements wildcard pattern matching for allowed maps. |
| lua/mapvote/server/modules/config.lua | Adds config migration/resave for the renamed field. |
| lua/mapvote/client/modules/admin_menu.lua | Updates admin UI to edit the new MapPatterns field. |
| lua/mapvote/server/modules/map_reset.lua | Removes an empty/placeholder file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if conf.MapPatterns then | ||
| for _, v in pairs( conf.MapPatterns ) do | ||
| if string.find( m, wildcardToPattern( v ) ) then | ||
| return true |
There was a problem hiding this comment.
wildcardToPattern(v) is recomputed for every isMapAllowed() call and for each configured pattern. Since isMapAllowed() can be called many times while building the vote list, consider precompiling MapPatterns into Lua patterns once at config load/merge time (or caching the compiled result) to reduce repeated string.Explode/PatternSafe work.
| UseGamemodeMapPrefixes = SV.Bool():Optional(), | ||
| MapPrefixes = SV.List( SV.String() ):Optional(), | ||
| MapPatterns = SV.List( SV.String() ):Optional(), | ||
| EnableCooldown = SV.Bool(), |
There was a problem hiding this comment.
PR title/metadata suggests moving to “map prefix instead of patterns”, but the code change replaces MapPrefixes with MapPatterns (and adds migration from prefixes to patterns). If the intent is indeed patterns, consider updating the PR title/description to match; otherwise the implementation may need to be adjusted to keep prefix-based configuration.
| RTVPlayerCount = 3, | ||
| UseGamemodeMapPrefixes = true, | ||
| MapPrefixes = {}, | ||
| MapPatterns = { "*" }, |
There was a problem hiding this comment.
Setting the default MapPatterns to { "*" } makes isMapAllowed() return true for every map (because * matches anything), which effectively bypasses UseGamemodeMapPrefixes filtering. Previously the default MapPrefixes = {} + UseGamemodeMapPrefixes = true meant only gamemode-prefixed maps were allowed by default. Consider keeping the default empty/absent so the gamemode prefix filter still applies unless admins explicitly opt into *.
| MapPatterns = { "*" }, |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.