Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(match2): make autoScore optional #5039

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions components/match2/commons/match_group_input_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ end
---@class MatchParserInterface
---@field extractMaps fun(match: table, opponents: table[], mapProps: any?): table[]
---@field getBestOf fun(bestOfInput: string|integer, maps: table[]): integer
---@field calculateMatchScore fun(maps: table[]): fun(opponentIndex: integer): integer
---@field calculateMatchScore? fun(maps: table[]): fun(opponentIndex: integer): integer
---@field removeUnsetMaps? fun(maps: table[]): table[]
---@field getExtraData? fun(match: table, games: table[], opponents: table[]): table
---@field getLinks? fun(match: table, games: table[]): table
Expand All @@ -1093,9 +1093,9 @@ end
--- The Parser injection must have the following functions:
--- - extractMaps(match, opponents, mapProps): table[]
--- - getBestOf(bestOfInput, maps): integer
--- - calculateMatchScore(maps): fun(opponentIndex): integer
---
--- It may optionally have the following functions:
--- - calculateMatchScore(maps): fun(opponentIndex): integer
--- - removeUnsetMaps(maps): table[]
--- - getExtraData(match, games, opponents): table
--- - getLinks
Expand Down Expand Up @@ -1124,7 +1124,7 @@ function MatchGroupInputUtil.standardProcessMatch(match, Parser, mapProps)

match.links = Parser.getLinks and Parser.getLinks(match, games) or MatchGroupInputUtil.getLinks(match)

local autoScoreFunction = MatchGroupInputUtil.canUseAutoScore(match, games)
local autoScoreFunction = (Parser.calculateMatchScore and MatchGroupInputUtil.canUseAutoScore(match, games))
and Parser.calculateMatchScore(games)
or nil
Array.forEach(opponents, function(opponent, opponentIndex)
Expand Down
Loading