diff --git a/config.json b/config.json index e1e364ce..0240453e 100644 --- a/config.json +++ b/config.json @@ -176,6 +176,10 @@ "PlayerCards.2d30ee", "TokenRemover.39b175", "TokenRemover.2ba7a5", + "TokenDiscardZone.457de3", + "TokenDiscardZone.457de4", + "TokenDiscardZone.457de5", + "TokenDiscardZone.457de6", "Decoration-Map.6161b4", "RulebooksGuidesandTablets.fcfa7f", "TableDivider.612072", diff --git a/objects/TokenDiscardZone.457de3.json b/objects/TokenDiscardZone.457de3.json new file mode 100644 index 00000000..9062944f --- /dev/null +++ b/objects/TokenDiscardZone.457de3.json @@ -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": "" +} \ No newline at end of file diff --git a/objects/TokenDiscardZone.457de4.json b/objects/TokenDiscardZone.457de4.json new file mode 100644 index 00000000..991c9200 --- /dev/null +++ b/objects/TokenDiscardZone.457de4.json @@ -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": "" +} \ No newline at end of file diff --git a/objects/TokenDiscardZone.457de5.json b/objects/TokenDiscardZone.457de5.json new file mode 100644 index 00000000..2a85afc9 --- /dev/null +++ b/objects/TokenDiscardZone.457de5.json @@ -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": "" +} \ No newline at end of file diff --git a/objects/TokenDiscardZone.457de6.json b/objects/TokenDiscardZone.457de6.json new file mode 100644 index 00000000..5100327c --- /dev/null +++ b/objects/TokenDiscardZone.457de6.json @@ -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": "" +} \ No newline at end of file diff --git a/src/core/GUIDReferenceHandler.ttslua b/src/core/GUIDReferenceHandler.ttslua index 53b3c7d9..6aa81cd8 100644 --- a/src/core/GUIDReferenceHandler.ttslua +++ b/src/core/GUIDReferenceHandler.ttslua @@ -8,6 +8,7 @@ local GuidReferences = { InvestigatorSkillTracker = "e598c2", Playermat = "8b081b", ResourceCounter = "4406f0", + TokenDiscardZone = "457de3", Trash = "147e80" }, Orange = { @@ -19,6 +20,7 @@ local GuidReferences = { InvestigatorSkillTracker = "b4a5f7", Playermat = "bd0ff4", ResourceCounter = "816d84", + TokenDiscardZone = "457de4", Trash = "f7b6c8" }, Green = { @@ -30,6 +32,7 @@ local GuidReferences = { InvestigatorSkillTracker = "af7ed7", Playermat = "383d8b", ResourceCounter = "cd15ac", + TokenDiscardZone = "457de5", Trash = "5f896a" }, Red = { @@ -41,6 +44,7 @@ local GuidReferences = { InvestigatorSkillTracker = "e74881", Playermat = "0840d5", ResourceCounter = "a4b60d", + TokenDiscardZone = "457de6", Trash = "4b8594" }, Mythos = { diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 92e088bf..ec10ce08 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -186,6 +186,19 @@ function tryObjectEnterContainer(container, object) return true 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 --------------------------------------------------------- diff --git a/src/playermat/Playmat.ttslua b/src/playermat/Playmat.ttslua index 00274ff4..5465a9cf 100644 --- a/src/playermat/Playmat.ttslua +++ b/src/playermat/Playmat.ttslua @@ -89,9 +89,6 @@ local matColor = self.getMemo() -- variable to track the status of the "Show Draw Button" option local isDrawButtonVisible = false --- limit search calls if multiple cards enter the hand -local pendingHandSearch = false - -- global variable to report "Dream-Enhancing Serum" status isDES = false @@ -185,10 +182,6 @@ function isCard(x) return x.type == 'Card' end function isDeck(x) return 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. function searchAroundSelf(filter) local bounds = self.getBoundsNormalized() @@ -818,21 +811,6 @@ function resetSkillTracker() 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 --------------------------------------------------------- diff --git a/src/util/TokenRemover.ttslua b/src/util/TokenRemover.ttslua index 8e7bc84b..d1a76c00 100644 --- a/src/util/TokenRemover.ttslua +++ b/src/util/TokenRemover.ttslua @@ -1,5 +1,4 @@ local zone = nil -local tokenChecker = require("core/token/TokenChecker") -- general code function onSave() @@ -18,10 +17,11 @@ function enable() local scale = self.getScale() zone = spawnObject({ 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(), - scale = { scale.x * 2, 5, scale.z * 2 } + scale = { scale.x * 2, 7, scale.z * 2 } }) + zone.setName("TokenDiscardZone") setMenu(false) end @@ -40,13 +40,6 @@ function setMenu(isEnabled) 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() disable() end