commit
608ff4ec4f
@ -5,6 +5,8 @@
|
||||
-- - 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
|
||||
|
||||
@ -207,10 +209,10 @@ function resetCounters()
|
||||
end
|
||||
|
||||
-- reset doom on agenda
|
||||
local doomcounter = getObjectFromGUID("85c4c6")
|
||||
if doomcounter ~= nil then
|
||||
doomcounter.call("setToZero")
|
||||
end
|
||||
-- local doomcounter = getObjectFromGUID("85c4c6")
|
||||
-- if doomcounter ~= nil then
|
||||
-- doomcounter.call("setToZero")
|
||||
-- end
|
||||
|
||||
for i, guid in ipairs(TRACKER_GUIDS) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
@ -300,10 +302,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
|
||||
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user