From 46781a9f9e858724edd68ca41fbb03e01d9d3e1d Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Thu, 5 Jan 2023 15:59:07 +0100 Subject: [PATCH 1/2] adding new util file --- .../Unrelenting1.45386d.ttslua | 2 - objects/Blesstokens.afa06b.json | 20 +++---- ...tom_Tile.b2b7be.json => Bless.b2b7be.json} | 4 +- .../Custom_Tile.09aa04.json | 57 ------------------- .../Custom_Tile.5ca99d.json | 57 ------------------- .../Custom_Tile.90e57c.json | 57 ------------------- .../Custom_Tile.bc1c12.json | 57 ------------------- .../Custom_Tile.e9c4f9.json | 57 ------------------- .../Custom_Tile.eb0b16.json | 57 ------------------- objects/Cursetokens.bd0253.json | 20 +++---- ...tom_Tile.678891.json => Curse.678891.json} | 4 +- .../Custom_Tile.5b224c.json | 57 ------------------- .../Custom_Tile.adec97.json | 57 ------------------- .../Custom_Tile.b92c2b.json | 57 ------------------- .../Custom_Tile.f82dd9.json | 57 ------------------- src/core/Global.ttslua | 12 ++-- src/playermat/Playmat.ttslua | 5 ++ src/util/TokenRemover.ttslua | 26 +-------- src/util/isChaosToken.ttslua | 31 ++++++++++ 19 files changed, 69 insertions(+), 625 deletions(-) rename objects/Blesstokens.afa06b/{Custom_Tile.b2b7be.json => Bless.b2b7be.json} (97%) delete mode 100644 objects/Blesstokens.afa06b/Custom_Tile.09aa04.json delete mode 100644 objects/Blesstokens.afa06b/Custom_Tile.5ca99d.json delete mode 100644 objects/Blesstokens.afa06b/Custom_Tile.90e57c.json delete mode 100644 objects/Blesstokens.afa06b/Custom_Tile.bc1c12.json delete mode 100644 objects/Blesstokens.afa06b/Custom_Tile.e9c4f9.json delete mode 100644 objects/Blesstokens.afa06b/Custom_Tile.eb0b16.json rename objects/Cursetokens.bd0253/{Custom_Tile.678891.json => Curse.678891.json} (97%) delete mode 100644 objects/Cursetokens.bd0253/Custom_Tile.5b224c.json delete mode 100644 objects/Cursetokens.bd0253/Custom_Tile.adec97.json delete mode 100644 objects/Cursetokens.bd0253/Custom_Tile.b92c2b.json delete mode 100644 objects/Cursetokens.bd0253/Custom_Tile.f82dd9.json create mode 100644 src/util/isChaosToken.ttslua diff --git a/objects/AllPlayerCards.15bb07/Unrelenting1.45386d.ttslua b/objects/AllPlayerCards.15bb07/Unrelenting1.45386d.ttslua index e6e2fe94..16e20d25 100644 --- a/objects/AllPlayerCards.15bb07/Unrelenting1.45386d.ttslua +++ b/objects/AllPlayerCards.15bb07/Unrelenting1.45386d.ttslua @@ -1,5 +1,3 @@ -ASSEMBLY_POSITION = {69.08, 4, 36.45} - function onload() chaosbag = getChaosBag() manager = getObjectFromGUID("5933fb") diff --git a/objects/Blesstokens.afa06b.json b/objects/Blesstokens.afa06b.json index 5bf4f364..c6945406 100644 --- a/objects/Blesstokens.afa06b.json +++ b/objects/Blesstokens.afa06b.json @@ -14,16 +14,16 @@ "r": 1 }, "ContainedObjects_order": [ - "Custom_Tile.b2b7be", - "Custom_Tile.b2b7be", - "Custom_Tile.09aa04", - "Custom_Tile.90e57c", - "Custom_Tile.5ca99d", - "Custom_Tile.b2b7be", - "Custom_Tile.bc1c12", - "Custom_Tile.e9c4f9", - "Custom_Tile.eb0b16", - "Custom_Tile.eb0b16" + "Bless.b2b7be", + "Bless.b2b7be", + "Bless.b2b7be", + "Bless.b2b7be", + "Bless.b2b7be", + "Bless.b2b7be", + "Bless.b2b7be", + "Bless.b2b7be", + "Bless.b2b7be", + "Bless.b2b7be" ], "ContainedObjects_path": "Blesstokens.afa06b", "CustomMesh": { diff --git a/objects/Blesstokens.afa06b/Custom_Tile.b2b7be.json b/objects/Blesstokens.afa06b/Bless.b2b7be.json similarity index 97% rename from objects/Blesstokens.afa06b/Custom_Tile.b2b7be.json rename to objects/Blesstokens.afa06b/Bless.b2b7be.json index f875b6a1..3506087e 100644 --- a/objects/Blesstokens.afa06b/Custom_Tile.b2b7be.json +++ b/objects/Blesstokens.afa06b/Bless.b2b7be.json @@ -37,7 +37,7 @@ "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Tile", - "Nickname": "", + "Nickname": "Bless", "Snap": true, "Sticky": true, "Tooltip": true, @@ -54,4 +54,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/Blesstokens.afa06b/Custom_Tile.09aa04.json b/objects/Blesstokens.afa06b/Custom_Tile.09aa04.json deleted file mode 100644 index dcd65874..00000000 --- a/objects/Blesstokens.afa06b/Custom_Tile.09aa04.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0.04894, - "g": 0.32859, - "r": 0.37456 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 2 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "09aa04", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -1.465, - "posY": 1.694, - "posZ": -26.93, - "rotX": 0, - "rotY": 90, - "rotZ": 0, - "scaleX": 0.81, - "scaleY": 1, - "scaleZ": 0.81 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/Blesstokens.afa06b/Custom_Tile.5ca99d.json b/objects/Blesstokens.afa06b/Custom_Tile.5ca99d.json deleted file mode 100644 index a7256d48..00000000 --- a/objects/Blesstokens.afa06b/Custom_Tile.5ca99d.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0.04894, - "g": 0.32859, - "r": 0.37456 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 2 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5ca99d", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -1.465, - "posY": 1.709, - "posZ": -26.93, - "rotX": 0, - "rotY": 90, - "rotZ": 0, - "scaleX": 0.81, - "scaleY": 1, - "scaleZ": 0.81 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/Blesstokens.afa06b/Custom_Tile.90e57c.json b/objects/Blesstokens.afa06b/Custom_Tile.90e57c.json deleted file mode 100644 index eba3c002..00000000 --- a/objects/Blesstokens.afa06b/Custom_Tile.90e57c.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0.04894, - "g": 0.32859, - "r": 0.37456 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 2 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "90e57c", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -1.465, - "posY": 1.706, - "posZ": -26.93, - "rotX": 0, - "rotY": 90, - "rotZ": 0, - "scaleX": 0.81, - "scaleY": 1, - "scaleZ": 0.81 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/Blesstokens.afa06b/Custom_Tile.bc1c12.json b/objects/Blesstokens.afa06b/Custom_Tile.bc1c12.json deleted file mode 100644 index 656c76d6..00000000 --- a/objects/Blesstokens.afa06b/Custom_Tile.bc1c12.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0.04894, - "g": 0.32859, - "r": 0.37456 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 2 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "bc1c12", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -1.465, - "posY": 1.688, - "posZ": -26.93, - "rotX": 0, - "rotY": 90, - "rotZ": 0, - "scaleX": 0.81, - "scaleY": 1, - "scaleZ": 0.81 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/Blesstokens.afa06b/Custom_Tile.e9c4f9.json b/objects/Blesstokens.afa06b/Custom_Tile.e9c4f9.json deleted file mode 100644 index 44d0fd02..00000000 --- a/objects/Blesstokens.afa06b/Custom_Tile.e9c4f9.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0.04894, - "g": 0.32859, - "r": 0.37456 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 2 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "e9c4f9", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -1.465, - "posY": 1.697, - "posZ": -26.93, - "rotX": 0, - "rotY": 90, - "rotZ": 0, - "scaleX": 0.81, - "scaleY": 1, - "scaleZ": 0.81 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/Blesstokens.afa06b/Custom_Tile.eb0b16.json b/objects/Blesstokens.afa06b/Custom_Tile.eb0b16.json deleted file mode 100644 index c01939c4..00000000 --- a/objects/Blesstokens.afa06b/Custom_Tile.eb0b16.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0.04894, - "g": 0.32859, - "r": 0.37456 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 2 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "eb0b16", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -45.934, - "posY": 1.814, - "posZ": 4.076, - "rotX": 0, - "rotY": 90, - "rotZ": 0, - "scaleX": 0.81, - "scaleY": 1, - "scaleZ": 0.81 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/Cursetokens.bd0253.json b/objects/Cursetokens.bd0253.json index b7b9d5ff..41b510ac 100644 --- a/objects/Cursetokens.bd0253.json +++ b/objects/Cursetokens.bd0253.json @@ -14,16 +14,16 @@ "r": 1 }, "ContainedObjects_order": [ - "Custom_Tile.678891", - "Custom_Tile.678891", - "Custom_Tile.adec97", - "Custom_Tile.678891", - "Custom_Tile.f82dd9", - "Custom_Tile.678891", - "Custom_Tile.5b224c", - "Custom_Tile.678891", - "Custom_Tile.b92c2b", - "Custom_Tile.678891" + "Curse.678891", + "Curse.678891", + "Curse.678891", + "Curse.678891", + "Curse.678891", + "Curse.678891", + "Curse.678891", + "Curse.678891", + "Curse.678891", + "Curse.678891" ], "ContainedObjects_path": "Cursetokens.bd0253", "CustomMesh": { diff --git a/objects/Cursetokens.bd0253/Custom_Tile.678891.json b/objects/Cursetokens.bd0253/Curse.678891.json similarity index 97% rename from objects/Cursetokens.bd0253/Custom_Tile.678891.json rename to objects/Cursetokens.bd0253/Curse.678891.json index f580f226..4c881fba 100644 --- a/objects/Cursetokens.bd0253/Custom_Tile.678891.json +++ b/objects/Cursetokens.bd0253/Curse.678891.json @@ -37,7 +37,7 @@ "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Tile", - "Nickname": "", + "Nickname": "Curse", "Snap": true, "Sticky": true, "Tooltip": true, @@ -54,4 +54,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/Cursetokens.bd0253/Custom_Tile.5b224c.json b/objects/Cursetokens.bd0253/Custom_Tile.5b224c.json deleted file mode 100644 index f4ac6eef..00000000 --- a/objects/Cursetokens.bd0253/Custom_Tile.5b224c.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0.44425, - "g": 0.00387, - "r": 0.27072 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 2 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5b224c", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 4.233, - "posY": 1.607, - "posZ": -21.577, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 0.81, - "scaleY": 1, - "scaleZ": 0.81 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/Cursetokens.bd0253/Custom_Tile.adec97.json b/objects/Cursetokens.bd0253/Custom_Tile.adec97.json deleted file mode 100644 index 7ba73ed2..00000000 --- a/objects/Cursetokens.bd0253/Custom_Tile.adec97.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0.44425, - "g": 0.00387, - "r": 0.27072 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 2 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "adec97", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 4.233, - "posY": 1.607, - "posZ": -21.577, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 0.81, - "scaleY": 1, - "scaleZ": 0.81 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/Cursetokens.bd0253/Custom_Tile.b92c2b.json b/objects/Cursetokens.bd0253/Custom_Tile.b92c2b.json deleted file mode 100644 index 7a6066bd..00000000 --- a/objects/Cursetokens.bd0253/Custom_Tile.b92c2b.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0.44425, - "g": 0.00387, - "r": 0.27072 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 2 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "b92c2b", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -45.493, - "posY": 1.791, - "posZ": -3.886, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 0.81, - "scaleY": 1, - "scaleZ": 0.81 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/Cursetokens.bd0253/Custom_Tile.f82dd9.json b/objects/Cursetokens.bd0253/Custom_Tile.f82dd9.json deleted file mode 100644 index 62d231c7..00000000 --- a/objects/Cursetokens.bd0253/Custom_Tile.f82dd9.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0.44425, - "g": 0.00387, - "r": 0.27072 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 2 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "f82dd9", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 4.233, - "posY": 1.607, - "posZ": -21.577, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 0.81, - "scaleY": 1, - "scaleZ": 0.81 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index b576cf83..df33a84f 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -167,7 +167,7 @@ function isCardOrDeck(x) return x.tag == 'Card' or x.tag == 'Deck' end -- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the -- chaos bag during search operations to avoid this. function onObjectSearchStart(object, playerColor) - findChaosBag() + chaosbag = findChaosBag() if object == chaosbag then bagSearchers[playerColor] = true end @@ -177,7 +177,7 @@ end -- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the -- chaos bag during search operations to avoid this. function onObjectSearchEnd(object, playerColor) - findChaosBag() + chaosbag = findChaosBag() if object == chaosbag then bagSearchers[playerColor] = nil end @@ -265,7 +265,9 @@ end -- checks scripting zone for chaos bag function findChaosBag() for _, item in ipairs(getObjectFromGUID("83ef06").getObjects()) do - if item.getDescription() == "Chaos Bag" then chaosbag = item end + if item.getDescription() == "Chaos Bag" then + return item + end end end @@ -300,7 +302,7 @@ function drawChaostoken(params) local mat = params[1] local tokenOffset = params[2] local isRightClick = params[3] - findChaosBag() + chaosbag = findChaosBag() -- return token(s) on other playmat first if chaosTokensLastMat ~= nil and chaosTokensLastMat ~= mat and #chaosTokens ~= 0 then @@ -465,7 +467,7 @@ end ---@param key string Name of the scenario ---@param mode string diffculty (e.g. "hard" or "expert") function fillContainer(args) - findChaosBag() + chaosbag = findChaosBag() if chaosbag ~= nil then local data = getDataValue('modeData', args.key) diff --git a/src/playermat/Playmat.ttslua b/src/playermat/Playmat.ttslua index e19e6c26..c9422afa 100644 --- a/src/playermat/Playmat.ttslua +++ b/src/playermat/Playmat.ttslua @@ -1,4 +1,5 @@ local tokenManager = require("core/token/TokenManager") +local isChaosToken = require("util/isChaosToken") -- set true to enable debug logging and show Physics.cast() local DEBUG = false @@ -178,6 +179,10 @@ function makeDiscardHandlerFor(searchPosition, discardPosition) obj.setPositionSmooth(discardPosition, false, true) obj.setRotation({0, -90, 0}) end + -- put chaos tokens back into bag (e.g. Unrelenting) + elseif isChaosToken(obj) then + local chaosBag = Global.call("findChaosBag") + chaosBag.putObject(obj) -- don't touch the table or this playmat itself elseif obj.guid ~= "4ee1f2" and obj ~= self then TRASHCAN.putObject(obj) diff --git a/src/util/TokenRemover.ttslua b/src/util/TokenRemover.ttslua index 269e7af2..fc1401af 100644 --- a/src/util/TokenRemover.ttslua +++ b/src/util/TokenRemover.ttslua @@ -1,25 +1,5 @@ local zone = nil -local CHAOS_TOKEN_NAMES = { - ["Elder Sign"] = true, - ["+1"] = true, - ["0"] = true, - ["-1"] = true, - ["-2"] = true, - ["-3"] = true, - ["-4"] = true, - ["-5"] = true, - ["-6"] = true, - ["-7"] = true, - ["-8"] = true, - ["Skull"] = true, - ["Cultist"] = true, - ["Tablet"] = true, - ["Elder Thing"] = true, - ["Auto-fail"] = true, - ["Bless"] = true, - ["Curse"] = true, - ["Frost"] = true -} +local isChaosToken = require("util/isChaosToken") -- general code function onSave() @@ -36,14 +16,12 @@ end -- context menu functions function enable() local scale = self.getScale() - zone = spawnObject({ type = "ScriptingTrigger", position = self.getPosition() + Vector(0, 2.5 + 0.11, 0), rotation = self.getRotation(), scale = { scale.x * 2, 5, scale.z * 2 } }) - setMenu(false) end @@ -65,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 CHAOS_TOKEN_NAMES[object.getName()] then return end + if isChaosToken(object) then return end object.destruct() end diff --git a/src/util/isChaosToken.ttslua b/src/util/isChaosToken.ttslua new file mode 100644 index 00000000..d85c1f23 --- /dev/null +++ b/src/util/isChaosToken.ttslua @@ -0,0 +1,31 @@ +do + local CHAOS_TOKEN_NAMES = { + ["Elder Sign"] = true, + ["+1"] = true, + ["0"] = true, + ["-1"] = true, + ["-2"] = true, + ["-3"] = true, + ["-4"] = true, + ["-5"] = true, + ["-6"] = true, + ["-7"] = true, + ["-8"] = true, + ["Skull"] = true, + ["Cultist"] = true, + ["Tablet"] = true, + ["Elder Thing"] = true, + ["Auto-fail"] = true, + ["Bless"] = true, + ["Curse"] = true, + ["Frost"] = true + } + + return function(obj) + if CHAOS_TOKEN_NAMES[obj.getName()] then + return true + else + return false + end + end +end From db52e65609b34e21f10105c87aa10f47c852094d Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Fri, 6 Jan 2023 10:25:38 +0100 Subject: [PATCH 2/2] generalized utility file --- .../isChaosToken.ttslua => core/token/TokenChecker.ttslua} | 7 ++++++- src/playermat/Playmat.ttslua | 4 ++-- src/util/TokenRemover.ttslua | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) rename src/{util/isChaosToken.ttslua => core/token/TokenChecker.ttslua} (77%) 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