initial commit

This commit is contained in:
Chr1Z93 2023-01-02 13:18:51 +01:00
parent f2dd81e5d1
commit 8651df0118
4 changed files with 82 additions and 74 deletions

View File

@ -154,7 +154,7 @@
"ChaosBagStatTracker.766620",
"Blesstokens.afa06b",
"Cursetokens.bd0253",
"WhimsicalsTokenRemover.0a5a29",
"TokenRemover.0a5a29",
"TokenSpawner.36b4ee",
"Fan-MadeScenariosCampaignsMiscellany.66e97c",
"OfficialStandaloneChallengeScenarios.0ef5c8",

View File

@ -1,6 +1,6 @@
{
"10": {
"body": "Created by Whimsical\n\nAnything that passes over the remover that isn't a card or a deck will be deleted.\r\nTo use the remover, right click on it, choose the \"Enable\" option, and take your card with resources/horror/damage and swipe it over the remover. You may wish to unlock and/or copy the remover to your play area first.",
"body": "Created by Whimsical\n\nAnything that passes over the remover that isn't a card, deck or chaos token will be deleted.\r\nTo use the remover, right click on it, choose the \"Enable\" option, and take your card with resources/horror/damage and swipe it over the remover. You may wish to unlock and/or copy the remover to your play area first.",
"color": "Grey",
"id": 10,
"title": "Token Remover",

View File

@ -14,7 +14,7 @@
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.2,
"Thickness": 0.1,
"Type": 0
},
"ImageScalar": 1,
@ -34,10 +34,10 @@
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "require(\"util/TokenRemover\")",
"LuaScriptState": "[]",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "Whimsical's Token Remover",
"Nickname": "Token Remover",
"Snap": true,
"Sticky": true,
"Tags": [
@ -45,15 +45,15 @@
],
"Tooltip": true,
"Transform": {
"posX": -6.868,
"posX": -7,
"posY": 1.583,
"posZ": -16.394,
"posZ": -16.4,
"rotX": 0,
"rotY": 90,
"rotZ": 0,
"scaleX": 0.75,
"scaleX": 0.8,
"scaleY": 1,
"scaleZ": 0.75
"scaleZ": 0.8
},
"Value": 0,
"XmlUI": ""

View File

@ -1,72 +1,80 @@
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Whimsical.
--- DateTime: 2021-02-02 9:41 a.m.
---
local zone = nil
local CHAOS_TOKEN_NAMES = {
"Elder Sign",
"+1",
"0",
"-1",
"-2",
"-3",
"-4",
"-5",
"-6",
"-7",
"-8",
"Skull",
"Cultist",
"Tablet",
"Elder Thing",
"Auto-fail",
"Bless",
"Curse",
"Frost"
}
-- Forward Declaration
---@param is_enabled boolean
local setMenu = function(is_enabled) end
-- general code
function onSave()
return JSON.encode(zone and zone.getGUID() or nil)
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()
function onLoad(savedData)
if savedData ~= "" and savedData ~= nil then
zone = getObjectFromGUID(JSON.decode(savedData))
end
setMenu(zone == nil)
end
zone = spawnObject {
-- context menu functions
function enable()
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
}
position = self.getPosition() + Vector(0, 2.5 + 0.11, 0),
rotation = self.getRotation(),
scale = { scale.x * 2, 5, scale.z * 2 }
})
setMenu(false)
end
local function disable()
if zone~=nil then zone:destruct() end
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)
-- core functions
function setMenu(isEnabled)
self.clearContextMenu()
if isEnabled then
self.addContextMenuItem("Enable", enable)
else
self:addContextMenuItem("Disable", disable, false)
self.addContextMenuItem("Disable", disable)
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)
function onObjectEnterScriptingZone(entering, object)
if zone ~= entering or object == self or object.type == "Deck" or object.type == "Card" then
return
end
local name = object.getName()
for _, entry in ipairs(CHAOS_TOKEN_NAMES) do
if entry == name then return end
end
object.destruct()
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)
function onPickUp()
disable()
end