re-added token remover

This commit is contained in:
Chr1Z93 2023-11-02 09:33:01 +01:00
parent 85f449ce4b
commit 929d56e34f
9 changed files with 208 additions and 32 deletions

View File

@ -176,6 +176,10 @@
"PlayerCards.2d30ee", "PlayerCards.2d30ee",
"TokenRemover.39b175", "TokenRemover.39b175",
"TokenRemover.2ba7a5", "TokenRemover.2ba7a5",
"TokenDiscardZone.457de3",
"TokenDiscardZone.457de4",
"TokenDiscardZone.457de5",
"TokenDiscardZone.457de6",
"Decoration-Map.6161b4", "Decoration-Map.6161b4",
"RulebooksGuidesandTablets.fcfa7f", "RulebooksGuidesandTablets.fcfa7f",
"TableDivider.612072", "TableDivider.612072",

View File

@ -0,0 +1,46 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"a": 0.5098,
"b": 1,
"g": 1,
"r": 1
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "457de3",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "ScriptingTrigger",
"Nickname": "TokenDiscardZone",
"Snap": true,
"Sticky": true,
"Tooltip": false,
"Transform": {
"posX": -65,
"posY": 1.5,
"posZ": 16.1,
"rotX": 0,
"rotY": 90,
"rotZ": 0,
"scaleX": 22,
"scaleY": 0.5,
"scaleZ": 5
},
"Value": 0,
"XmlUI": ""
}

View File

@ -0,0 +1,46 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"a": 0.5098,
"b": 1,
"g": 1,
"r": 1
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "457de4",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "ScriptingTrigger",
"Nickname": "TokenDiscardZone",
"Snap": true,
"Sticky": true,
"Tooltip": false,
"Transform": {
"posX": -65,
"posY": 1.5,
"posZ": -16.1,
"rotX": 0,
"rotY": 90,
"rotZ": 0,
"scaleX": 22,
"scaleY": 0.5,
"scaleZ": 5
},
"Value": 0,
"XmlUI": ""
}

View File

@ -0,0 +1,46 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"a": 0.5098,
"b": 1,
"g": 1,
"r": 1
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "457de5",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "ScriptingTrigger",
"Nickname": "TokenDiscardZone",
"Snap": true,
"Sticky": true,
"Tooltip": false,
"Transform": {
"posX": -30.35,
"posY": 1.5,
"posZ": 36.6,
"rotX": 0,
"rotY": 180,
"rotZ": 0,
"scaleX": 22,
"scaleY": 0.5,
"scaleZ": 5
},
"Value": 0,
"XmlUI": ""
}

View File

@ -0,0 +1,46 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"a": 0.5098,
"b": 1,
"g": 1,
"r": 1
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "457de6",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "ScriptingTrigger",
"Nickname": "TokenDiscardZone",
"Snap": true,
"Sticky": true,
"Tooltip": false,
"Transform": {
"posX": -30.35,
"posY": 1.5,
"posZ": -36.6,
"rotX": 0,
"rotY": 0,
"rotZ": 0,
"scaleX": 22,
"scaleY": 0.5,
"scaleZ": 5
},
"Value": 0,
"XmlUI": ""
}

View File

@ -8,6 +8,7 @@ local GuidReferences = {
InvestigatorSkillTracker = "e598c2", InvestigatorSkillTracker = "e598c2",
Playermat = "8b081b", Playermat = "8b081b",
ResourceCounter = "4406f0", ResourceCounter = "4406f0",
TokenDiscardZone = "457de3",
Trash = "147e80" Trash = "147e80"
}, },
Orange = { Orange = {
@ -19,6 +20,7 @@ local GuidReferences = {
InvestigatorSkillTracker = "b4a5f7", InvestigatorSkillTracker = "b4a5f7",
Playermat = "bd0ff4", Playermat = "bd0ff4",
ResourceCounter = "816d84", ResourceCounter = "816d84",
TokenDiscardZone = "457de4",
Trash = "f7b6c8" Trash = "f7b6c8"
}, },
Green = { Green = {
@ -30,6 +32,7 @@ local GuidReferences = {
InvestigatorSkillTracker = "af7ed7", InvestigatorSkillTracker = "af7ed7",
Playermat = "383d8b", Playermat = "383d8b",
ResourceCounter = "cd15ac", ResourceCounter = "cd15ac",
TokenDiscardZone = "457de5",
Trash = "5f896a" Trash = "5f896a"
}, },
Red = { Red = {
@ -41,6 +44,7 @@ local GuidReferences = {
InvestigatorSkillTracker = "e74881", InvestigatorSkillTracker = "e74881",
Playermat = "0840d5", Playermat = "0840d5",
ResourceCounter = "a4b60d", ResourceCounter = "a4b60d",
TokenDiscardZone = "457de6",
Trash = "4b8594" Trash = "4b8594"
}, },
Mythos = { Mythos = {

View File

@ -186,6 +186,19 @@ function tryObjectEnterContainer(container, object)
return true return true
end end
-- TTS event for objects that enter zones
-- used to detect the "token discard zones" beneath the hand zones
function onObjectEnterZone(zone, enteringObj)
if zone.getName() ~= "TokenDiscardZone" then return end
if tokenChecker.isChaosToken(enteringObj) then return end
if enteringObj.type == "Tile" and enteringObj.getMemo() and enteringObj.getLock() == false then
local matcolor = playmatApi.getMatColorByPosition(enteringObj.getPosition())
local trash = guidReferenceApi.getObjectByOwnerAndType(matcolor, "Trash")
trash.putObject(enteringObj)
end
end
--------------------------------------------------------- ---------------------------------------------------------
-- chaos token drawing -- chaos token drawing
--------------------------------------------------------- ---------------------------------------------------------

View File

@ -89,9 +89,6 @@ local matColor = self.getMemo()
-- variable to track the status of the "Show Draw Button" option -- variable to track the status of the "Show Draw Button" option
local isDrawButtonVisible = false local isDrawButtonVisible = false
-- limit search calls if multiple cards enter the hand
local pendingHandSearch = false
-- global variable to report "Dream-Enhancing Serum" status -- global variable to report "Dream-Enhancing Serum" status
isDES = false isDES = false
@ -185,10 +182,6 @@ function isCard(x) return x.type == 'Card' end
function isDeck(x) return x.type == 'Deck' end function isDeck(x) return x.type == 'Deck' end
function isCardOrDeck(x) return x.type == 'Card' or x.type == 'Deck' end function isCardOrDeck(x) return x.type == 'Card' or x.type == 'Deck' end
function isUnlockedTokenOrTileWithMemo(x)
return (x.type == "Token" or x.type == "Tile") and x.getMemo() and x.getLock() == false
end
-- finds all objects on the playmat and associated set aside zone. -- finds all objects on the playmat and associated set aside zone.
function searchAroundSelf(filter) function searchAroundSelf(filter)
local bounds = self.getBoundsNormalized() local bounds = self.getBoundsNormalized()
@ -818,21 +811,6 @@ function resetSkillTracker()
end end
end end
-- removal of tokens when a card enters the hand by searching the area below the handzone for tokens/tiles
function onObjectEnterZone(zone)
if pendingHandSearch == false and zone == ownedObjects.HandZone then
pendingHandSearch = true
Wait.time(function()
local searchPos = zone.getPosition():setAt("y", 1.5)
local searchSize = zone.getScale():setAt("y", 1)
for _, obj in ipairs(searchArea(searchPos, searchSize, isUnlockedTokenOrTileWithMemo)) do
ownedObjects.Trash.putObject(obj)
end
pendingHandSearch = false
end, 1)
end
end
--------------------------------------------------------- ---------------------------------------------------------
-- calls to 'Global' / functions for calls from outside -- calls to 'Global' / functions for calls from outside
--------------------------------------------------------- ---------------------------------------------------------

View File

@ -1,5 +1,4 @@
local zone = nil local zone = nil
local tokenChecker = require("core/token/TokenChecker")
-- general code -- general code
function onSave() function onSave()
@ -18,10 +17,11 @@ function enable()
local scale = self.getScale() local scale = self.getScale()
zone = spawnObject({ zone = spawnObject({
type = "ScriptingTrigger", type = "ScriptingTrigger",
position = self.getPosition() + Vector(0, 2.5 + 0.11, 0), position = self.getPosition() + Vector(0, 3.5 + 0.11, 0),
rotation = self.getRotation(), rotation = self.getRotation(),
scale = { scale.x * 2, 5, scale.z * 2 } scale = { scale.x * 2, 7, scale.z * 2 }
}) })
zone.setName("TokenDiscardZone")
setMenu(false) setMenu(false)
end end
@ -40,13 +40,6 @@ function setMenu(isEnabled)
end end
end 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 tokenChecker.isChaosToken(object) then return end
object.destruct()
end
function onPickUp() function onPickUp()
disable() disable()
end end