even more dynamic references
This commit is contained in:
parent
c11ef5daba
commit
84590343a2
@ -36,6 +36,7 @@
|
|||||||
"LuaScript": "require(\"core/DataHelper\")",
|
"LuaScript": "require(\"core/DataHelper\")",
|
||||||
"LuaScriptState": "[]",
|
"LuaScriptState": "[]",
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
|
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"DataHelper\"}",
|
||||||
"Name": "Custom_Tile",
|
"Name": "Custom_Tile",
|
||||||
"Nickname": "Data Helper",
|
"Nickname": "Data Helper",
|
||||||
"Snap": true,
|
"Snap": true,
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
"LuaScriptState": "",
|
"LuaScriptState": "",
|
||||||
"MaterialIndex": -1,
|
"MaterialIndex": -1,
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
|
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"OptionPanelSource\"}",
|
||||||
"MeshIndex": -1,
|
"MeshIndex": -1,
|
||||||
"Name": "Bag",
|
"Name": "Bag",
|
||||||
"Nickname": "OptionPanel Source",
|
"Nickname": "OptionPanel Source",
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
"LuaScript": "",
|
"LuaScript": "",
|
||||||
"LuaScriptState": "",
|
"LuaScriptState": "",
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
|
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"PlayAreaZone\"}",
|
||||||
"Name": "ScriptingTrigger",
|
"Name": "ScriptingTrigger",
|
||||||
"Nickname": "",
|
"Nickname": "",
|
||||||
"Snap": true,
|
"Snap": true,
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
"LuaScriptState": "",
|
"LuaScriptState": "",
|
||||||
"MaterialIndex": -1,
|
"MaterialIndex": -1,
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
|
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"TokenSource\"}",
|
||||||
"MeshIndex": -1,
|
"MeshIndex": -1,
|
||||||
"Name": "Bag",
|
"Name": "Bag",
|
||||||
"Nickname": "Token Source",
|
"Nickname": "Token Source",
|
||||||
|
@ -16,7 +16,7 @@ local IGNORE_GUIDS = {
|
|||||||
"b7b45b", "f182ee", "721ba2",
|
"b7b45b", "f182ee", "721ba2",
|
||||||
-- bless/curse manager
|
-- bless/curse manager
|
||||||
"afa06b", "bd0253", "5933fb",
|
"afa06b", "bd0253", "5933fb",
|
||||||
-- stuff on agenda/act playmat
|
-- stuff on mythos area
|
||||||
"85c4c6", "4a3aa4", "fea079", "b015d8", "11e0cf", "9f334f", "70b9f6", "0a5a29",
|
"85c4c6", "4a3aa4", "fea079", "b015d8", "11e0cf", "9f334f", "70b9f6", "0a5a29",
|
||||||
-- doom/location token bag
|
-- doom/location token bag
|
||||||
"47ffc3", "170f10",
|
"47ffc3", "170f10",
|
||||||
@ -28,7 +28,7 @@ local IGNORE_GUIDS = {
|
|||||||
local IGNORE_TAG = "CleanUpHelper_ignore"
|
local IGNORE_TAG = "CleanUpHelper_ignore"
|
||||||
|
|
||||||
-- colors and order for following tables
|
-- colors and order for following tables
|
||||||
local COLORS = { "White", "Orange", "Green", "Red", "Agenda" }
|
local COLORS = { "White", "Orange", "Green", "Red", "Mythos" }
|
||||||
|
|
||||||
-- counter GUIDS (4x damage and 4x horror)
|
-- counter GUIDS (4x damage and 4x horror)
|
||||||
local DAMAGE_HORROR_GUIDS = {
|
local DAMAGE_HORROR_GUIDS = {
|
||||||
@ -47,7 +47,7 @@ local CLUE_GUIDS = { "d86b7c", "1769ed", "032300", "37be78" }
|
|||||||
local CLUE_CLICKER_GUIDS = { "db85d6", "3f22e5", "891403", "4111de" }
|
local CLUE_CLICKER_GUIDS = { "db85d6", "3f22e5", "891403", "4111de" }
|
||||||
local TRASHCAN_GUIDS = { "147e80", "f7b6c8", "5f896a", "4b8594", "70b9f6" }
|
local TRASHCAN_GUIDS = { "147e80", "f7b6c8", "5f896a", "4b8594", "70b9f6" }
|
||||||
|
|
||||||
-- values for physics.cast (4 entries for player zones, 5th entry for agenda/act deck, 6th for campaign log)
|
-- values for physics.cast (4 entries for player zones, 5th entry for mythos area, 6th for campaign log)
|
||||||
local PHYSICS_POSITION = {
|
local PHYSICS_POSITION = {
|
||||||
{ -54.5, 2, 21 },
|
{ -54.5, 2, 21 },
|
||||||
{ -54.5, 2, -21 },
|
{ -54.5, 2, -21 },
|
||||||
@ -339,12 +339,12 @@ function tidyPlayareaCoroutine()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
printToAll("Tidying playermats and agenda mat...", "White")
|
printToAll("Tidying playermats and mythos area...", "White")
|
||||||
startLuaCoroutine(self, "tidyPlayerMatCoroutine")
|
startLuaCoroutine(self, "tidyPlayerMatCoroutine")
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- clean up for the four playermats and the agenda/act playmat
|
-- clean up for the four playermats and the mythos area
|
||||||
function tidyPlayerMatCoroutine()
|
function tidyPlayerMatCoroutine()
|
||||||
for i = 1, 5 do
|
for i = 1, 5 do
|
||||||
-- only continue for playermat (1-4) if option enabled
|
-- only continue for playermat (1-4) if option enabled
|
||||||
@ -364,8 +364,10 @@ function tidyPlayerMatCoroutine()
|
|||||||
local desc_low = string.lower(obj.getDescription())
|
local desc_low = string.lower(obj.getDescription())
|
||||||
|
|
||||||
-- ignore these elements
|
-- ignore these elements
|
||||||
if not tableContains(IGNORE_GUIDS, obj.getGUID()) and obj.hasTag(IGNORE_TAG) == false and
|
if not tableContains(IGNORE_GUIDS, obj.getGUID())
|
||||||
desc_low ~= "chaos bag" and desc_low ~= "action token" then
|
and obj.hasTag(IGNORE_TAG) == false
|
||||||
|
and desc_low ~= "chaos bag"
|
||||||
|
and desc_low ~= "action token" then
|
||||||
coroutine.yield(0)
|
coroutine.yield(0)
|
||||||
trashcan.putObject(obj)
|
trashcan.putObject(obj)
|
||||||
|
|
||||||
@ -398,7 +400,7 @@ end
|
|||||||
-- helper functions
|
-- helper functions
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
|
|
||||||
-- find objects depending on index (1 to 4 for playermats, 5 for agenda/act playmat, 6 for campaign log)
|
-- find objects depending on index (1 to 4 for playermats, 5 for mythos area, 6 for campaign log)
|
||||||
function findObjects(num)
|
function findObjects(num)
|
||||||
return Physics.cast({
|
return Physics.cast({
|
||||||
direction = { 0, 1, 0 },
|
direction = { 0, 1, 0 },
|
||||||
|
@ -15,9 +15,6 @@ local tokenManager = require("core/token/TokenManager")
|
|||||||
ENCOUNTER_DECK_POS = {-3.93, 1, 5.76}
|
ENCOUNTER_DECK_POS = {-3.93, 1, 5.76}
|
||||||
ENCOUNTER_DECK_DISCARD_POSITION = {-3.85, 1, 10.38}
|
ENCOUNTER_DECK_DISCARD_POSITION = {-3.85, 1, 10.38}
|
||||||
|
|
||||||
-- GUID of data helper
|
|
||||||
DATA_HELPER_GUID = "708279"
|
|
||||||
|
|
||||||
-- GUIDs that will not be interactable (e.g. parts of the table)
|
-- GUIDs that will not be interactable (e.g. parts of the table)
|
||||||
local NOT_INTERACTABLE = {
|
local NOT_INTERACTABLE = {
|
||||||
"6161b4", -- Decoration-Map
|
"6161b4", -- Decoration-Map
|
||||||
@ -32,6 +29,7 @@ local NOT_INTERACTABLE = {
|
|||||||
"975c39", -- vertical border right
|
"975c39", -- vertical border right
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local DATA_HELPER
|
||||||
local chaosTokens = {}
|
local chaosTokens = {}
|
||||||
local chaosTokensLastMat = nil
|
local chaosTokensLastMat = nil
|
||||||
local bagSearchers = {}
|
local bagSearchers = {}
|
||||||
@ -99,14 +97,6 @@ ID_URL_MAP = {
|
|||||||
-- data for chaos token stat tracker
|
-- data for chaos token stat tracker
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
|
|
||||||
local MAT_GUID_TO_COLOR = {
|
|
||||||
["Overall"] = "Overall",
|
|
||||||
["8b081b"] = "White",
|
|
||||||
["bd0ff4"] = "Orange",
|
|
||||||
["383d8b"] = "Green",
|
|
||||||
["0840d5"] = "Red"
|
|
||||||
}
|
|
||||||
|
|
||||||
local tokenDrawingStats = {
|
local tokenDrawingStats = {
|
||||||
["Overall"] = {},
|
["Overall"] = {},
|
||||||
["8b081b"] = {},
|
["8b081b"] = {},
|
||||||
@ -137,6 +127,7 @@ function onLoad(savedData)
|
|||||||
if obj ~= nil then obj.interactable = false end
|
if obj ~= nil then obj.interactable = false end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
DATA_HELPER = getObjectFromMemo({matColor = "Mythos", type = "DataHelper"})
|
||||||
resetChaosTokenStatTracker()
|
resetChaosTokenStatTracker()
|
||||||
getModVersion()
|
getModVersion()
|
||||||
math.randomseed(os.time())
|
math.randomseed(os.time())
|
||||||
@ -191,8 +182,8 @@ end
|
|||||||
-- gets all objects that match the provided matcolor
|
-- gets all objects that match the provided matcolor
|
||||||
---@param matColor String Color of the playermat
|
---@param matColor String Color of the playermat
|
||||||
function getObjectsForMatColor(matColor)
|
function getObjectsForMatColor(matColor)
|
||||||
if matColor == nil then return nil end
|
|
||||||
local objList = {}
|
local objList = {}
|
||||||
|
if matColor == nil then return objList end
|
||||||
for _, obj in ipairs(getObjects()) do
|
for _, obj in ipairs(getObjects()) do
|
||||||
local memo = obj.getMemo()
|
local memo = obj.getMemo()
|
||||||
if memo then
|
if memo then
|
||||||
@ -205,10 +196,11 @@ function getObjectsForMatColor(matColor)
|
|||||||
return objList
|
return objList
|
||||||
end
|
end
|
||||||
|
|
||||||
-- gets all objects that match the provided type
|
-- gets all objects that match the provided type, sorted by owner
|
||||||
---@param type String Object to look for (usually name without spaces)
|
---@param type String Object to look for (usually name without spaces)
|
||||||
function getObjectForType(type)
|
function getObjectsForType(type)
|
||||||
if type == nil then return nil end
|
local objList = {}
|
||||||
|
if type == nil then return objList end
|
||||||
for _, obj in ipairs(getObjects()) do
|
for _, obj in ipairs(getObjects()) do
|
||||||
local memo = obj.getMemo()
|
local memo = obj.getMemo()
|
||||||
if memo then
|
if memo then
|
||||||
@ -349,7 +341,11 @@ function handleStatTrackerClick(_, _, isRightClick)
|
|||||||
playerColor = "White"
|
playerColor = "White"
|
||||||
playerName = "Overall"
|
playerName = "Overall"
|
||||||
else
|
else
|
||||||
playerColor = playmatApi.getPlayerColor(MAT_GUID_TO_COLOR[key])
|
-- get mat color from memo
|
||||||
|
local mat = getObjectFromGUID(key)
|
||||||
|
local decoded = JSON.decode(mat.getMemo())
|
||||||
|
local matColor = decoded.matColor
|
||||||
|
playerColor = playmatApi.getPlayerColor(matColor)
|
||||||
playerName = Player[playerColor].steam_name or playerColor
|
playerName = Player[playerColor].steam_name or playerColor
|
||||||
|
|
||||||
local playerSquidCount = personalStats["Auto-fail"]
|
local playerSquidCount = personalStats["Auto-fail"]
|
||||||
@ -499,7 +495,7 @@ function fillContainer(args)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function getDataValue(storage, key)
|
function getDataValue(storage, key)
|
||||||
local data = getObjectFromGUID(DATA_HELPER_GUID).getTable(storage)
|
local data = DATA_HELPER.getTable(storage)
|
||||||
if data ~= nil then
|
if data ~= nil then
|
||||||
local value = data[key]
|
local value = data[key]
|
||||||
if value ~= nil then
|
if value ~= nil then
|
||||||
@ -996,7 +992,7 @@ end
|
|||||||
---@param rotation Table Desired rotation of the object (defaults to object's rotation)
|
---@param rotation Table Desired rotation of the object (defaults to object's rotation)
|
||||||
---@param color String Matcolor this object is spawned for to set memo
|
---@param color String Matcolor this object is spawned for to set memo
|
||||||
function spawnHelperObject(name, position, rotation, color)
|
function spawnHelperObject(name, position, rotation, color)
|
||||||
local sourceBag = getObjectFromGUID("830bd0")
|
local sourceBag = getObjectFromMemo({matColor = "Mythos", type = "OptionPanelSource"})
|
||||||
|
|
||||||
-- error handling for missing sourceBag
|
-- error handling for missing sourceBag
|
||||||
if not sourceBag then
|
if not sourceBag then
|
||||||
|
@ -20,11 +20,7 @@ local isReshuffling = false
|
|||||||
-- scenario metadata
|
-- scenario metadata
|
||||||
local currentScenario, useFrontData, tokenData
|
local currentScenario, useFrontData, tokenData
|
||||||
|
|
||||||
-- GUID of data helper
|
local TRASHCAN, DATA_HELPER
|
||||||
local DATA_HELPER_GUID = "708279"
|
|
||||||
|
|
||||||
local TRASHCAN
|
|
||||||
local TRASHCAN_GUID = "70b9f6"
|
|
||||||
|
|
||||||
-- we use this to turn off collision handling until onLoad() is complete
|
-- we use this to turn off collision handling until onLoad() is complete
|
||||||
local collisionEnabled = false
|
local collisionEnabled = false
|
||||||
@ -36,7 +32,8 @@ function onLoad(saveState)
|
|||||||
useFrontData = loadedState.useFrontData or true
|
useFrontData = loadedState.useFrontData or true
|
||||||
tokenData = loadedState.tokenData or {}
|
tokenData = loadedState.tokenData or {}
|
||||||
end
|
end
|
||||||
TRASHCAN = getObjectFromGUID(TRASHCAN_GUID)
|
TRASHCAN = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "Trash"})
|
||||||
|
DATA_HELPER = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "DataHelper"})
|
||||||
collisionEnabled = true
|
collisionEnabled = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -153,7 +150,7 @@ function actualEncounterCardDraw(card, params)
|
|||||||
local faceUpRotation = 0
|
local faceUpRotation = 0
|
||||||
if not params.alwaysFaceUp then
|
if not params.alwaysFaceUp then
|
||||||
local metadata = JSON.decode(card.getGMNotes()) or {}
|
local metadata = JSON.decode(card.getGMNotes()) or {}
|
||||||
if metadata.hidden or getObjectFromGUID(DATA_HELPER_GUID).call('checkHiddenCard', card.getName()) then
|
if metadata.hidden or DATA_HELPER.call('checkHiddenCard', card.getName()) then
|
||||||
faceUpRotation = 180
|
faceUpRotation = 180
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
do
|
do
|
||||||
local MythosAreaApi = {}
|
local MythosAreaApi = {}
|
||||||
local MYTHOS_AREA_GUID = "9f334f"
|
|
||||||
|
|
||||||
-- returns the chaos token metadata (if provided through scenario reference card)
|
-- returns the chaos token metadata (if provided through scenario reference card)
|
||||||
MythosAreaApi.returnTokenData = function()
|
MythosAreaApi.returnTokenData = function()
|
||||||
return getObjectFromGUID(MYTHOS_AREA_GUID).call("returnTokenData")
|
local MythosArea = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "MythosArea"})
|
||||||
|
return MythosArea.call("returnTokenData")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- draw an encounter card to the requested position/rotation
|
-- draw an encounter card to the requested position/rotation
|
||||||
MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)
|
MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)
|
||||||
getObjectFromGUID(MYTHOS_AREA_GUID).call("drawEncounterCard", {
|
local MythosArea = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "MythosArea"})
|
||||||
|
MythosArea.call("drawEncounterCard", {
|
||||||
pos = pos,
|
pos = pos,
|
||||||
rotY = rotY,
|
rotY = rotY,
|
||||||
alwaysFaceUp = alwaysFaceUp
|
alwaysFaceUp = alwaysFaceUp
|
||||||
|
@ -44,8 +44,6 @@ local LOC_LINK_EXCLUDE_SCENARIOS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local tokenManager = require("core/token/TokenManager")
|
local tokenManager = require("core/token/TokenManager")
|
||||||
local INVESTIGATOR_COUNTER_GUID = "f182ee"
|
|
||||||
local PLAY_AREA_ZONE_GUID = "a2f932"
|
|
||||||
|
|
||||||
local clueData = {}
|
local clueData = {}
|
||||||
local spawnedLocationGUIDs = {}
|
local spawnedLocationGUIDs = {}
|
||||||
@ -508,7 +506,7 @@ function shiftContentsRight(playerColor)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function shiftContents(playerColor, direction)
|
function shiftContents(playerColor, direction)
|
||||||
local zone = getObjectFromGUID(PLAY_AREA_ZONE_GUID)
|
local zone = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayAreaZone"})
|
||||||
if not zone then
|
if not zone then
|
||||||
broadcastToColor("Scripting zone couldn't be found.", playerColor, "Red")
|
broadcastToColor("Scripting zone couldn't be found.", playerColor, "Red")
|
||||||
return
|
return
|
||||||
|
@ -119,15 +119,10 @@ do
|
|||||||
["supply"] = 7
|
["supply"] = 7
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Source for tokens
|
|
||||||
local TOKEN_SOURCE_GUID = "124381"
|
|
||||||
|
|
||||||
-- Table of data extracted from the token source bag, keyed by the Memo on each token which
|
-- Table of data extracted from the token source bag, keyed by the Memo on each token which
|
||||||
-- should match the token type keys ("resource", "clue", etc)
|
-- should match the token type keys ("resource", "clue", etc)
|
||||||
local tokenTemplates
|
local tokenTemplates
|
||||||
|
|
||||||
local DATA_HELPER_GUID = "708279"
|
|
||||||
|
|
||||||
local playerCardData
|
local playerCardData
|
||||||
local locationData
|
local locationData
|
||||||
|
|
||||||
@ -340,7 +335,7 @@ do
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
tokenTemplates = { }
|
tokenTemplates = { }
|
||||||
local tokenSource = getObjectFromGUID(TOKEN_SOURCE_GUID)
|
local tokenSource = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "TokenSource"})
|
||||||
for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do
|
for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do
|
||||||
local tokenName = tokenTemplate.Memo
|
local tokenName = tokenTemplate.Memo
|
||||||
tokenTemplates[tokenName] = tokenTemplate
|
tokenTemplates[tokenName] = tokenTemplate
|
||||||
@ -352,7 +347,7 @@ do
|
|||||||
if playerCardData ~= nil then
|
if playerCardData ~= nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local dataHelper = getObjectFromGUID(DATA_HELPER_GUID)
|
local dataHelper = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "DataHelper"})
|
||||||
playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')
|
playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')
|
||||||
locationData = dataHelper.getTable('LOCATIONS_DATA')
|
locationData = dataHelper.getTable('LOCATIONS_DATA')
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user