resolving review comments
This commit is contained in:
parent
838aa5234b
commit
4159dfc43d
@ -1,12 +1,11 @@
|
||||
local blessCurseApi = require("chaosbag/BlessCurseManagerApi")
|
||||
local chaosBagApi = require("chaosbag/ChaosBagApi")
|
||||
local deckImporterApi = require("arkhamdb/DeckImporterApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local optionPanelApi = require("core/OptionPanelApi")
|
||||
local playAreaApi = require("core/PlayAreaApi")
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
|
||||
local campaignTokenData = {
|
||||
Name = "Custom_Model",
|
||||
Transform = {
|
||||
@ -165,7 +164,7 @@ function createCampaignFromToken(importData)
|
||||
Wait.time(function() optionPanelApi.loadSettings(importData["options"]) end, 0.5)
|
||||
|
||||
-- destroy Tour Starter token
|
||||
local tourStarter = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "TourStarter" })
|
||||
local tourStarter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "TourStarter")
|
||||
tourStarter.destruct()
|
||||
|
||||
-- restore PlayArea image
|
||||
|
@ -5,13 +5,12 @@
|
||||
|
||||
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
|
||||
local chaosBagApi = require("chaosbag/ChaosBagApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local playAreaApi = require("core/PlayAreaApi")
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
local soundCubeApi = require("core/SoundCubeApi")
|
||||
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
|
||||
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
|
||||
-- objects with this tag will be ignored
|
||||
local IGNORE_TAG = "CleanUpHelper_ignore"
|
||||
|
||||
@ -146,7 +145,7 @@ end
|
||||
|
||||
-- reset doom on agenda
|
||||
function resetDoomCounter()
|
||||
local doomCounter = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DoomCounter" })
|
||||
local doomCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomCounter")
|
||||
if doomCounter ~= nil then
|
||||
doomCounter.call("updateVal")
|
||||
else
|
||||
@ -231,7 +230,7 @@ end
|
||||
function discardHands()
|
||||
if not options["tidyPlayermats"] then return end
|
||||
for i = 1, 4 do
|
||||
local trash = guidHandler.call("getObjectByOwnerAndType", { owner = COLORS[i], type = "Trash" })
|
||||
local trash = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], "Trash")
|
||||
if trash == nil then return end
|
||||
local hand = Player[playmatApi.getPlayerColor(COLORS[i])].getHandObjects()
|
||||
for j = #hand, 1, -1 do
|
||||
@ -242,8 +241,8 @@ end
|
||||
|
||||
-- clean up for play area
|
||||
function tidyPlayareaCoroutine()
|
||||
local trash = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "Trash" })
|
||||
local playAreaZone = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "PlayAreaZone" })
|
||||
local trash = guidReferenceApi.getObjectByOwnerAndType("Mythos", "Trash")
|
||||
local playAreaZone = guidReferenceApi.getObjectByOwnerAndType("Mythos", "PlayAreaZone")
|
||||
|
||||
if playAreaZone == nil then
|
||||
printToAll("Scripting zone for main play area could not be found!", "Red")
|
||||
@ -273,7 +272,7 @@ function tidyPlayerMatCoroutine()
|
||||
for k = 1, 30 do coroutine.yield(0) end
|
||||
|
||||
-- get respective trash
|
||||
local trash = guidHandler.call("getObjectByOwnerAndType", { owner = COLORS[i], type = "Trash" })
|
||||
local trash = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], "Trash")
|
||||
if trash == nil then
|
||||
printToAll("Trashcan for " .. COLORS[i] .. " playmat could not be found!", "Red")
|
||||
return 1
|
||||
@ -303,7 +302,7 @@ function tidyPlayerMatCoroutine()
|
||||
|
||||
-- reset "activeInvestigatorId"
|
||||
if i < 5 then
|
||||
local playermat = guidHandler.call("getObjectByOwnerAndType", { owner = COLORS[i], type = "Playermat" })
|
||||
local playermat = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], "Playermat")
|
||||
if playermat then
|
||||
playermat.setVar("activeInvestigatorId", "00000")
|
||||
end
|
||||
@ -311,7 +310,7 @@ function tidyPlayerMatCoroutine()
|
||||
end
|
||||
end
|
||||
|
||||
local datahelper = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DataHelper" })
|
||||
local datahelper = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DataHelper")
|
||||
if datahelper then
|
||||
datahelper.setTable("SPAWNED_PLAYER_CARD_GUIDS", {})
|
||||
end
|
||||
|
@ -1,12 +1,12 @@
|
||||
do
|
||||
local TokenArrangerApi = {}
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
-- local function to call the token arranger, if it is on the table
|
||||
---@param functionName String Name of the function to cal
|
||||
---@param argument Variant Parameter to pass
|
||||
local function callIfExistent(functionName, argument)
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
local tokenArranger = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "TokenArranger" })
|
||||
local tokenArranger = guidReferenceApi.getObjectByOwnerAndType("Mythos", "TokenArranger")
|
||||
if tokenArranger ~= nil then
|
||||
tokenArranger.call(functionName, argument)
|
||||
end
|
||||
|
@ -1,10 +1,9 @@
|
||||
do
|
||||
local DeckImporterApi = {}
|
||||
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
local function getDeckImporter()
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DeckImporter" })
|
||||
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "DeckImporter")
|
||||
end
|
||||
|
||||
-- Returns a table with the full state of the UI, including options and deck IDs.
|
||||
|
@ -1,9 +1,9 @@
|
||||
do
|
||||
local BlessCurseManagerApi = {}
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
local function getManager()
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "BlessCurseManager" })
|
||||
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "BlessCurseManager")
|
||||
end
|
||||
|
||||
-- removes all taken tokens and resets the counts
|
||||
|
@ -1,10 +1,11 @@
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
local optionsVisible = false
|
||||
local options = {
|
||||
Agenda = true,
|
||||
Playarea = true,
|
||||
Playermats = true
|
||||
}
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
|
||||
val = 0
|
||||
|
||||
@ -65,9 +66,9 @@ function startReset()
|
||||
if options.Agenda then
|
||||
updateVal(0)
|
||||
end
|
||||
local DoomInPlayCounter = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DoomInPlayCounter" })
|
||||
if DoomInPlayCounter then
|
||||
DoomInPlayCounter.call("removeDoom", options)
|
||||
local doomInPlayCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomInPlayCounter")
|
||||
if doomInPlayCounter then
|
||||
doomInPlayCounter.call("removeDoom", options)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
|
||||
local ZONE, TRASH, loopID
|
||||
local doomURL = "https://i.imgur.com/EoL7yaZ.png"
|
||||
local IGNORE_TAG = "DoomCounter_ignore"
|
||||
@ -31,8 +30,8 @@ function onLoad()
|
||||
color = { 0, 0, 0, 0 }
|
||||
})
|
||||
|
||||
TRASH = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "Trash" })
|
||||
ZONE = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "PlayAreaZone" })
|
||||
TRASH = guidReferenceApi.getObjectByOwnerAndType("Mythos", "Trash")
|
||||
ZONE = guidReferenceApi.getObjectByOwnerAndType("Mythos", "PlayAreaZone")
|
||||
loopID = Wait.time(countDoom, 2, -1)
|
||||
end
|
||||
|
||||
|
28
src/core/GUIDReferenceApi.ttslua
Normal file
28
src/core/GUIDReferenceApi.ttslua
Normal file
@ -0,0 +1,28 @@
|
||||
do
|
||||
local GUIDReferenceApi = {}
|
||||
|
||||
local function getGuidHandler()
|
||||
return getObjectFromGUID("123456")
|
||||
end
|
||||
|
||||
-- returns all matching objects as a table with references
|
||||
---@param owner String Parent object for this search
|
||||
---@param type String Type of object to search for
|
||||
GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)
|
||||
return getGuidHandler().call("getObjectByOwnerAndType", { owner = owner, type = type })
|
||||
end
|
||||
|
||||
-- returns all matching objects as a table with references
|
||||
---@param type String Type of object to search for
|
||||
GUIDReferenceApi.getObjectsByType = function(type)
|
||||
return getGuidHandler().call("getObjectsByType", type)
|
||||
end
|
||||
|
||||
-- returns all matching objects as a table with references
|
||||
---@param owner String Parent object for this search
|
||||
GUIDReferenceApi.getObjectsByOwner = function(owner)
|
||||
return getGuidHandler().call("getObjectsByOwner", owner)
|
||||
end
|
||||
|
||||
return GUIDReferenceApi
|
||||
end
|
@ -71,9 +71,9 @@ local GuidReferences = {
|
||||
}
|
||||
}
|
||||
|
||||
function getObjectByOwnerAndType(param)
|
||||
local owner = param.owner
|
||||
local type = param.type
|
||||
function getObjectByOwnerAndType(params)
|
||||
local owner = params.owner or "Mythos"
|
||||
local type = params.type
|
||||
return getObjectFromGUID(GuidReferences[owner][type])
|
||||
end
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local optionPanelApi = require("core/OptionPanelApi")
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
local victoryDisplayApi = require("core/VictoryDisplayApi")
|
||||
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
|
||||
function onLoad()
|
||||
addHotkey("Add Doom to Agenda", addDoomToAgenda)
|
||||
addHotkey("Bless/Curse Status", showBlessCurseStatus)
|
||||
@ -43,7 +42,7 @@ end
|
||||
|
||||
-- adds 1 doom to the agenda
|
||||
function addDoomToAgenda()
|
||||
local doomCounter = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DoomCounter" })
|
||||
local doomCounter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DoomCounter")
|
||||
doomCounter.call("addVal", 1)
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local mythosAreaApi = require("core/MythosAreaApi")
|
||||
local navigationOverlayApi = require("core/NavigationOverlayApi")
|
||||
local playAreaApi = require("core/PlayAreaApi")
|
||||
@ -135,8 +136,7 @@ function onLoad(savedData)
|
||||
if obj ~= nil then obj.interactable = false end
|
||||
end
|
||||
|
||||
guidHandler = getObjectFromGUID("123456")
|
||||
DATA_HELPER = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DataHelper" })
|
||||
DATA_HELPER = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DataHelper")
|
||||
resetChaosTokenStatTracker()
|
||||
getModVersion()
|
||||
math.randomseed(os.time())
|
||||
|
@ -1,10 +1,9 @@
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local playAreaApi = require("core/PlayAreaApi")
|
||||
local tokenArrangerApi = require("accessories/TokenArrangerApi")
|
||||
local tokenChecker = require("core/token/TokenChecker")
|
||||
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
|
||||
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
|
||||
local ENCOUNTER_DECK_AREA = {
|
||||
upperLeft = { x = 0.9, z = 0.42 },
|
||||
lowerRight = { x = 0.86, z = 0.38 },
|
||||
@ -35,8 +34,8 @@ function onLoad(saveState)
|
||||
useFrontData = loadedState.useFrontData or true
|
||||
tokenData = loadedState.tokenData or {}
|
||||
end
|
||||
TRASH = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "Trash" })
|
||||
DATA_HELPER = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DataHelper" })
|
||||
TRASH = guidReferenceApi.getObjectByOwnerAndType("Mythos", "Trash")
|
||||
DATA_HELPER = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DataHelper")
|
||||
collisionEnabled = true
|
||||
end
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
do
|
||||
local MythosAreaApi = {}
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
local function getMythosArea()
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "MythosArea" })
|
||||
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "MythosArea")
|
||||
end
|
||||
|
||||
-- returns the chaos token metadata (if provided through scenario reference card)
|
||||
|
@ -1,9 +1,9 @@
|
||||
do
|
||||
local NavigationOverlayApi = {}
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
local function getNOHandler()
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "NavigationOverlayHandler" })
|
||||
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "NavigationOverlayHandler")
|
||||
end
|
||||
|
||||
-- Copies the visibility for the Navigation overlay
|
||||
|
@ -44,6 +44,7 @@ local LOC_LINK_EXCLUDE_SCENARIOS = {
|
||||
["The Heart of Madness"] = true
|
||||
}
|
||||
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local tokenManager = require("core/token/TokenManager")
|
||||
|
||||
local clueData = {}
|
||||
@ -513,8 +514,7 @@ function shiftContentsRight(playerColor)
|
||||
end
|
||||
|
||||
function shiftContents(playerColor, direction)
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
local zone = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "PlayAreaZone" })
|
||||
local zone = guidReferenceApi.getObjectByOwnerAndType("Mythos", "PlayAreaZone")
|
||||
if not zone then
|
||||
broadcastToColor("Scripting zone couldn't be found.", playerColor, "Red")
|
||||
return
|
||||
|
@ -1,14 +1,13 @@
|
||||
do
|
||||
local PlayAreaApi = {}
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
local function getPlayArea()
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "PlayArea" })
|
||||
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "PlayArea")
|
||||
end
|
||||
|
||||
local function getInvestigatorCounter()
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "InvestigatorCounter" })
|
||||
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "InvestigatorCounter")
|
||||
end
|
||||
|
||||
-- Returns the current value of the investigator counter from the playmat
|
||||
|
@ -1,5 +1,6 @@
|
||||
do
|
||||
local SoundCubeApi = {}
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
-- this table links the name of a trigger effect to its index
|
||||
local soundIndices = {
|
||||
@ -9,8 +10,7 @@ do
|
||||
}
|
||||
|
||||
local function playTriggerEffect(index)
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
local SoundCube = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "SoundCube" })
|
||||
local SoundCube = guidReferenceApi.getObjectByOwnerAndType("Mythos", "SoundCube")
|
||||
SoundCube.AssetBundle.playTriggerEffect(index)
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
local chaosBagApi = require("chaosbag/ChaosBagApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local playAreaApi = require("core/PlayAreaApi")
|
||||
local tokenChecker = require("core/token/TokenChecker")
|
||||
|
||||
@ -10,8 +11,6 @@ local countedVP = {}
|
||||
local highlightMissing = false
|
||||
local highlightCounted = false
|
||||
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
|
||||
-- button creation when loading the game
|
||||
function onLoad()
|
||||
-- index 0: VP - "Display"
|
||||
@ -250,7 +249,7 @@ end
|
||||
|
||||
-- places the provided card in the first empty spot
|
||||
function placeCard(card)
|
||||
local TRASH = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "Trash" })
|
||||
local trash = guidReferenceApi.getObjectByOwnerAndType("Mythos", "Trash")
|
||||
|
||||
-- check snap point states
|
||||
local snaps = self.getSnapPoints()
|
||||
@ -281,7 +280,7 @@ function placeCard(card)
|
||||
local chaosBag = chaosBagApi.findChaosBag()
|
||||
chaosBag.putObject(obj)
|
||||
elseif obj.memo ~= nil and obj.getLock() == false then
|
||||
TRASH.putObject(obj)
|
||||
trash.putObject(obj)
|
||||
end
|
||||
end
|
||||
|
||||
@ -325,13 +324,3 @@ function checkSnapPointState(pos)
|
||||
origin = pos
|
||||
})
|
||||
end
|
||||
|
||||
-- search a table for a value, return true if found (else returns false)
|
||||
function tableContains(table, value)
|
||||
for _, v in ipairs(table) do
|
||||
if v == value then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
@ -1,9 +1,9 @@
|
||||
do
|
||||
local VictoryDisplayApi = {}
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
local function getVictoryDisplay()
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "VictoryDisplay" })
|
||||
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "VictoryDisplay")
|
||||
end
|
||||
|
||||
-- triggers an update of the Victory count
|
||||
|
@ -1,4 +1,5 @@
|
||||
do
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local optionPanelApi = require("core/OptionPanelApi")
|
||||
local playAreaApi = require("core/PlayAreaApi")
|
||||
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
|
||||
@ -336,8 +337,7 @@ do
|
||||
return
|
||||
end
|
||||
tokenTemplates = {}
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
local tokenSource = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "TokenSource" })
|
||||
local tokenSource = guidReferenceApi.getObjectByOwnerAndType("Mythos", "TokenSource")
|
||||
for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do
|
||||
local tokenName = tokenTemplate.Memo
|
||||
tokenTemplates[tokenName] = tokenTemplate
|
||||
@ -349,8 +349,7 @@ do
|
||||
if playerCardData ~= nil then
|
||||
return
|
||||
end
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
local dataHelper = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "DataHelper" })
|
||||
local dataHelper = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DataHelper")
|
||||
playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')
|
||||
locationData = dataHelper.getTable('LOCATIONS_DATA')
|
||||
end
|
||||
|
@ -53,19 +53,7 @@ end
|
||||
|
||||
-- Listener to reset card token spawns when they enter a hand.
|
||||
function onObjectEnterZone(zone, enterObject)
|
||||
if checkMemo(zone) then
|
||||
if zone.type == "Hand" and enterObject.type == "Card" then
|
||||
resetTokensSpawned(enterObject.getGUID())
|
||||
end
|
||||
end
|
||||
|
||||
-- checks if the object is owned by a playermat
|
||||
function checkMemo(obj)
|
||||
local memo = obj.getMemo()
|
||||
if memo then
|
||||
local decoded = JSON.decode(memo) or {}
|
||||
if decoded.matColor ~= "Mythos" then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
@ -1,9 +1,9 @@
|
||||
do
|
||||
local TokenSpawnTracker = {}
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
local function getSpawnTracker()
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "TokenSpawnTracker" })
|
||||
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "TokenSpawnTracker")
|
||||
end
|
||||
|
||||
TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)
|
||||
|
@ -3,6 +3,7 @@ do
|
||||
require("core/tour/TourCard")
|
||||
local TourManager = {}
|
||||
local internal = {}
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
-- Base IDs for various tour card UI elements. Actual IDs will have _[playerColor] appended
|
||||
local CARD_ID = "tourCard"
|
||||
@ -123,9 +124,9 @@ do
|
||||
delay = delay + 0.5
|
||||
end
|
||||
local lookPos
|
||||
if TOUR_SCRIPT[cardIndex].objReferenceData ~= nil then
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
local lookAtObj = guidHandler.call("getObjectByOwnerAndType", TOUR_SCRIPT[cardIndex].objReferenceData)
|
||||
local objReferenceData = TOUR_SCRIPT[cardIndex].objReferenceData
|
||||
if objReferenceData ~= nil then
|
||||
local lookAtObj = guidReferenceApi.getObjectByOwnerAndType(objReferenceData.owner, objReferenceData.type)
|
||||
lookPos = lookAtObj.getPosition()
|
||||
lookPos.y = TOUR_SCRIPT[cardIndex].distanceFromObj or 0
|
||||
-- Since camera isn't directly above the hook, changing the Y affects the visual position of
|
||||
|
@ -1,9 +1,9 @@
|
||||
do
|
||||
local AllCardsBagApi = {}
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
local function getAllCardsBag()
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
return guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "AllCardsBag" })
|
||||
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "AllCardsBag")
|
||||
end
|
||||
|
||||
-- Returns a specific card from the bag, based on ArkhamDB ID
|
||||
|
@ -26,16 +26,15 @@ end
|
||||
-- Activated once per second, counts items in bowls
|
||||
function countItems()
|
||||
local totalValue = 0
|
||||
local countableItems = findValidItemsInSphere()
|
||||
for _, entry in ipairs(countableItems) do
|
||||
local descValue = tonumber(entry.hit_object.getDescription())
|
||||
local stackMult = math.abs(entry.hit_object.getQuantity())
|
||||
for _, item in ipairs(findValidItemsInSphere()) do
|
||||
local descValue = tonumber(item.getDescription())
|
||||
local stackMult = math.abs(item.getQuantity())
|
||||
-- Use value in description if available
|
||||
if descValue ~= nil then
|
||||
totalValue = totalValue + descValue * stackMult
|
||||
else
|
||||
-- Otherwise use the value in validCountItemList
|
||||
totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult
|
||||
totalValue = totalValue + validCountItemList[item.getName()] * stackMult
|
||||
end
|
||||
end
|
||||
exposedValue = totalValue
|
||||
@ -51,18 +50,15 @@ function findValidItemsInSphere()
|
||||
size = { 2, 2, 2 }
|
||||
})
|
||||
|
||||
retval = {}
|
||||
local validItemList = {}
|
||||
for _, entry in ipairs(items) do
|
||||
--Ignore the bowl
|
||||
if entry.hit_object ~= self then
|
||||
--Ignore if not in validCountItemList
|
||||
local tableEntry = validCountItemList[entry.hit_object.getName()]
|
||||
if tableEntry ~= nil then
|
||||
table.insert(retval, entry)
|
||||
if validCountItemList[entry.hit_object.getName()] ~= nil then
|
||||
table.insert(validItemList, entry.hit_object)
|
||||
end
|
||||
end
|
||||
end
|
||||
return retval
|
||||
return validItemList
|
||||
end
|
||||
|
||||
function removeAllClues(trash)
|
||||
|
@ -1,11 +1,10 @@
|
||||
local chaosBagApi = require("chaosbag/ChaosBagApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local mythosAreaApi = require("core/MythosAreaApi")
|
||||
local navigationOverlayApi = require("core/NavigationOverlayApi")
|
||||
local tokenChecker = require("core/token/TokenChecker")
|
||||
local tokenManager = require("core/token/TokenManager")
|
||||
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
|
||||
-- set true to enable debug logging and show Physics.cast()
|
||||
local DEBUG = false
|
||||
|
||||
@ -105,7 +104,7 @@ function onLoad(saveState)
|
||||
self.interactable = DEBUG
|
||||
|
||||
-- get object references to owned objects
|
||||
ownedObjects = guidHandler.call("getObjectsByOwner", matColor)
|
||||
ownedObjects = guidReferenceApi.getObjectsByOwner(matColor)
|
||||
|
||||
-- button creation
|
||||
for i = 1, 6 do
|
||||
|
@ -1,15 +1,15 @@
|
||||
do
|
||||
local PlaymatApi = {}
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
|
||||
-- Convenience function to look up a mat's object by color, or get all mats.
|
||||
---@param matColor String Color of the playmat - White, Orange, Green, Red or All
|
||||
---@return array Table Single-element if only single playmat is requested
|
||||
local function getMatForColor(matColor)
|
||||
local guidHandler = getObjectFromGUID("123456")
|
||||
if matColor == "All" then
|
||||
return guidHandler.call("getObjectsByType", "Playermat")
|
||||
return guidReferenceApi.getObjectsByType("Playermat")
|
||||
else
|
||||
return { matColor = guidHandler.call("getObjectByOwnerAndType", { owner = matColor, type = "Playermat" }) }
|
||||
return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, "Playermat") }
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user