Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed action token handling for Clean Up Helper #670

Merged
merged 1 commit into from
May 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions src/accessories/CleanUpHelper.ttslua
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
-- puts everything on playmats and hands into respective trashcans
-- use the IGNORE_TAG to exclude objects from tidying (default: "CleanUpHelper_Ignore")

local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
local chaosBagApi = require("chaosbag/ChaosBagApi")
local guidReferenceApi = require("core/GUIDReferenceApi")
local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi")
local searchLib = require("util/SearchLib")
local soundCubeApi = require("core/SoundCubeApi")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
local chaosBagApi = require("chaosbag/ChaosBagApi")
local guidReferenceApi = require("core/GUIDReferenceApi")
local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi")
local searchLib = require("util/SearchLib")
local soundCubeApi = require("core/SoundCubeApi")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")

-- objects with this tag will be ignored
local IGNORE_TAG = "CleanUpHelper_ignore"
Expand Down Expand Up @@ -133,8 +133,8 @@ end
---------------------------------------------------------

function updateCounters()
playmatApi.updateCounter("All", "ResourceCounter" , 5)
playmatApi.updateCounter("All", "ClickableClueCounter" , 0)
playmatApi.updateCounter("All", "ResourceCounter", 5)
playmatApi.updateCounter("All", "ClickableClueCounter", 0)
playmatApi.resetSkillTracker("All")

for i = 1, 4 do
Expand Down Expand Up @@ -196,7 +196,7 @@ function loadTrauma()
if i < 5 then
RESET_VALUES.Damage[i] = trauma[i]
else
RESET_VALUES.Horror[i-4] = trauma[i]
RESET_VALUES.Horror[i - 4] = trauma[i]
end
end
loadingFailedBefore = false
Expand Down Expand Up @@ -319,7 +319,6 @@ function tidyPlayerMatCoroutine()
and obj.hasTag("chaosBag") == false
and (obj.locked == false or obj.hasTag("Investigator"))
and obj.interactable == true then
coroutine.yield(0)
trash.putObject(obj)

-- action token handling
Expand All @@ -328,18 +327,18 @@ function tidyPlayerMatCoroutine()
if obj.getScale().x < 0.4 then
local pos = playmatApi.transformLocalPosition(Vector(-0.865, 0.1, -0.28), COLORS[i])
obj.setPosition(pos)
coroutine.yield(0)
end

-- flip action tokens back to ready
if obj.is_face_down then
obj.flip()
coroutine.yield(0)
local rot = playmatApi.returnRotation(COLORS[i])
obj.setRotation(rot)
end

-- reset action token state
local stateId = obj.getStateId()
if stateId ~= -1 and stateId ~= 6 then
coroutine.yield(0)
obj.setState(6)
end
end
Expand Down
Loading