Update playarea when removing locations with hotkeys
This commit is contained in:
parent
ba8f6c9c3e
commit
cfdc6db897
@ -3,6 +3,7 @@ local guidReferenceApi = require("core/GUIDReferenceApi")
|
|||||||
local mythosAreaApi = require("core/MythosAreaApi")
|
local mythosAreaApi = require("core/MythosAreaApi")
|
||||||
local navigationOverlayApi = require("core/NavigationOverlayApi")
|
local navigationOverlayApi = require("core/NavigationOverlayApi")
|
||||||
local optionPanelApi = require("core/OptionPanelApi")
|
local optionPanelApi = require("core/OptionPanelApi")
|
||||||
|
local playAreaApi = require("core/PlayAreaApi")
|
||||||
local playermatApi = require("playermat/PlayermatApi")
|
local playermatApi = require("playermat/PlayermatApi")
|
||||||
local searchLib = require("util/SearchLib")
|
local searchLib = require("util/SearchLib")
|
||||||
local tokenChecker = require("core/token/TokenChecker")
|
local tokenChecker = require("core/token/TokenChecker")
|
||||||
@ -132,7 +133,8 @@ function discardObject(playerColor, hoveredObject)
|
|||||||
if #selectedObjects > 0 then
|
if #selectedObjects > 0 then
|
||||||
discardGroup(playerColor, selectedObjects)
|
discardGroup(playerColor, selectedObjects)
|
||||||
return
|
return
|
||||||
-- only continue if an unlocked card, deck or tile was hovered
|
|
||||||
|
-- only continue if an unlocked card, deck or tile was hovered
|
||||||
elseif hoveredObject == nil
|
elseif hoveredObject == nil
|
||||||
or (hoveredObject.type ~= "Card" and hoveredObject.type ~= "Deck" and hoveredObject.type ~= "Tile")
|
or (hoveredObject.type ~= "Card" and hoveredObject.type ~= "Deck" and hoveredObject.type ~= "Tile")
|
||||||
or hoveredObject.locked then
|
or hoveredObject.locked then
|
||||||
@ -140,7 +142,7 @@ function discardObject(playerColor, hoveredObject)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- These should probably not be discarded normally. Ask player for confirmation.
|
-- these should probably not be discarded normally: ask player for confirmation
|
||||||
local tokenData = mythosAreaApi.returnTokenData()
|
local tokenData = mythosAreaApi.returnTokenData()
|
||||||
local scenarioName = tokenData.currentScenario
|
local scenarioName = tokenData.currentScenario
|
||||||
if scenarioName ~= "Lost in Time and Space" and scenarioName ~= "The Secret Name" then
|
if scenarioName ~= "Lost in Time and Space" and scenarioName ~= "The Secret Name" then
|
||||||
@ -167,6 +169,11 @@ function performDiscard(playerColor, hoveredObject)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- update playarea connections
|
||||||
|
if hoveredObject.type == "Card" then
|
||||||
|
playAreaApi.maybeUntrackLocation(hoveredObject)
|
||||||
|
end
|
||||||
|
|
||||||
local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor)
|
local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor)
|
||||||
playermatApi.discardListOfObjects(discardForMatColor, discardTheseObjects)
|
playermatApi.discardListOfObjects(discardForMatColor, discardTheseObjects)
|
||||||
end
|
end
|
||||||
@ -237,7 +244,10 @@ end
|
|||||||
|
|
||||||
-- moves the hovered card to the victory display
|
-- moves the hovered card to the victory display
|
||||||
function moveCardToVictoryDisplay(_, hoveredObject)
|
function moveCardToVictoryDisplay(_, hoveredObject)
|
||||||
victoryDisplayApi.placeCard(hoveredObject)
|
if hoveredObject then
|
||||||
|
playAreaApi.maybeUntrackLocation(hoveredObject)
|
||||||
|
victoryDisplayApi.placeCard(hoveredObject)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- removes a use from a card (or a token if hovered)
|
-- removes a use from a card (or a token if hovered)
|
||||||
|
@ -70,6 +70,12 @@ do
|
|||||||
getPlayArea().call("tryObjectEnterContainer", { container = container, object = object })
|
getPlayArea().call("tryObjectEnterContainer", { container = container, object = object })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Stop tracking a location for connection drawing / VP calculation
|
||||||
|
---@param card tts__Object Card to (maybe) stop tracking
|
||||||
|
PlayAreaApi.maybeUntrackLocation = function(card)
|
||||||
|
getPlayArea().call("maybeUntrackLocation", card)
|
||||||
|
end
|
||||||
|
|
||||||
-- Counts the VP on locations in the play area
|
-- Counts the VP on locations in the play area
|
||||||
PlayAreaApi.countVP = function()
|
PlayAreaApi.countVP = function()
|
||||||
return getPlayArea().call("countVP")
|
return getPlayArea().call("countVP")
|
||||||
|
Loading…
Reference in New Issue
Block a user