ah_sce_unpacked/unpacked/Custom_Tile Whimsical's Token Remover 0a5a29.ttslua
2022-12-13 14:02:30 -05:00

121 lines
2.9 KiB
Plaintext

-- 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)
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Whimsical.
--- DateTime: 2021-02-02 9:41 a.m.
---
local zone = nil
-- Forward Declaration
---@param is_enabled boolean
local setMenu = function(is_enabled) end
local function enable()
if self.held_by_color~=nil then return end
local position = self:getPosition()
local rotation = self:getRotation()
local scale = self:getScale()
zone = spawnObject {
type = "ScriptingTrigger",
position = Vector(position.x, position.y+25+(bit32.rshift(scale.y, 1))+0.41, position.z),
rotation = rotation,
scale = Vector(scale.x*2, 50, scale.z*2),
sound = true,
snap_to_grid = true
}
setMenu(false)
end
local function disable()
if zone~=nil then zone:destruct() end
setMenu(true)
end
---@param is_enabled boolean
setMenu = function(is_enabled)
self:clearContextMenu()
if is_enabled then
self:addContextMenuItem("Enable", enable, false)
else
self:addContextMenuItem("Disable", disable, false)
end
end
function onLoad(save_state)
if save_state=="" then return end
local data = JSON.decode(save_state)
zone = getObjectFromGUID(data.zone)
setMenu(zone==nil)
end
function onSave()
return JSON.encode {
zone = zone and zone:getGUID() or nil
}
end
---@param entering TTSObject
---@param object TTSObject
function onObjectEnterScriptingZone(entering , object)
if zone~=entering then return end
if object==self then return end
if object.type=="Deck" or object.type=="Card" then return end
object:destruct()
end
---@param color string
function onPickUp(color)
disable()
end
end)
return __bundle_require("__root")