2023-01-29 19:31:52 -05:00
|
|
|
-- Bundled by luabundle {"version":"1.6.0"}
|
|
|
|
local __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)
|
|
|
|
local loadingPlaceholder = {[{}] = true}
|
|
|
|
|
|
|
|
local register
|
|
|
|
local modules = {}
|
|
|
|
|
|
|
|
local require
|
|
|
|
local loaded = {}
|
|
|
|
|
|
|
|
register = function(name, body)
|
|
|
|
if not modules[name] then
|
|
|
|
modules[name] = body
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
require = function(name)
|
|
|
|
local loadedModule = loaded[name]
|
|
|
|
|
|
|
|
if loadedModule then
|
|
|
|
if loadedModule == loadingPlaceholder then
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if not modules[name] then
|
|
|
|
if not superRequire then
|
|
|
|
local identifier = type(name) == 'string' and '\"' .. name .. '\"' or tostring(name)
|
|
|
|
error('Tried to require ' .. identifier .. ', but no such module has been registered')
|
|
|
|
else
|
|
|
|
return superRequire(name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
loaded[name] = loadingPlaceholder
|
|
|
|
loadedModule = modules[name](require, loaded, register, modules)
|
|
|
|
loaded[name] = loadedModule
|
|
|
|
end
|
|
|
|
|
|
|
|
return loadedModule
|
|
|
|
end
|
|
|
|
|
|
|
|
return require, loaded, register, modules
|
|
|
|
end)(nil)
|
2023-04-22 16:56:01 -04:00
|
|
|
__bundle_register("__root", function(require, _LOADED, __bundle_register, __bundle_modules)
|
|
|
|
require("core/DoomCounter")
|
|
|
|
end)
|
2023-01-29 19:31:52 -05:00
|
|
|
__bundle_register("core/DoomCounter", function(require, _LOADED, __bundle_register, __bundle_modules)
|
|
|
|
local optionsVisible = false
|
|
|
|
local options = {
|
|
|
|
Agenda = true,
|
|
|
|
Playarea = true,
|
|
|
|
Playermats = true
|
|
|
|
}
|
|
|
|
|
|
|
|
val = 0
|
|
|
|
|
|
|
|
-- save current value and options
|
|
|
|
function onSave() return JSON.encode({ val, options }) end
|
|
|
|
|
|
|
|
function onLoad(savedData)
|
|
|
|
if savedData ~= "" then
|
|
|
|
local loadedData = JSON.decode(savedData)
|
|
|
|
val = loadedData[1]
|
|
|
|
options = loadedData[2]
|
|
|
|
|
|
|
|
-- restore state for option panel
|
|
|
|
for key, bool in pairs(options) do
|
|
|
|
self.UI.setAttribute("option" .. key, "isOn", not bool)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
self.createButton({
|
|
|
|
label = tostring(val),
|
|
|
|
click_function = "addOrSubtract",
|
|
|
|
function_owner = self,
|
|
|
|
position = { 0, 0.06, 0 },
|
|
|
|
height = 800,
|
|
|
|
width = 800,
|
|
|
|
font_size = 650,
|
|
|
|
scale = { 1.5, 1.5, 1.5 },
|
|
|
|
font_color = { 1, 1, 1, 95 },
|
|
|
|
color = { 0, 0, 0, 0 }
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
-- called by the invisible button to change displayed value
|
|
|
|
function addOrSubtract(_, _, isRightClick)
|
|
|
|
local newVal = math.min(math.max(val + (isRightClick and -1 or 1), 0), 99)
|
|
|
|
if val ~= newVal then
|
|
|
|
updateVal(newVal)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-04-22 16:56:01 -04:00
|
|
|
-- adds the provided number to the current count
|
|
|
|
function addVal(number)
|
|
|
|
number = tonumber(number) or 0
|
|
|
|
val = val + number
|
|
|
|
self.editButton({ index = 0, label = tostring(val) })
|
|
|
|
printToAll("Doom on agenda set to: " .. val)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- sets the current count to the provided number
|
2023-01-29 19:31:52 -05:00
|
|
|
function updateVal(number)
|
|
|
|
val = number or 0
|
|
|
|
self.editButton({ index = 0, label = tostring(val) })
|
|
|
|
printToAll("Doom on agenda set to: " .. val)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- called by "Reset" button to remove doom
|
|
|
|
function startReset()
|
|
|
|
if options.Agenda then
|
|
|
|
updateVal(0)
|
|
|
|
end
|
|
|
|
-- call the "Doom-in-Play"-counter
|
|
|
|
local DoomInPlayCounter = getObjectFromGUID("652ff3")
|
|
|
|
if DoomInPlayCounter then
|
|
|
|
DoomInPlayCounter.call("removeDoom", options)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- XML UI functions
|
|
|
|
function optionClick(_, optionName)
|
|
|
|
options[optionName] = not options[optionName]
|
|
|
|
printToAll("Doom removal of " .. optionName .. (options[optionName] and " enabled" or " disabled"))
|
|
|
|
end
|
|
|
|
|
|
|
|
function toggleOptions()
|
|
|
|
optionsVisible = not optionsVisible
|
|
|
|
|
|
|
|
if optionsVisible then
|
|
|
|
self.UI.show("Options")
|
|
|
|
else
|
|
|
|
self.UI.hide("Options")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
return __bundle_require("__root")
|