Change token spawning to pull templates from a bag rather than the on-board token pools

Also added a hidden zone (for Black) to cover functional objects at the back of the table.
This commit is contained in:
Buhallin 2022-12-29 12:36:02 -08:00
parent e5c4601835
commit 17512f5946
No known key found for this signature in database
GPG Key ID: DB3C362823852294
10 changed files with 3679 additions and 14 deletions

View File

@ -249,7 +249,9 @@
"Search-A-Card.24051a",
"PhaseTracker.d0c8fa",
"ArkhamSCED240Page1-12102022.1dd55c",
"TokenSpawnTracker.e3ffc9"
"TokenSpawnTracker.e3ffc9",
"TokenSource.124381",
"GameData.3dbe47"
],
"PlayArea": 1,
"PlayerCounts": [

View File

@ -0,0 +1,50 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"a": 0.75,
"b": 0.25,
"g": 0.25,
"r": 0.25
},
"Description": "Objects in this zone support game functionality and should not be touched",
"DragSelectable": true,
"FogColor": "Black",
"FogHidePointers": false,
"FogReverseHiding": false,
"FogSeethrough": true,
"GMNotes": "",
"GUID": "3dbe47",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "FogOfWarTrigger",
"Nickname": "Game Data",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 78,
"posY": 3.79,
"posZ": 13,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 32,
"scaleY": 5.1,
"scaleZ": 3
},
"Value": 0,
"XmlUI": ""
}

View File

@ -0,0 +1,58 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"Bag": {
"Order": 0
},
"ColorDiffuse": {
"b": 0.63589,
"g": 0.16729,
"r": 0.15842
},
"ContainedObjects_order": [
"Custom_Token.00d19a",
"Custom_Tile.a3fb6c",
"Horror.36be72",
"Custom_Token.cd2a02",
"Custom_Tile.a40a48"
],
"ContainedObjects_path": "TokenSource.124381",
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "124381",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "",
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"MeshIndex": -1,
"Name": "Bag",
"Nickname": "Token Source",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 78.46,
"posY": 1.138,
"posZ": -1.001,
"rotX": 0,
"rotY": 0,
"rotZ": 0,
"scaleX": 0.53,
"scaleY": 0.53,
"scaleZ": 0.53
},
"Value": 0,
"XmlUI": ""
}

View File

@ -0,0 +1,57 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomTile": {
"Stackable": true,
"Stretch": true,
"Thickness": 0.1,
"Type": 2
},
"ImageScalar": 1,
"ImageSecondaryURL": "https://i.imgur.com/EoL7yaZ.png",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357164917/1D06F1DC4D6888B6F57124BD2AFE20D0B0DA15A8/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "doom",
"GUID": "a3fb6c",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Snap": false,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -26.665,
"posY": 2.687,
"posZ": -7.238,
"rotX": 9,
"rotY": 90,
"rotZ": 178,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
}

View File

@ -0,0 +1,57 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomTile": {
"Stackable": true,
"Stretch": true,
"Thickness": 0.1,
"Type": 2
},
"ImageScalar": 1,
"ImageSecondaryURL": "https://i.imgur.com/EoL7yaZ.png",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357164917/1D06F1DC4D6888B6F57124BD2AFE20D0B0DA15A8/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "clue",
"GUID": "a40a48",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Snap": false,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -26.764,
"posY": 2.57,
"posZ": -7.529,
"rotX": 358,
"rotY": 270,
"rotZ": 8,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
}

View File

@ -0,0 +1,57 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomToken": {
"MergeDistancePixels": 5,
"Stackable": true,
"StandUp": false,
"Thickness": 0.3
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "resource",
"GUID": "00d19a",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "",
"Snap": false,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -26.965,
"posY": 2.608,
"posZ": -7.37,
"rotX": 5,
"rotY": 270,
"rotZ": 6,
"scaleX": 0.17,
"scaleY": 0.17,
"scaleZ": 0.17
},
"Value": 0,
"XmlUI": ""
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,515 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomToken": {
"MergeDistancePixels": 5,
"Stackable": false,
"StandUp": false,
"Thickness": 0.1
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357163535/6D9E0756503664D65BDB384656AC6D4BD713F5FC/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "horror",
"GUID": "36be72",
"Grid": false,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": false,
"States": {
"2": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomToken": {
"MergeDistancePixels": 5,
"Stackable": false,
"StandUp": false,
"Thickness": 0.1
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357163230/ED46F8BBAEDB4D3C96C654D48C56110D35F3F54F/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "5c2361",
"Grid": false,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": false,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -27.7533741,
"posY": 1.210006,
"posZ": 15.9442654,
"rotX": -0.0000202706469,
"rotY": 270.015259,
"rotZ": 0.0000220759175,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
},
"3": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomToken": {
"MergeDistancePixels": 5,
"Stackable": false,
"StandUp": false,
"Thickness": 0.1
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357162977/E5D453CC14394519E004B4F8703FC425A7AE3D6C/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "3a3415",
"Grid": false,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": false,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -27.7533741,
"posY": 1.210006,
"posZ": 15.9442368,
"rotX": -0.0000104253941,
"rotY": 270.015137,
"rotZ": 0.0000102804506,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
},
"4": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomToken": {
"MergeDistancePixels": 5,
"Stackable": false,
"StandUp": false,
"Thickness": 0.1
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357164483/5E22FEAE253AE65BDE3FA09E4EE7133569F7E194/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "4a91a8",
"Grid": false,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": false,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -27.7533741,
"posY": 1.21000612,
"posZ": 15.9442348,
"rotX": 0.00000189065361,
"rotY": 270.01532,
"rotZ": 0.0000159575811,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
},
"5": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomToken": {
"MergeDistancePixels": 5,
"Stackable": false,
"StandUp": false,
"Thickness": 0.1
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357164251/34DC7172A2B433047DA853796DB52AECE019F99F/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "887aae",
"Grid": false,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": false,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -27.7533741,
"posY": 1.21000612,
"posZ": 15.9442024,
"rotX": -0.00003432232,
"rotY": 270.016,
"rotZ": -0.00000373151761,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
},
"6": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomToken": {
"MergeDistancePixels": 5,
"Stackable": false,
"StandUp": false,
"Thickness": 0.1
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357164030/0A12FD352F28A560EA7E7952D8CA618A5245F1E0/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "baa831",
"Grid": false,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": false,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -27.7533741,
"posY": 1.21000624,
"posZ": 15.94415,
"rotX": -0.0000249414188,
"rotY": 270.0157,
"rotZ": 0.00000292043842,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
},
"7": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomToken": {
"MergeDistancePixels": 5,
"Stackable": false,
"StandUp": false,
"Thickness": 0.1
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357114485/8B2B8A9F61CC2D8C1F10977ABDB4BA2423AD143F/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "da94da",
"Grid": false,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": false,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -27.7533741,
"posY": 1.21000612,
"posZ": 15.944108,
"rotX": -0.0000233948358,
"rotY": 270.015656,
"rotZ": 0.00000218774017,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
},
"8": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomToken": {
"MergeDistancePixels": 5,
"Stackable": false,
"StandUp": false,
"Thickness": 0.1
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357163806/F397C22A8DDB8F22E08E42E6449C3B5D8CFDB313/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "2e1687",
"Grid": false,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": false,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -27.753376,
"posY": 1.210006,
"posZ": 15.9440966,
"rotX": -1.57902083e-8,
"rotY": 270.016541,
"rotZ": -0.0000219759459,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
},
"9": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomToken": {
"MergeDistancePixels": 5,
"Stackable": false,
"StandUp": false,
"Thickness": 0.1
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357110165/AD791E6817304851C0ABD7AE97AA60326AC14538/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "a6f1e0",
"Grid": false,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "Horror",
"Snap": false,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -27.753376,
"posY": 1.21000612,
"posZ": 15.9440622,
"rotX": -0.0000209277514,
"rotY": 270.016724,
"rotZ": 0.00004970206,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
}
},
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -26.765,
"posY": 2.646,
"posZ": -7.393,
"rotX": 357,
"rotY": 270,
"rotZ": 4,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
}

View File

@ -1,4 +1,4 @@
local playAreaApi = require("core/PlayAreaApi")
local playArea = require("core/PlayAreaApi")
local tokenSpawnTracker = require("core/token/TokenSpawnTrackerApi")
local ENCOUNTER_DECK_AREA = {
@ -55,7 +55,7 @@ function resetTokensIfInDeckZone(container, object)
end
function fireScenarioChangedEvent()
playAreaApi.onScenarioChanged(currentScenario)
playArea.onScenarioChanged(currentScenario)
end
-- Simple method to check if the given point is in a specified area. Local use only,

View File

@ -107,6 +107,9 @@ do
}
}
local TOKEN_SOURCE_GUID = "124381"
local tokenTemplates
local SOURCE_BAG_GUIDS = {
damage = "480bda",
horror = "c3ecf4",
@ -234,24 +237,25 @@ do
-- x and z will use the default rotation from the source bag
---@param callback A callback function triggered after the new token is spawned
TokenManager.spawnToken = function(position, tokenType, rotation, callback)
if SOURCE_BAG_GUIDS[tokenType] == nil then
internal.initTokenTemplates()
if tokenTemplates[tokenType] == nil then
error("Unknown token type '" .. tokenType .. "'")
return
end
local sourceBag = getObjectFromGUID(SOURCE_BAG_GUIDS[tokenType])
if sourceBag == nil then
error("No token source for '" .. tokenType .. "'")
return
end
-- All the source bags are infinite, so we just grab the first object
local tokenTemplate = sourceBag.getData().ContainedObjects[1]
local tokenTemplate = tokenTemplates[tokenType]
-- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag
local tokenRotation = rotation or { x = 0, y = 270, z = 0 }
tokenTemplate.Transform.rotY = tokenRotation.y
log("x=" .. tokenTemplate.Transform.rotX .. ",y=" .. tokenTemplate.Transform.rotY .. "z=" .. tokenTemplate.Transform.rotZ)
local rot = Vector(tokenTemplate.Transform.rotX,
tokenTemplate.Transform.rotY,
tokenTemplate.Transform.rotZ)
if rotation ~= nil then
rot.y = rotation.y
else
rot.y = 270
end
return spawnObjectData({
data = tokenTemplate,
position = position,
rotation = rot,
callback_function = callback
})
end
@ -288,6 +292,19 @@ do
return internal.getLocationData(card) ~= nil
end
internal.initTokenTemplates = function()
if tokenTemplates ~= nil then
return
end
tokenTemplates = { }
local tokenSource = getObjectFromGUID(TOKEN_SOURCE_GUID)
for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do
local tokenName = tokenTemplate.GMNotes
tokenTemplate.GMNotes = ""
tokenTemplates[tokenName] = tokenTemplate
end
end
-- Copies the data from the DataHelper. Will only happen once.
internal.initDataHelperData = function()
if playerCardData ~= nil then