ah_sce_unpacked/unpacked/Custom_Tile Token Remover 2ba7a5.ttslua

94 lines
2.2 KiB
Plaintext
Raw Permalink Normal View History

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)
__bundle_register("__root", function(require, _LOADED, __bundle_register, __bundle_modules)
require("util/TokenRemover")
end)
__bundle_register("util/TokenRemover", function(require, _LOADED, __bundle_register, __bundle_modules)
2024-06-09 10:10:21 -04:00
local zone
2023-01-29 19:31:52 -05:00
-- general code
function onSave()
2024-06-09 10:10:21 -04:00
return JSON.encode(zone and zone.getGUID())
2023-01-29 19:31:52 -05:00
end
function onLoad(savedData)
if savedData ~= "" and savedData ~= nil then
zone = getObjectFromGUID(JSON.decode(savedData))
end
setMenu(zone == nil)
end
-- context menu functions
function enable()
local scale = self.getScale()
zone = spawnObject({
type = "ScriptingTrigger",
2024-01-06 21:32:29 -05:00
position = self.getPosition() + Vector(0, 3.5 + 0.11, 0),
2023-01-29 19:31:52 -05:00
rotation = self.getRotation(),
2024-01-06 21:32:29 -05:00
scale = { scale.x * 2, 7, scale.z * 2 }
2023-01-29 19:31:52 -05:00
})
2024-01-06 21:32:29 -05:00
zone.setName("TokenDiscardZone")
2023-01-29 19:31:52 -05:00
setMenu(false)
end
function disable()
if zone ~= nil then zone.destruct() end
setMenu(true)
end
-- core functions
function setMenu(isEnabled)
self.clearContextMenu()
if isEnabled then
self.addContextMenuItem("Enable", enable)
else
self.addContextMenuItem("Disable", disable)
end
end
function onPickUp()
disable()
end
end)
return __bundle_require("__root")