updated clean up helper
This commit is contained in:
parent
7c5017cf1b
commit
101012e6c9
@ -1,7 +1,7 @@
|
|||||||
--[[ Cleans up the table for the next scenario in a campaign:
|
-- Cleans up the table for the next scenario in a campaign:
|
||||||
- sets counters to default values (resources and doom) or trauma values (health and sanity, if not disabled) from campaign log
|
-- sets counters to default values (resources and doom) or trauma values (health and sanity, if not disabled) from campaign log
|
||||||
- puts everything on playmats and hands into respective trashcans
|
-- puts everything on playmats and hands into respective trashcans
|
||||||
- use the IGNORE_TAG to exclude objects from tidying (default: "CleanUpHelper_Ignore")]]
|
-- use the IGNORE_TAG to exclude objects from tidying (default: "CleanUpHelper_Ignore")
|
||||||
|
|
||||||
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
|
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
|
||||||
local chaosBagApi = require("chaosbag/ChaosBagApi")
|
local chaosBagApi = require("chaosbag/ChaosBagApi")
|
||||||
@ -30,7 +30,6 @@ options["removeDrawnLines"] = false
|
|||||||
local buttonParameters = {}
|
local buttonParameters = {}
|
||||||
buttonParameters.function_owner = self
|
buttonParameters.function_owner = self
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
-- option loading and GUI setup
|
-- option loading and GUI setup
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
@ -114,7 +113,7 @@ function cleanUp(_, color)
|
|||||||
ignoreCustomDataHelper()
|
ignoreCustomDataHelper()
|
||||||
getTrauma()
|
getTrauma()
|
||||||
|
|
||||||
-- delay to account for potential state change
|
-- delay to account for potential state change of campaign log
|
||||||
Wait.time(updateCounters, 0.2)
|
Wait.time(updateCounters, 0.2)
|
||||||
|
|
||||||
resetDoomCounter()
|
resetDoomCounter()
|
||||||
@ -279,7 +278,7 @@ function tidyPlayerMatCoroutine()
|
|||||||
-- get respective trash
|
-- get respective trash
|
||||||
local trash = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], "Trash")
|
local trash = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], "Trash")
|
||||||
if trash == nil then
|
if trash == nil then
|
||||||
printToAll("Trashcan for " .. COLORS[i] .. " playmat could not be found!", "Red")
|
printToAll("Trashcan for " .. COLORS[i] .. " playmat could not be found! Skipping this playermat.", "Yellow")
|
||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -301,23 +300,36 @@ function tidyPlayerMatCoroutine()
|
|||||||
coroutine.yield(0)
|
coroutine.yield(0)
|
||||||
trash.putObject(obj)
|
trash.putObject(obj)
|
||||||
|
|
||||||
-- flip action tokens back to ready
|
-- action token handling
|
||||||
elseif obj.getDescription() == "Action Token" and obj.is_face_down then
|
elseif obj.getDescription() == "Action Token" then
|
||||||
obj.flip()
|
-- move the small action token to the proper position
|
||||||
end
|
if obj.getScale().x < 0.4 then
|
||||||
|
local pos = playmatApi.transformLocalPosition(Vector(-0.865, 0.1, -0.28), COLORS[i])
|
||||||
|
obj.setPosition(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- reset "activeInvestigatorId"
|
-- flip action tokens back to ready
|
||||||
if i < 5 then
|
if obj.is_face_down then
|
||||||
local playermat = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], "Playermat")
|
obj.flip()
|
||||||
if playermat then
|
end
|
||||||
playermat.setVar("activeInvestigatorId", "00000")
|
|
||||||
|
-- reset action token state
|
||||||
|
local stateId = obj.getStateId()
|
||||||
|
if stateId ~= -1 and stateId ~= 6 then
|
||||||
|
obj.setState(6)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
::continue::
|
::continue::
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- reset "activeInvestigatorId"
|
||||||
|
local playerMats = guidReferenceApi.getObjectsByType("Playermat")
|
||||||
|
for _, mat in pairs(playerMats) do
|
||||||
|
mat.setVar("activeInvestigatorId", "00000")
|
||||||
|
end
|
||||||
|
|
||||||
-- reset spawned data
|
-- reset spawned data
|
||||||
tokenSpawnTrackerApi.resetAll()
|
tokenSpawnTrackerApi.resetAll()
|
||||||
local datahelper = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DataHelper")
|
local datahelper = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DataHelper")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user