added documentation for difficulty selector code

This commit is contained in:
Chr1Z93 2022-11-15 11:57:28 +01:00
parent 1b2f70b59b
commit 68d49aca98

View File

@ -25,6 +25,7 @@ local NOT_INTERACTABLE = {
local chaosTokens = {}
local chaosTokensLastMat = nil
local IS_RESHUFFLING = false
---------------------------------------------------------
-- data for tokens
---------------------------------------------------------
@ -233,11 +234,10 @@ function returnChaosTokens()
end
function drawChaostoken(params)
findChaosBag()
local mat = params[1]
local tokenOffset = params[2]
local isRightClick = params[3]
findChaosBag()
-- return token(s) on other playmat first
if chaosTokensLastMat ~= nil and chaosTokensLastMat ~= mat and #chaosTokens ~= 0 then
@ -368,6 +368,9 @@ end
-- Difficulty selector script
---------------------------------------------------------
-- called for button creation on the difficulty selectors
---@param object object Usually "self"
---@param key string Name of the scenario
function createSetupButtons(args)
local data = getDataValue('modeData', args.key)
if data ~= nil then
@ -415,6 +418,10 @@ function createSetupButtons(args)
end
end
-- called for adding chaos tokens
---@param object object Usually "self"
---@param key string Name of the scenario
---@param mode string diffculty (e.g. "hard" or "expert")
function fillContainer(args)
findChaosBag()
@ -464,8 +471,13 @@ function fillContainer(args)
end
end
if value.message then broadcastToAll(value.message) end
if value.warning then broadcastToAll(value.warning, { 1, 0.5, 0.5 }) end
if value.message then
broadcastToAll(value.message)
end
if value.warning then
broadcastToAll(value.warning, { 1, 0.5, 0.5 })
end
end
end
@ -509,13 +521,14 @@ function spawnChaosToken(id, pos)
end
end
-- chaos bag needs this!
-- chaos bag needs this for renaming chaos tokens
function getTokenName(params)
local name = IMAGE_TOKEN_MAP[params.url]
if name == nil then name = "" end
return name
end
-- returns the image url for a chaos token (identified by the "id")
function getChaosTokenImageURL(id)
if id == 'p1' then return 'https://i.imgur.com/uIx8jbY.png' end
if id == '0' then return 'https://i.imgur.com/btEtVfd.png' end