changed approach

This commit is contained in:
Chr1Z93 2023-10-23 16:07:21 +02:00
parent 85f449ce4b
commit a88a774dc0
12 changed files with 214 additions and 257 deletions

View File

@ -107,7 +107,6 @@
"ChaosBagStatTracker.766620", "ChaosBagStatTracker.766620",
"Blesstokens.afa06b", "Blesstokens.afa06b",
"Cursetokens.bd0253", "Cursetokens.bd0253",
"TokenRemover.0a5a29",
"TokenSpawnTool.36b4ee", "TokenSpawnTool.36b4ee",
"OfficialStandaloneChallengeScenarios.0ef5c8", "OfficialStandaloneChallengeScenarios.0ef5c8",
"TarotDeck.77f1e5", "TarotDeck.77f1e5",
@ -174,8 +173,10 @@
"GameData.3dbe47", "GameData.3dbe47",
"SCEDTour.0e5aa8", "SCEDTour.0e5aa8",
"PlayerCards.2d30ee", "PlayerCards.2d30ee",
"TokenRemover.39b175", "TokenDiscardZone.457de3",
"TokenRemover.2ba7a5", "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

@ -1,60 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 0
},
"ImageScalar": 1,
"ImageSecondaryURL": "http://cloud-3.steamusercontent.com/ugc/1767069252728653004/7BD6E4B8763FE70DB6ADB22B62504361D3778309/",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1767069252728651946/04A700179A71859B828E30D2877D802749B8223C/",
"WidthScale": 0
},
"Description": "See Notebook for details.",
"DragSelectable": true,
"GMNotes": "",
"GUID": "0a5a29",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "require(\"util/TokenRemover\")",
"LuaScriptState": "null",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "Token Remover",
"Snap": true,
"Sticky": true,
"Tags": [
"CleanUpHelper_ignore"
],
"Tooltip": true,
"Transform": {
"posX": -58.5,
"posY": 1.481,
"posZ": 0,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 1,
"scaleY": 1,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
}

View File

@ -1,60 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 0
},
"ImageScalar": 1,
"ImageSecondaryURL": "http://cloud-3.steamusercontent.com/ugc/1767069252728653004/7BD6E4B8763FE70DB6ADB22B62504361D3778309/",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1767069252728651946/04A700179A71859B828E30D2877D802749B8223C/",
"WidthScale": 0
},
"Description": "See Notebook for details.",
"DragSelectable": true,
"GMNotes": "",
"GUID": "2ba7a5",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "require(\"util/TokenRemover\")",
"LuaScriptState": "null",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "Token Remover",
"Snap": true,
"Sticky": true,
"Tags": [
"CleanUpHelper_ignore"
],
"Tooltip": true,
"Transform": {
"posX": -45.3,
"posY": 1.481,
"posZ": 29.735,
"rotX": 0,
"rotY": 0,
"rotZ": 0,
"scaleX": 0.8,
"scaleY": 1,
"scaleZ": 0.8
},
"Value": 0,
"XmlUI": ""
}

View File

@ -1,60 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 0
},
"ImageScalar": 1,
"ImageSecondaryURL": "http://cloud-3.steamusercontent.com/ugc/1767069252728653004/7BD6E4B8763FE70DB6ADB22B62504361D3778309/",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1767069252728651946/04A700179A71859B828E30D2877D802749B8223C/",
"WidthScale": 0
},
"Description": "See Notebook for details.",
"DragSelectable": true,
"GMNotes": "",
"GUID": "39b175",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "require(\"util/TokenRemover\")",
"LuaScriptState": "null",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "Token Remover",
"Snap": true,
"Sticky": true,
"Tags": [
"CleanUpHelper_ignore"
],
"Tooltip": true,
"Transform": {
"posX": -45.299,
"posY": 1.481,
"posZ": -30.309,
"rotX": 0,
"rotY": 180,
"rotZ": 0,
"scaleX": 0.8,
"scaleY": 1,
"scaleZ": 0.8
},
"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,28 @@ 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 tokenChecker.isChaosToken(enteringObj) then return end
local match = false
for _, tokenDiscardZone in pairs(guidReferenceApi.getObjectsByType("TokenDiscardZone")) do
if zone == tokenDiscardZone then
match = true
break
end
end
if match == false 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,52 +0,0 @@
local zone = nil
local tokenChecker = require("core/token/TokenChecker")
-- general code
function onSave()
return JSON.encode(zone and zone.getGUID() or nil)
end
function onLoad(savedData)
if savedData ~= "" and savedData ~= nil then
zone = getObjectFromGUID(JSON.decode(savedData))
end
setMenu(zone == nil)
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
function disable()
if zone ~= nil then zone.destruct() end
setMenu(true)
end
-- core functions
function setMenu(isEnabled)
self.clearContextMenu()
if isEnabled then
self.addContextMenuItem("Enable", enable)
else
self.addContextMenuItem("Disable", disable)
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