Skip to content

Wip map prefix instead of patterns#68

Open
plally wants to merge 5 commits intomainfrom
wip-map-prefix-instead-of-patterns
Open

Wip map prefix instead of patterns#68
plally wants to merge 5 commits intomainfrom
wip-map-prefix-instead-of-patterns

Conversation

@plally
Copy link
Copy Markdown
Member

@plally plally commented Apr 21, 2026

No description provided.

@plally plally marked this pull request as ready for review April 21, 2026 22:51
@plally plally requested a review from Copilot April 21, 2026 22:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MapPrefixes config field with MapPatterns in the schema + defaults.
  • Update server-side map filtering to use wildcard patterns.
  • Migrate old configs (MapPrefixesMapPatterns) 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.

Comment thread lua/mapvote/server/modules/map_vote.lua Outdated
Comment on lines +27 to 30
if conf.MapPatterns then
for _, v in pairs( conf.MapPatterns ) do
if string.find( m, wildcardToPattern( v ) ) then
return true
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 13 to 15
UseGamemodeMapPrefixes = SV.Bool():Optional(),
MapPrefixes = SV.List( SV.String() ):Optional(),
MapPatterns = SV.List( SV.String() ):Optional(),
EnableCooldown = SV.Bool(),
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
RTVPlayerCount = 3,
UseGamemodeMapPrefixes = true,
MapPrefixes = {},
MapPatterns = { "*" },
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 *.

Suggested change
MapPatterns = { "*" },

Copilot uses AI. Check for mistakes.
plally and others added 2 commits April 24, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants