2023-01-29 19:31:52 -05:00
|
|
|
-- Bundled by luabundle {"version":"1.6.0"}
|
|
|
|
local __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)
|
|
|
|
local loadingPlaceholder = {[{}] = true}
|
|
|
|
|
|
|
|
local register
|
|
|
|
local modules = {}
|
|
|
|
|
|
|
|
local require
|
|
|
|
local loaded = {}
|
|
|
|
|
|
|
|
register = function(name, body)
|
|
|
|
if not modules[name] then
|
|
|
|
modules[name] = body
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
require = function(name)
|
|
|
|
local loadedModule = loaded[name]
|
|
|
|
|
|
|
|
if loadedModule then
|
|
|
|
if loadedModule == loadingPlaceholder then
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if not modules[name] then
|
|
|
|
if not superRequire then
|
|
|
|
local identifier = type(name) == 'string' and '\"' .. name .. '\"' or tostring(name)
|
|
|
|
error('Tried to require ' .. identifier .. ', but no such module has been registered')
|
|
|
|
else
|
|
|
|
return superRequire(name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
loaded[name] = loadingPlaceholder
|
|
|
|
loadedModule = modules[name](require, loaded, register, modules)
|
|
|
|
loaded[name] = loadedModule
|
|
|
|
end
|
|
|
|
|
|
|
|
return loadedModule
|
|
|
|
end
|
|
|
|
|
|
|
|
return require, loaded, register, modules
|
|
|
|
end)(nil)
|
2024-01-06 21:32:07 -05:00
|
|
|
__bundle_register("__root", function(require, _LOADED, __bundle_register, __bundle_modules)
|
|
|
|
require("accessories/DisplacementTool")
|
|
|
|
end)
|
2023-01-29 19:31:52 -05:00
|
|
|
__bundle_register("accessories/DisplacementTool", function(require, _LOADED, __bundle_register, __bundle_modules)
|
|
|
|
local playAreaApi = require("core/PlayAreaApi")
|
|
|
|
|
|
|
|
local UI_offset = 1.15
|
|
|
|
|
|
|
|
local buttonParamaters = {}
|
|
|
|
buttonParamaters.function_owner = self
|
|
|
|
buttonParamaters.label = ""
|
|
|
|
buttonParamaters.height = 500
|
|
|
|
buttonParamaters.width = 500
|
|
|
|
buttonParamaters.color = { 0, 0, 0, 0 }
|
|
|
|
|
|
|
|
function onLoad()
|
|
|
|
-- index 0: left
|
|
|
|
buttonParamaters.click_function = "shift_left"
|
|
|
|
buttonParamaters.tooltip = "Move left"
|
|
|
|
buttonParamaters.position = { -UI_offset, 0, 0 }
|
|
|
|
self.createButton(buttonParamaters)
|
|
|
|
|
|
|
|
-- index 1: right
|
|
|
|
buttonParamaters.click_function = "shift_right"
|
|
|
|
buttonParamaters.tooltip = "Move right"
|
|
|
|
buttonParamaters.position = { UI_offset, 0, 0 }
|
|
|
|
self.createButton(buttonParamaters)
|
|
|
|
|
|
|
|
-- index 2: up
|
|
|
|
buttonParamaters.click_function = "shift_up"
|
|
|
|
buttonParamaters.tooltip = "Move up"
|
|
|
|
buttonParamaters.position = { 0, 0, -UI_offset }
|
|
|
|
self.createButton(buttonParamaters)
|
|
|
|
|
|
|
|
-- index 3: down
|
|
|
|
buttonParamaters.click_function = "shift_down"
|
|
|
|
buttonParamaters.tooltip = "Move down"
|
|
|
|
buttonParamaters.position = { 0, 0, UI_offset }
|
|
|
|
self.createButton(buttonParamaters)
|
|
|
|
end
|
|
|
|
|
|
|
|
function shift_left(color) playAreaApi.shiftContentsLeft(color) end
|
|
|
|
|
|
|
|
function shift_right(color) playAreaApi.shiftContentsRight(color) end
|
|
|
|
|
|
|
|
function shift_up(color) playAreaApi.shiftContentsUp(color) end
|
|
|
|
|
|
|
|
function shift_down(color) playAreaApi.shiftContentsDown(color) end
|
|
|
|
end)
|
|
|
|
__bundle_register("core/PlayAreaApi", function(require, _LOADED, __bundle_register, __bundle_modules)
|
|
|
|
do
|
2024-01-06 21:32:29 -05:00
|
|
|
local PlayAreaApi = {}
|
|
|
|
local guidReferenceApi = require("core/GUIDReferenceApi")
|
|
|
|
|
|
|
|
local function getPlayArea()
|
|
|
|
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "PlayArea")
|
|
|
|
end
|
|
|
|
|
|
|
|
local function getInvestigatorCounter()
|
|
|
|
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "InvestigatorCounter")
|
|
|
|
end
|
2023-08-27 21:09:46 -04:00
|
|
|
|
2023-01-29 19:31:52 -05:00
|
|
|
-- Returns the current value of the investigator counter from the playmat
|
|
|
|
---@return Integer. Number of investigators currently set on the counter
|
|
|
|
PlayAreaApi.getInvestigatorCount = function()
|
2024-01-06 21:32:29 -05:00
|
|
|
return getInvestigatorCounter().getVar("val")
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
2023-08-27 21:09:46 -04:00
|
|
|
-- Updates the current value of the investigator counter from the playmat
|
|
|
|
---@param count Number of investigators to set on the counter
|
|
|
|
PlayAreaApi.setInvestigatorCount = function(count)
|
2024-01-06 21:32:29 -05:00
|
|
|
getInvestigatorCounter().call("updateVal", count)
|
2023-08-27 21:09:46 -04:00
|
|
|
end
|
|
|
|
|
2023-01-29 19:31:52 -05:00
|
|
|
-- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain
|
2024-01-06 21:32:29 -05:00
|
|
|
-- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'
|
|
|
|
---@param playerColor Color Color of the player requesting the shift for messages
|
2023-01-29 19:31:52 -05:00
|
|
|
PlayAreaApi.shiftContentsUp = function(playerColor)
|
2024-01-06 21:32:29 -05:00
|
|
|
return getPlayArea().call("shiftContentsUp", playerColor)
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
PlayAreaApi.shiftContentsDown = function(playerColor)
|
2024-01-06 21:32:29 -05:00
|
|
|
return getPlayArea().call("shiftContentsDown", playerColor)
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
PlayAreaApi.shiftContentsLeft = function(playerColor)
|
2024-01-06 21:32:29 -05:00
|
|
|
return getPlayArea().call("shiftContentsLeft", playerColor)
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
PlayAreaApi.shiftContentsRight = function(playerColor)
|
2024-01-06 21:32:29 -05:00
|
|
|
return getPlayArea().call("shiftContentsRight", playerColor)
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Reset the play area's tracking of which cards have had tokens spawned.
|
|
|
|
PlayAreaApi.resetSpawnedCards = function()
|
2024-01-06 21:32:29 -05:00
|
|
|
return getPlayArea().call("resetSpawnedCards")
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
2024-02-04 10:51:51 -05:00
|
|
|
-- Sets whether location connections should be drawn
|
|
|
|
PlayAreaApi.setConnectionDrawState = function(state)
|
|
|
|
getPlayArea().call("setConnectionDrawState", state)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Sets the connection color
|
|
|
|
PlayAreaApi.setConnectionColor = function(color)
|
|
|
|
getPlayArea().call("setConnectionColor", color)
|
|
|
|
end
|
|
|
|
|
2023-01-29 19:31:52 -05:00
|
|
|
-- Event to be called when the current scenario has changed.
|
|
|
|
---@param scenarioName Name of the new scenario
|
|
|
|
PlayAreaApi.onScenarioChanged = function(scenarioName)
|
2024-01-06 21:32:29 -05:00
|
|
|
getPlayArea().call("onScenarioChanged", scenarioName)
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Sets this playmat's snap points to limit snapping to locations or not.
|
|
|
|
-- If matchTypes is false, snap points will be reset to snap all cards.
|
2024-02-04 10:51:51 -05:00
|
|
|
---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types.
|
2023-01-29 19:31:52 -05:00
|
|
|
PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)
|
2024-01-06 21:32:29 -05:00
|
|
|
getPlayArea().call("setLimitSnapsByType", matchCardTypes)
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged
|
|
|
|
-- cards before they're destroyed by entering the container
|
|
|
|
PlayAreaApi.tryObjectEnterContainer = function(container, object)
|
2024-01-06 21:32:29 -05:00
|
|
|
getPlayArea().call("tryObjectEnterContainer", { container = container, object = object })
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
2023-04-22 16:56:01 -04:00
|
|
|
-- counts the VP on locations in the play area
|
|
|
|
PlayAreaApi.countVP = function()
|
2024-01-06 21:32:29 -05:00
|
|
|
return getPlayArea().call("countVP")
|
2023-04-22 16:56:01 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
-- highlights all locations in the play area without metadata
|
|
|
|
---@param state Boolean True if highlighting should be enabled
|
|
|
|
PlayAreaApi.highlightMissingData = function(state)
|
2024-01-06 21:32:29 -05:00
|
|
|
return getPlayArea().call("highlightMissingData", state)
|
2023-04-22 16:56:01 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
-- highlights all locations in the play area with VP
|
|
|
|
---@param state Boolean True if highlighting should be enabled
|
|
|
|
PlayAreaApi.highlightCountedVP = function(state)
|
2024-01-06 21:32:29 -05:00
|
|
|
return getPlayArea().call("countVP", state)
|
2023-04-22 16:56:01 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Checks if an object is in the play area (returns true or false)
|
|
|
|
PlayAreaApi.isInPlayArea = function(object)
|
2024-01-06 21:32:29 -05:00
|
|
|
return getPlayArea().call("isInPlayArea", object)
|
2023-04-22 16:56:01 -04:00
|
|
|
end
|
|
|
|
|
2023-08-27 21:09:46 -04:00
|
|
|
PlayAreaApi.getSurface = function()
|
2024-01-06 21:32:29 -05:00
|
|
|
return getPlayArea().getCustomObject().image
|
2023-08-27 21:09:46 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
PlayAreaApi.updateSurface = function(url)
|
2024-01-06 21:32:29 -05:00
|
|
|
return getPlayArea().call("updateSurface", url)
|
2024-01-06 21:32:07 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the
|
|
|
|
-- data to the local token manager instance.
|
|
|
|
---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call
|
|
|
|
PlayAreaApi.updateLocations = function(args)
|
2024-01-06 21:32:29 -05:00
|
|
|
getPlayArea().call("updateLocations", args)
|
2024-01-06 21:32:07 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
PlayAreaApi.getCustomDataHelper = function()
|
2024-01-06 21:32:29 -05:00
|
|
|
return getPlayArea().getVar("customDataHelper")
|
2023-08-27 21:09:46 -04:00
|
|
|
end
|
|
|
|
|
2023-01-29 19:31:52 -05:00
|
|
|
return PlayAreaApi
|
|
|
|
end
|
|
|
|
end)
|
2024-01-06 21:32:29 -05:00
|
|
|
__bundle_register("core/GUIDReferenceApi", function(require, _LOADED, __bundle_register, __bundle_modules)
|
|
|
|
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
|
|
|
|
|
2024-02-04 10:51:51 -05:00
|
|
|
-- sends new information to the reference handler to edit the main index
|
|
|
|
---@param owner String Parent of the object
|
|
|
|
---@param type String Type of the object
|
|
|
|
---@param guid String GUID of the object
|
|
|
|
GUIDReferenceApi.editIndex = function(owner, type, guid)
|
|
|
|
return getGuidHandler().call("editIndex", {
|
|
|
|
owner = owner,
|
|
|
|
type = type,
|
|
|
|
guid = guid
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2024-01-06 21:32:29 -05:00
|
|
|
return GUIDReferenceApi
|
|
|
|
end
|
|
|
|
end)
|
2023-01-29 19:31:52 -05:00
|
|
|
return __bundle_require("__root")
|