254 lines
8.7 KiB
Plaintext
254 lines
8.7 KiB
Plaintext
-- 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)
|
|
__bundle_register("__root", function(require, _LOADED, __bundle_register, __bundle_modules)
|
|
require("accessories/DisplacementTool")
|
|
end)
|
|
__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
|
|
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
|
|
|
|
-- Returns the current value of the investigator counter from the playmat
|
|
---@return number: Number of investigators currently set on the counter
|
|
PlayAreaApi.getInvestigatorCount = function()
|
|
return getInvestigatorCounter().getVar("val")
|
|
end
|
|
|
|
-- Updates the current value of the investigator counter from the playmat
|
|
---@param count number Number of investigators to set on the counter
|
|
PlayAreaApi.setInvestigatorCount = function(count)
|
|
getInvestigatorCounter().call("updateVal", count)
|
|
end
|
|
|
|
-- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain
|
|
-- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'
|
|
---@param playerColor string Color of the player requesting the shift for messages
|
|
PlayAreaApi.shiftContentsUp = function(playerColor)
|
|
getPlayArea().call("shiftContentsUp", playerColor)
|
|
end
|
|
|
|
PlayAreaApi.shiftContentsDown = function(playerColor)
|
|
getPlayArea().call("shiftContentsDown", playerColor)
|
|
end
|
|
|
|
PlayAreaApi.shiftContentsLeft = function(playerColor)
|
|
getPlayArea().call("shiftContentsLeft", playerColor)
|
|
end
|
|
|
|
PlayAreaApi.shiftContentsRight = function(playerColor)
|
|
getPlayArea().call("shiftContentsRight", playerColor)
|
|
end
|
|
|
|
---@param state boolean This controls whether location connections should be drawn
|
|
PlayAreaApi.setConnectionDrawState = function(state)
|
|
getPlayArea().call("setConnectionDrawState", state)
|
|
end
|
|
|
|
---@param color string Connection color to be used for location connections
|
|
PlayAreaApi.setConnectionColor = function(color)
|
|
getPlayArea().call("setConnectionColor", color)
|
|
end
|
|
|
|
-- Event to be called when the current scenario has changed
|
|
---@param scenarioName string Name of the new scenario
|
|
PlayAreaApi.onScenarioChanged = function(scenarioName)
|
|
getPlayArea().call("onScenarioChanged", scenarioName)
|
|
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.
|
|
---@param matchCardTypes boolean Whether snap points should only snap for the matching card types
|
|
PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)
|
|
getPlayArea().call("setLimitSnapsByType", matchCardTypes)
|
|
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)
|
|
getPlayArea().call("tryObjectEnterContainer", { container = container, object = object })
|
|
end
|
|
|
|
-- counts the VP on locations in the play area
|
|
PlayAreaApi.countVP = function()
|
|
return getPlayArea().call("countVP")
|
|
end
|
|
|
|
-- highlights all locations in the play area without metadata
|
|
---@param state boolean True if highlighting should be enabled
|
|
PlayAreaApi.highlightMissingData = function(state)
|
|
return getPlayArea().call("highlightMissingData", state)
|
|
end
|
|
|
|
-- highlights all locations in the play area with VP
|
|
---@param state boolean True if highlighting should be enabled
|
|
PlayAreaApi.highlightCountedVP = function(state)
|
|
return getPlayArea().call("countVP", state)
|
|
end
|
|
|
|
-- Checks if an object is in the play area (returns true or false)
|
|
PlayAreaApi.isInPlayArea = function(object)
|
|
return getPlayArea().call("isInPlayArea", object)
|
|
end
|
|
|
|
PlayAreaApi.getSurface = function()
|
|
return getPlayArea().getCustomObject().image
|
|
end
|
|
|
|
PlayAreaApi.updateSurface = function(url)
|
|
return getPlayArea().call("updateSurface", url)
|
|
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)
|
|
getPlayArea().call("updateLocations", args)
|
|
end
|
|
|
|
PlayAreaApi.getCustomDataHelper = function()
|
|
return getPlayArea().getVar("customDataHelper")
|
|
end
|
|
|
|
return PlayAreaApi
|
|
end
|
|
end)
|
|
__bundle_register("core/GUIDReferenceApi", function(require, _LOADED, __bundle_register, __bundle_modules)
|
|
do
|
|
local GUIDReferenceApi = {}
|
|
|
|
local function getGuidHandler()
|
|
return getObjectFromGUID("123456")
|
|
end
|
|
|
|
---@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
|
|
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
|
|
---@return table: List of object references to matching objects
|
|
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
|
|
---@return table: List of object references to matching objects
|
|
GUIDReferenceApi.getObjectsByOwner = function(owner)
|
|
return getGuidHandler().call("getObjectsByOwner", owner)
|
|
end
|
|
|
|
-- 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
|
|
|
|
return GUIDReferenceApi
|
|
end
|
|
end)
|
|
return __bundle_require("__root") |