generalized utility file
This commit is contained in:
parent
46781a9f9e
commit
db52e65609
@ -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
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user