trigger update from clue hotkey
This commit is contained in:
parent
656764e174
commit
e564a1f1fe
@ -1,5 +1,6 @@
|
||||
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
local victoryDisplayApi = require("core/VictoryDisplayApi")
|
||||
|
||||
function onLoad()
|
||||
addHotkey("Add Doom to Agenda", addDoomToAgenda)
|
||||
@ -121,6 +122,8 @@ function takeClueFromLocation(playerColor, hoveredObject)
|
||||
else
|
||||
broadcastToAll(playerName .. " took one clue.", "Green")
|
||||
end
|
||||
|
||||
victoryDisplayApi.update()
|
||||
end
|
||||
|
||||
-- broadcasts the bless/curse status to the calling player
|
||||
|
@ -74,18 +74,12 @@ end
|
||||
|
||||
-- dropping an object on the victory display
|
||||
function onCollisionEnter()
|
||||
-- stop if there is already an update call running
|
||||
if pendingCall then return end
|
||||
pendingCall = true
|
||||
Wait.time(updateCount, 0.2)
|
||||
startUpdate()
|
||||
end
|
||||
|
||||
-- removing an object from the victory display
|
||||
function onCollisionExit()
|
||||
-- stop if there is already an update call running
|
||||
if pendingCall then return end
|
||||
pendingCall = true
|
||||
Wait.time(updateCount, 0.2)
|
||||
startUpdate()
|
||||
end
|
||||
|
||||
-- picking a clue or location up
|
||||
@ -132,11 +126,14 @@ function maybeUpdate(obj, delay, flipped)
|
||||
-- only continue if the obj in in the play area
|
||||
if not playAreaApi.isInPlayArea(obj) then return end
|
||||
|
||||
-- set this flag to limit function calls (will be reset by "updateCount")
|
||||
pendingCall = true
|
||||
startUpdate(delay)
|
||||
end
|
||||
|
||||
-- update the count with delay (or 0 if no delay is provided)
|
||||
-- this is needed to let tokens drop on the card
|
||||
-- starts an update
|
||||
function startUpdate(delay)
|
||||
-- stop if there is already an update call running
|
||||
if pendingCall then return end
|
||||
pendingCall = true
|
||||
delay = tonumber(delay) or 0
|
||||
Wait.time(updateCount, delay + 0.2)
|
||||
end
|
||||
|
12
src/core/VictoryDisplayApi.ttslua
Normal file
12
src/core/VictoryDisplayApi.ttslua
Normal file
@ -0,0 +1,12 @@
|
||||
do
|
||||
local VictoryDisplayApi = {}
|
||||
local VD_GUID = "6ccd6d"
|
||||
|
||||
-- triggers an update of the Victory count
|
||||
---@param delay Number Delay in seconds after which the update call is executed
|
||||
VictoryDisplayApi.update = function(delay)
|
||||
getObjectFromGUID(VD_GUID).call("startUpdate", delay)
|
||||
end
|
||||
|
||||
return VictoryDisplayApi
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user