Merge branch 'main' into optionpanel-2
This commit is contained in:
commit
c9afcdb5cc
@ -5,6 +5,7 @@
|
||||
-- - puts everything on playmats and hands into respective trashcans
|
||||
-- - use the IGNORE_TAG to exclude objects from tidying (default: "CleanUpHelper_Ignore")
|
||||
|
||||
local playAreaApi = require("core/PlayAreaApi")
|
||||
-- enable this for debugging
|
||||
local SHOW_RAYS = false
|
||||
|
||||
@ -209,7 +210,7 @@ function resetCounters()
|
||||
-- reset doom on agenda
|
||||
local doomcounter = getObjectFromGUID("85c4c6")
|
||||
if doomcounter ~= nil then
|
||||
doomcounter.call("setToZero")
|
||||
doomcounter.call("updateVal")
|
||||
end
|
||||
|
||||
for i, guid in ipairs(TRACKER_GUIDS) do
|
||||
@ -300,10 +301,7 @@ function tidyPlaymatCoroutine()
|
||||
end
|
||||
end
|
||||
|
||||
local PLAYMAT = getObjectFromGUID('721ba2')
|
||||
if PLAYMAT then
|
||||
PLAYMAT.setTable("SPAWNED_LOCATION_GUIDS", {})
|
||||
end
|
||||
playAreaApi.resetSpawnedCards()
|
||||
|
||||
printToAll("Tidying playermats and agenda mat...", "White")
|
||||
startLuaCoroutine(self, "tidyPlayerMatCoroutine")
|
||||
|
@ -762,4 +762,3 @@ function removeImages()
|
||||
tile.destruct()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,15 +1,4 @@
|
||||
local excluded = {
|
||||
["b7b45b"] = true,
|
||||
["f182ee"] = true,
|
||||
["721ba2"] = true
|
||||
}
|
||||
|
||||
local OFFSETS = {
|
||||
left = { x = 0.00, y = 0, z = 7.67 },
|
||||
right = { x = 0.00, y = 0, z = -7.67 },
|
||||
up = { x = 6.54, y = 0, z = 0.00 },
|
||||
down = { x = -6.54, y = 0, z = 0.00 }
|
||||
}
|
||||
local playAreaApi = require("core/PlayAreaApi")
|
||||
|
||||
local UI_offset = 1.15
|
||||
|
||||
@ -46,24 +35,10 @@ function onLoad()
|
||||
self.createButton(buttonParamaters)
|
||||
end
|
||||
|
||||
function shift_left(color) shift(color, "left") end
|
||||
function shift_left(color) playAreaApi.shiftContentsLeft(color) end
|
||||
|
||||
function shift_right(color) shift(color, "right") end
|
||||
function shift_right(color) playAreaApi.shiftContentsRight(color) end
|
||||
|
||||
function shift_up(color) shift(color, "up") end
|
||||
function shift_up(color) playAreaApi.shiftContentsUp(color) end
|
||||
|
||||
function shift_down(color) shift(color, "down") end
|
||||
|
||||
function shift(color, direction)
|
||||
local zone = getObjectFromGUID("a2f932")
|
||||
if not zone then
|
||||
broadcastToColor("Scripting zone couldn't be found.", color, "Red")
|
||||
return
|
||||
end
|
||||
|
||||
for _, object in ipairs(zone.getObjects()) do
|
||||
if not (excluded[object.getGUID()] or object.hasTag("displacement_excluded")) then
|
||||
object.translate(OFFSETS[direction])
|
||||
end
|
||||
end
|
||||
end
|
||||
function shift_down(color) playAreaApi.shiftContentsDown(color) end
|
||||
|
@ -1,5 +1,6 @@
|
||||
require("arkhamdb/LoaderUi")
|
||||
require("playercards/PlayerCardSpawner")
|
||||
local playAreaApi = require("core/PlayAreaApi")
|
||||
|
||||
local zones = require("playermat/Zones")
|
||||
|
||||
@ -33,8 +34,6 @@ customizationRowsWithFields["09101"].inputMap[1] = 1
|
||||
customizationRowsWithFields["09101"].inputMap[2] = 2
|
||||
customizationRowsWithFields["09101"].inputMap[3] = 3
|
||||
|
||||
local PLAY_AREA_GUID = "721ba2"
|
||||
|
||||
local RANDOM_WEAKNESS_ID = "01000"
|
||||
local tags = { configuration = "import_configuration_provider" }
|
||||
local Priority = {
|
||||
@ -152,7 +151,7 @@ local function onDeckResult(deck, playerColor, configuration)
|
||||
maybeAddInvestigatorCards(deck, slots)
|
||||
maybeAddCustomizeUpgradeSheets(slots, configuration)
|
||||
maybeAddSummonedServitor(slots)
|
||||
maybeAddOnTheMend(slots)
|
||||
maybeAddOnTheMend(slots, playerColor)
|
||||
extractBondedCards(slots, configuration)
|
||||
checkTaboos(deck.taboo_id, slots, playerColor, configuration)
|
||||
|
||||
@ -258,11 +257,15 @@ end
|
||||
-- the count based on the investigator count
|
||||
---@param slots: The slot list for cards in this deck. Table key is the cardId, value is the number
|
||||
-- of those cards which will be spawned
|
||||
function maybeAddOnTheMend(slots)
|
||||
---@param playerColor: Color name of the player this deck is being loaded for. Used for broadcast if an error occurs
|
||||
function maybeAddOnTheMend(slots, playerColor)
|
||||
if slots["09006"] ~= nil then
|
||||
local playArea = getObjectFromGUID(PLAY_AREA_GUID)
|
||||
if playArea ~= nil then
|
||||
slots["09006"] = playArea.call("getInvestigatorCount")
|
||||
local investigatorCount = playAreaApi.getInvestigatorCount()
|
||||
if investigatorCount ~= nil then
|
||||
slots["09006"] = investigatorCount
|
||||
else
|
||||
debugPrint("Something went wrong with the load, adding 4 copies of On the Mend", Priority.INFO, playerColor)
|
||||
slots["09006"] = 4
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -923,6 +923,31 @@ PLAYER_CARD_TOKEN_OFFSETS = {
|
||||
{ 0, 3, 0.5 },
|
||||
{ -0.7, 3, 0.5 }
|
||||
},
|
||||
[10] = {
|
||||
{ 0.7, 3, -0.9 },
|
||||
{ 0, 3, -0.9 },
|
||||
{ -0.7, 3, -0.9 },
|
||||
{ 0.7, 3, -0.2 },
|
||||
{ 0, 3, -0.2 },
|
||||
{ -0.7, 3, -0.2 },
|
||||
{ 0.7, 3, 0.5 },
|
||||
{ 0, 3, 0.5 },
|
||||
{ -0.7, 3, 0.5 },
|
||||
{ 0, 3, 1.2 }
|
||||
},
|
||||
[11] = {
|
||||
{ 0.7, 3, -0.9 },
|
||||
{ 0, 3, -0.9 },
|
||||
{ -0.7, 3, -0.9 },
|
||||
{ 0.7, 3, -0.2 },
|
||||
{ 0, 3, -0.2 },
|
||||
{ -0.7, 3, -0.2 },
|
||||
{ 0.7, 3, 0.5 },
|
||||
{ 0, 3, 0.5 },
|
||||
{ -0.7, 3, 0.5 },
|
||||
{ -0.35, 3, 1.2 },
|
||||
{ 0.35, 3, 1.2 }
|
||||
},
|
||||
[12] = {
|
||||
{ 0.7, 3, -0.9 },
|
||||
{ 0, 3, -0.9 },
|
||||
|
@ -8,7 +8,21 @@ DEBUG = false
|
||||
-- we use this to turn off collision handling until onLoad() is complete
|
||||
COLLISION_ENABLED = false
|
||||
|
||||
local SHIFT_OFFSETS = {
|
||||
left = { x = 0.00, y = 0, z = 7.67 },
|
||||
right = { x = 0.00, y = 0, z = -7.67 },
|
||||
up = { x = 6.54, y = 0, z = 0.00 },
|
||||
down = { x = -6.54, y = 0, z = 0.00 }
|
||||
}
|
||||
local SHIFT_EXCLUSION = {
|
||||
["b7b45b"] = true,
|
||||
["f182ee"] = true,
|
||||
["721ba2"] = true
|
||||
}
|
||||
|
||||
local INVESTIGATOR_COUNTER_GUID = "f182ee"
|
||||
local PLAY_AREA_ZONE_GUID = "a2f932"
|
||||
|
||||
local clueData = {}
|
||||
spawnedLocationGUIDs = {}
|
||||
|
||||
@ -122,7 +136,49 @@ function onCollisionEnter(collision_info)
|
||||
end
|
||||
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 Color of the player requesting the shift. Used solely to send an error
|
||||
--- message in the unlikely case that the scripting zone has been deleted
|
||||
function shiftContentsUp(playerColor)
|
||||
shiftContents(playerColor, "up")
|
||||
end
|
||||
|
||||
function shiftContentsDown(playerColor)
|
||||
shiftContents(playerColor, "down")
|
||||
end
|
||||
|
||||
function shiftContentsLeft(playerColor)
|
||||
shiftContents(playerColor, "left")
|
||||
end
|
||||
|
||||
function shiftContentsRight(playerColor)
|
||||
shiftContents(playerColor, "right")
|
||||
end
|
||||
|
||||
function shiftContents(playerColor, direction)
|
||||
local zone = getObjectFromGUID(PLAY_AREA_ZONE_GUID)
|
||||
if not zone then
|
||||
broadcastToColor("Scripting zone couldn't be found.", playerColor, "Red")
|
||||
return
|
||||
end
|
||||
|
||||
for _, object in ipairs(zone.getObjects()) do
|
||||
if not (SHIFT_EXCLUSION[object.getGUID()] or object.hasTag("displacement_excluded")) then
|
||||
object.translate(SHIFT_OFFSETS[direction])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Returns the current value of the investigator counter from the playmat
|
||||
---@return Integer. Number of investigators currently set on the counter
|
||||
function getInvestigatorCount()
|
||||
local investigatorCounter = getObjectFromGUID('f182ee')
|
||||
local investigatorCounter = getObjectFromGUID("f182ee")
|
||||
return investigatorCounter.getVar("val")
|
||||
end
|
||||
|
||||
-- Reset the play area's tracking of which cards have had tokens spawned.
|
||||
function resetSpawnedCards()
|
||||
spawnedLocationGUIDs = {}
|
||||
end
|
||||
|
39
src/core/PlayAreaApi.ttslua
Normal file
39
src/core/PlayAreaApi.ttslua
Normal file
@ -0,0 +1,39 @@
|
||||
do
|
||||
local PlayAreaApi = { }
|
||||
|
||||
local PLAY_AREA_GUID = "721ba2"
|
||||
|
||||
-- Returns the current value of the investigator counter from the playmat
|
||||
---@return Integer. Number of investigators currently set on the counter
|
||||
PlayAreaApi.getInvestigatorCount = function()
|
||||
return getObjectFromGUID(PLAY_AREA_GUID).call("getInvestigatorCount")
|
||||
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 Color of the player requesting the shift. Used solely to send an error
|
||||
--- message in the unlikely case that the scripting zone has been deleted
|
||||
PlayAreaApi.shiftContentsUp = function(playerColor)
|
||||
return getObjectFromGUID(PLAY_AREA_GUID).call("shiftContentsUp", playerColor)
|
||||
end
|
||||
|
||||
PlayAreaApi.shiftContentsDown = function(playerColor)
|
||||
return getObjectFromGUID(PLAY_AREA_GUID).call("shiftContentsDown", playerColor)
|
||||
end
|
||||
|
||||
PlayAreaApi.shiftContentsLeft = function(playerColor)
|
||||
return getObjectFromGUID(PLAY_AREA_GUID).call("shiftContentsLeft", playerColor)
|
||||
end
|
||||
|
||||
PlayAreaApi.shiftContentsRight = function(playerColor)
|
||||
return getObjectFromGUID(PLAY_AREA_GUID).call("shiftContentsRight", playerColor)
|
||||
end
|
||||
|
||||
-- Reset the play area's tracking of which cards have had tokens spawned.
|
||||
PlayAreaApi.resetSpawnedCards = function()
|
||||
return getObjectFromGUID(PLAY_AREA_GUID).call("resetSpawnedCards")
|
||||
end
|
||||
|
||||
return PlayAreaApi
|
||||
end
|
@ -45,14 +45,14 @@ local RESOURCE_COUNTER
|
||||
|
||||
-- global variable so it can be reset by the Clean Up Helper
|
||||
activeInvestigatorId = "00000"
|
||||
local drawButton = false
|
||||
local isDrawButtonVisible = false
|
||||
|
||||
function onSave()
|
||||
return JSON.encode({
|
||||
zoneID = zoneID,
|
||||
playerColor = PLAYER_COLOR,
|
||||
activeInvestigatorId = activeInvestigatorId,
|
||||
drawButton = drawButton
|
||||
isDrawButtonVisible = isDrawButtonVisible
|
||||
})
|
||||
end
|
||||
|
||||
@ -104,10 +104,10 @@ function onLoad(save_state)
|
||||
zoneID = state.zoneID
|
||||
PLAYER_COLOR = state.playerColor
|
||||
activeInvestigatorId = state.activeInvestigatorId
|
||||
drawButton = state.drawButton
|
||||
isDrawButtonVisible = state.isDrawButtonVisible
|
||||
end
|
||||
|
||||
showDrawButton(drawButton)
|
||||
showDrawButton(isDrawButtonVisible)
|
||||
|
||||
if getObjectFromGUID(zoneID) == nil then spawnDeckZone() end
|
||||
COLLISION_ENABLED = true
|
||||
@ -662,10 +662,10 @@ end
|
||||
-- Sets this playermat's draw 1 button to visible
|
||||
---@param visible Boolean. Whether the draw 1 button should be visible
|
||||
function showDrawButton(visible)
|
||||
drawButton = visible
|
||||
isDrawButtonVisible = visible
|
||||
|
||||
-- create the "Draw 1" button
|
||||
if drawButton then
|
||||
if isDrawButtonVisible then
|
||||
self.createButton({
|
||||
label = "Draw 1",
|
||||
click_function = "doDrawOne",
|
||||
|
@ -25,17 +25,17 @@ do
|
||||
|
||||
|
||||
-- Sets the requested playermat's draw 1 button to visible
|
||||
---@param visible Boolean. Whether the draw 1 button should be visible or not
|
||||
---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not
|
||||
---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also
|
||||
-- accepts "All" as a special value which will apply the setting to all four mats.
|
||||
PlaymatApi.showDrawButton = function(visible, matColor)
|
||||
PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)
|
||||
for _, mat in ipairs(internal.getMatForColor(matColor)) do
|
||||
mat.call("showDrawButton", visible)
|
||||
mat.call("showDrawButton", isDrawButtonVisible)
|
||||
end
|
||||
end
|
||||
|
||||
-- Shows or hides the clickable clue counter for the requested playermat
|
||||
---@param visibleButton Boolean. Whether the clickable counter should be present or not
|
||||
---@param showCounter Boolean. Whether the clickable counter should be present or not
|
||||
---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also
|
||||
-- accepts "All" as a special value which will apply the setting to all four mats.
|
||||
PlaymatApi.clickableClues = function(showCounter, matColor)
|
||||
|
Loading…
Reference in New Issue
Block a user