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
|
2024-02-17 19:48:30 -05:00
|
|
|
---@return number: Number of investigators currently set on the counter
|
2023-01-29 19:31:52 -05:00
|
|
|
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
|
2024-02-17 19:48:30 -05:00
|
|
|
---@param count number Number of investigators to set on the counter
|
2023-08-27 21:09:46 -04:00
|
|
|
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
|
|
|
|
|
2024-02-17 19:48:30 -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'
|
2024-02-17 19:48:30 -05:00
|
|
|
---@param playerColor string Color of the player requesting the shift for messages
|
2023-01-29 19:31:52 -05:00
|
|
|
PlayAreaApi.shiftContentsUp = function(playerColor)
|
2024-02-17 19:48:30 -05:00
|
|
|
getPlayArea().call("shiftContentsUp", playerColor)
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
PlayAreaApi.shiftContentsDown = function(playerColor)
|
2024-02-17 19:48:30 -05:00
|
|
|
getPlayArea().call("shiftContentsDown", playerColor)
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
PlayAreaApi.shiftContentsLeft = function(playerColor)
|
2024-02-17 19:48:30 -05:00
|
|
|
getPlayArea().call("shiftContentsLeft", playerColor)
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
PlayAreaApi.shiftContentsRight = function(playerColor)
|
2024-02-17 19:48:30 -05:00
|
|
|
getPlayArea().call("shiftContentsRight", playerColor)
|
2023-01-29 19:31:52 -05:00
|
|
|
end
|
|
|
|
|
2024-02-17 19:48:30 -05:00
|
|
|
---@param state boolean This controls whether location connections should be drawn
|
2024-02-04 10:51:51 -05:00
|
|
|
PlayAreaApi.setConnectionDrawState = function(state)
|
|
|
|
getPlayArea().call("setConnectionDrawState", state)
|
|
|
|
end
|
|
|
|
|
2024-02-17 19:48:30 -05:00
|
|
|
---@param color string Connection color to be used for location connections
|
2024-02-04 10:51:51 -05:00
|
|
|
PlayAreaApi.setConnectionColor = function(color)
|
|
|
|
getPlayArea().call("setConnectionColor", color)
|
|
|
|
end
|
|
|
|
|
2024-02-17 19:48:30 -05:00
|
|
|
-- Event to be called when the current scenario has changed
|
|
|
|
---@param scenarioName string Name of the new scenario
|
2023-01-29 19:31:52 -05:00
|
|
|
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-17 19:48:30 -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
|
2024-02-17 19:48:30 -05:00
|
|
|
---@param state boolean True if highlighting should be enabled
|
2023-04-22 16:56:01 -04:00
|
|
|
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
|
2024-02-17 19:48:30 -05:00
|
|
|
---@param state boolean True if highlighting should be enabled
|
2023-04-22 16:56:01 -04:00
|
|
|
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.
|
2024-02-17 19:48:30 -05:00
|
|
|
---@param args table Single-value array holding the GUID of the Custom Data Helper making the call
|
2024-01-06 21:32:07 -05:00
|
|
|
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
|
|
|
|
|
2024-02-17 19:48:30 -05:00
|
|
|
---@param owner string Parent object for this search
|
|
|
|
---@param type string Type of object to search for
|
|
|
|
---@return any: Object reference to the matching object
|
2024-01-06 21:32:29 -05:00
|
|
|
GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)
|
|
|
|
return getGuidHandler().call("getObjectByOwnerAndType", { owner = owner, type = type })
|
|
|
|
end
|
|
|
|
|
|
|
|
-- returns all matching objects as a table with references
|
2024-02-17 19:48:30 -05:00
|
|
|
---@param type string Type of object to search for
|
|
|
|
---@return table: List of object references to matching objects
|
2024-01-06 21:32:29 -05:00
|
|
|
GUIDReferenceApi.getObjectsByType = function(type)
|
|
|
|
return getGuidHandler().call("getObjectsByType", type)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- returns all matching objects as a table with references
|
2024-02-17 19:48:30 -05:00
|
|
|
---@param owner string Parent object for this search
|
|
|
|
---@return table: List of object references to matching objects
|
2024-01-06 21:32:29 -05:00
|
|
|
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
|
2024-02-17 19:48:30 -05:00
|
|
|
---@param owner string Parent of the object
|
|
|
|
---@param type string Type of the object
|
|
|
|
---@param guid string GUID of the object
|
2024-02-04 10:51:51 -05:00
|
|
|
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")
|