ah_sce_unpacked/unpacked/Custom_Token Damage 591a45.ttslua

99 lines
2.4 KiB
Plaintext
Raw Normal View History

2022-12-13 14:02:30 -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)
__bundle_register("__root", function(require, _LOADED, __bundle_register, __bundle_modules)
require("playermat/GenericCounter")
end)
__bundle_register("playermat/GenericCounter", function(require, _LOADED, __bundle_register, __bundle_modules)
2020-12-06 09:42:32 -05:00
MIN_VALUE = -99
MAX_VALUE = 999
2022-12-13 14:02:30 -05:00
val = 0
2020-12-06 09:42:32 -05:00
2022-12-13 14:02:30 -05:00
function onSave() return JSON.encode(val) end
2020-12-06 09:42:32 -05:00
2022-12-13 14:02:30 -05:00
function onLoad(saved_data)
if saved_data ~= nil then
val = JSON.decode(saved_data)
2020-12-06 09:42:32 -05:00
end
2022-12-13 14:02:30 -05:00
local name = self.getName()
local position = {}
2020-12-06 09:42:32 -05:00
2022-12-13 14:02:30 -05:00
if name == "Damage" or name == "Resources" then
position = { 0, 0.06, 0.1 }
elseif name == "Horror" then
position = { -0.025, 0.06, -0.025 }
2020-12-06 09:42:32 -05:00
else
2022-12-13 14:02:30 -05:00
position = { 0, 0.06, 0 }
2020-12-06 09:42:32 -05:00
end
self.createButton({
label = tostring(val),
2022-12-13 14:02:30 -05:00
click_function = "addOrSubtract",
function_owner = self,
position = position,
height = 600,
width = 1000,
scale = { 1.5, 1.5, 1.5 },
font_size = 600,
font_color = { 1, 1, 1, 100 },
color = { 0, 0, 0, 0 }
})
2020-12-06 09:42:32 -05:00
end
2022-12-13 14:02:30 -05:00
function updateVal(newVal)
if tonumber(newVal) then
val = newVal
self.editButton({
index = 0,
label = tostring(val)
2020-12-06 09:42:32 -05:00
})
2022-12-13 14:02:30 -05:00
end
2020-12-06 09:42:32 -05:00
end
2022-12-13 14:02:30 -05:00
function addOrSubtract(_, _, alt_click)
val = math.min(math.max(val + (alt_click and -1 or 1), MIN_VALUE), MAX_VALUE)
self.editButton({ index = 0, label = tostring(val) })
2020-12-06 09:42:32 -05:00
end
2022-12-13 14:02:30 -05:00
end)
return __bundle_require("__root")