Skip to content

Commit

Permalink
feat(match2): make autoScore optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Rathoz committed Nov 6, 2024
1 parent 2328370 commit d4aed3a
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit d4aed3a

Please sign in to comment.