diff --git a/src/util/isChaosToken.ttslua b/src/core/token/TokenChecker.ttslua similarity index 77% rename from src/util/isChaosToken.ttslua rename to src/core/token/TokenChecker.ttslua index d85c1f23..8d080f86 100644 --- a/src/util/isChaosToken.ttslua +++ b/src/core/token/TokenChecker.ttslua @@ -21,11 +21,16 @@ do ["Frost"] = true } - return function(obj) + local TokenChecker = {} + + -- returns true if the passed object is a chaos token (by name) + TokenChecker.isChaosToken = function(obj) if CHAOS_TOKEN_NAMES[obj.getName()] then return true else return false end end + + return TokenChecker end diff --git a/src/playermat/Playmat.ttslua b/src/playermat/Playmat.ttslua index c9422afa..6ec33928 100644 --- a/src/playermat/Playmat.ttslua +++ b/src/playermat/Playmat.ttslua @@ -1,5 +1,5 @@ local tokenManager = require("core/token/TokenManager") -local isChaosToken = require("util/isChaosToken") +local tokenChecker = require("core/token/TokenChecker") -- set true to enable debug logging and show Physics.cast() local DEBUG = false @@ -180,7 +180,7 @@ function makeDiscardHandlerFor(searchPosition, discardPosition) obj.setRotation({0, -90, 0}) end -- put chaos tokens back into bag (e.g. Unrelenting) - elseif isChaosToken(obj) then + elseif tokenChecker.isChaosToken(obj) then local chaosBag = Global.call("findChaosBag") chaosBag.putObject(obj) -- don't touch the table or this playmat itself diff --git a/src/util/TokenRemover.ttslua b/src/util/TokenRemover.ttslua index fc1401af..8e7bc84b 100644 --- a/src/util/TokenRemover.ttslua +++ b/src/util/TokenRemover.ttslua @@ -1,5 +1,5 @@ local zone = nil -local isChaosToken = require("util/isChaosToken") +local tokenChecker = require("core/token/TokenChecker") -- general code function onSave() @@ -43,7 +43,7 @@ end function onObjectEnterScriptingZone(entering, object) if zone ~= entering then return end if object == self or object.type == "Deck" or object.type == "Card" then return end - if isChaosToken(object) then return end + if tokenChecker.isChaosToken(object) then return end object.destruct() end