Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion build/index.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions client/config.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Config = {}

-- Default option for playing sound. You can pass true or false as the last param for any minigame to overwrite this.
Config.DefaultPlaySound = true

GameTypes = {
circleProgress = "CircleProgress",
progress = "Progress",
Expand Down
4 changes: 2 additions & 2 deletions client/games/circleProgress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
---@param iterations number The amount of iterations to run
---@param difficulty number The difficulty of the game (1-100)
---@return boolean
local function circleProgress(iterations, difficulty)
local function circleProgress(iterations, difficulty, playSound)
local promise = promise:new()

---@type DifficultyConfig
local config = {
difficulty = difficulty,
}

local result = StartGame(GameTypes.circleProgress, iterations, config)
local result = StartGame(GameTypes.circleProgress, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/circleShake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---@param difficulty number The difficulty of the game (1-100)]
---@param numberOfKeys number The amount of keys to break
---@return boolean
local function circleShake(iterations, difficulty, numberOfKeys)
local function circleShake(iterations, difficulty, numberOfKeys, playSound)
local promise = promise:new()

---@type KeyDifficultyConfig
Expand All @@ -12,7 +12,7 @@ local function circleShake(iterations, difficulty, numberOfKeys)
numberOfKeys = numberOfKeys or 5,
}

local result = StartGame(GameTypes.circleShake, iterations, config)
local result = StartGame(GameTypes.circleShake, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/circleSum.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---@param iterations number The amount of iterations to run
---@param config LengthConfig
local function circleSum(iterations, config)
local function circleSum(iterations, config, playSound)
local promise = promise:new()

local result = StartGame(GameTypes.circleSum, iterations, config)
local result = StartGame(GameTypes.circleSum, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/digitDazzle.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---@param iterations number The amount of iterations to run
---@param config InputConfig
local function digitDazzle(iterations, config)
local function digitDazzle(iterations, config, playSound)
local promise = promise:new()

local result = StartGame(GameTypes.digitDazzle, iterations, config)
local result = StartGame(GameTypes.digitDazzle, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/keyCircle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---@param difficulty number The difficulty of the game (1-100)]
---@param numberOfKeys number The amount of keys to press
---@return boolean
local function keyCircle(iterations, difficulty, numberOfKeys)
local function keyCircle(iterations, difficulty, numberOfKeys, playSound)
local promise = promise:new()

---@type KeyDifficultyConfig
Expand All @@ -12,7 +12,7 @@ local function keyCircle(iterations, difficulty, numberOfKeys)
numberOfKeys = numberOfKeys or 3,
}

local result = StartGame(GameTypes.keyCircle, iterations, config)
local result = StartGame(GameTypes.keyCircle, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/keySpam.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
---@param iterations number The amount of iterations to run
---@param difficulty number The difficulty of the game (1-100)
---@return boolean
local function keySpam(iterations, difficulty)
local function keySpam(iterations, difficulty, playSound)
local promise = promise:new()

---@type DifficultyConfig
local config = {
difficulty = difficulty or 50,
}

local result = StartGame(GameTypes.keySpam, iterations, config)
local result = StartGame(GameTypes.keySpam, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/lightsOut.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---@param iterations number The amount of iterations to run
---@param config LevelConfig
local function lightsOut(iterations, config)
local function lightsOut(iterations, config, playSound)
local promise = promise:new()

local result = StartGame(GameTypes.lightsOut, iterations, config)
local result = StartGame(GameTypes.lightsOut, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/mineSweeper.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---@param iterations number The amount of iterations to run
---@param config GridConfig
local function mineSweeper(iterations, config)
local function mineSweeper(iterations, config, playSound)
local promise = promise:new()

local result = StartGame(GameTypes.mineSweeper, iterations, config)
local result = StartGame(GameTypes.mineSweeper, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/numberSlide.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---@param difficulty number The difficulty of the game (1-100)]
---@param numberOfKeys number The amount of keys to press
---@return boolean
local function numberSlide(iterations, difficulty, numberOfKeys)
local function numberSlide(iterations, difficulty, numberOfKeys, playSound)
local promise = promise:new()

---@type KeyDifficultyConfig
Expand All @@ -12,7 +12,7 @@ local function numberSlide(iterations, difficulty, numberOfKeys)
numberOfKeys = numberOfKeys or 5,
}

local result = StartGame(GameTypes.numberSlide, iterations, config)
local result = StartGame(GameTypes.numberSlide, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/pathFind.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---@param iterations number The amount of iterations to run
---@param config NodeConfig
local function pathFind(iterations, config)
local function pathFind(iterations, config, playSound)
local promise = promise:new()

local result = StartGame(GameTypes.pathFind, iterations, config)
local result = StartGame(GameTypes.pathFind, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/printLock.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---@param iterations number The amount of iterations to run
---@param config GridConfig
local function printLock(iterations, config)
local function printLock(iterations, config, playSound)
local promise = promise:new()

local result = StartGame(GameTypes.printLock, iterations, config)
local result = StartGame(GameTypes.printLock, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/progress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
---@param iterations number The amount of iterations to run
---@param difficulty number The difficulty of the game (1-100)
---@return boolean
local function progress(iterations, difficulty)
local function progress(iterations, difficulty, playSound)
local promise = promise:new()

---@type DifficultyConfig
local config = {
difficulty = difficulty or 50,
}

local result = StartGame(GameTypes.progress, iterations, config)
local result = StartGame(GameTypes.progress, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/rapidLines.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---@param difficulty number The difficulty of the game (1-100)]
---@param numberOfLines number The amount of keys to press
---@return boolean
local function rapidLines(iterations, difficulty, numberOfLines)
local function rapidLines(iterations, difficulty, numberOfLines, playSound)
local promise = promise:new()

---@type KeyDifficultyConfig
Expand All @@ -12,7 +12,7 @@ local function rapidLines(iterations, difficulty, numberOfLines)
numberOfKeys = numberOfLines or 5,
}

local result = StartGame(GameTypes.rapidLines, iterations, config)
local result = StartGame(GameTypes.rapidLines, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/untangle.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---@param iterations number The amount of iterations to run
---@param config NodeConfig
local function untangle(iterations, config)
local function untangle(iterations, config, playSound)
local promise = promise:new()

local result = StartGame(GameTypes.untangle, iterations, config)
local result = StartGame(GameTypes.untangle, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/waveMatch.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---@param iterations number The amount of iterations to run
---@param config {duration: number}
local function waveMatch(iterations, config)
local function waveMatch(iterations, config, playSound)
local promise = promise:new()

local result = StartGame(GameTypes.waveMatch, iterations, config)
local result = StartGame(GameTypes.waveMatch, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
4 changes: 2 additions & 2 deletions client/games/wordWiz.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---@param iterations number The amount of iterations to run
---@param config LengthConfig
local function wordWiz(iterations, config)
local function wordWiz(iterations, config, playSound)
local promise = promise:new()

local result = StartGame(GameTypes.wordWiz, iterations, config)
local result = StartGame(GameTypes.wordWiz, iterations, config, playSound)
promise:resolve(result)

return Citizen.Await(promise)
Expand Down
3 changes: 2 additions & 1 deletion client/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ end
---@param gameType string The type of game to start
---@param iterations number The amount of iterations to run
---@param config MainFunctionConfig config for the game
function StartGame(gameType, iterations, config)
function StartGame(gameType, iterations, config, playSound)
assert(isUILoaded(), 'UI loading timeout')

if not gameType then
Expand All @@ -51,6 +51,7 @@ function StartGame(gameType, iterations, config)
type = gameType,
iterations = iterations or 1,
config = config,
playSound = playSound ~= nil and playSound or Config.DefaultPlaySound,
})

local configInput = Config.KeepGameInput[gameType]
Expand Down
Loading