script update
This commit is contained in:
parent
5bf34b8cdb
commit
e85d5bc05d
@ -175,8 +175,14 @@ function cleanUp(_, color)
|
|||||||
soundCubeApi.playSoundByName("Vacuum")
|
soundCubeApi.playSoundByName("Vacuum")
|
||||||
ignoreCustomDataHelper()
|
ignoreCustomDataHelper()
|
||||||
getTrauma()
|
getTrauma()
|
||||||
updateCounters(RESOURCE_GUIDS, 5, "Resources")
|
|
||||||
updateCounters(CLUE_CLICKER_GUIDS, 0, "Clue clickers")
|
-- delay to account for potential state change
|
||||||
|
Wait.time(function()
|
||||||
|
updateCounters(RESOURCE_GUIDS, 5, "Resource")
|
||||||
|
updateCounters(CLUE_CLICKER_GUIDS, 0, "Clue clicker")
|
||||||
|
updateCounters(DAMAGE_HORROR_GUIDS, RESET_VALUES, "Damage / Horror")
|
||||||
|
end, 0.2)
|
||||||
|
|
||||||
resetSkillTrackers()
|
resetSkillTrackers()
|
||||||
resetDoomCounter()
|
resetDoomCounter()
|
||||||
blessCurseManagerApi.removeAll(color)
|
blessCurseManagerApi.removeAll(color)
|
||||||
@ -193,20 +199,16 @@ end
|
|||||||
-- modular functions, called by other functions
|
-- modular functions, called by other functions
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
|
|
||||||
function updateCounters(tableOfGUIDs, tableOfNewValues, info)
|
function updateCounters(tableOfGUIDs, newValues, info)
|
||||||
if tonumber(tableOfNewValues) then
|
-- instead of a table, this will be used if just a single value is provided
|
||||||
local value = tableOfNewValues
|
local singleValue = tonumber(newValues)
|
||||||
tableOfNewValues = {}
|
|
||||||
for i = 1, #tableOfGUIDs do
|
|
||||||
table.insert(tableOfNewValues, value)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for i, guid in ipairs(tableOfGUIDs) do
|
for i, guid in ipairs(tableOfGUIDs) do
|
||||||
local TOKEN = getObjectFromGUID(guid)
|
local TOKEN = getObjectFromGUID(guid)
|
||||||
|
local newValue = singleValue or newValues[i]
|
||||||
|
|
||||||
if TOKEN ~= nil then
|
if TOKEN ~= nil then
|
||||||
TOKEN.call("updateVal", tableOfNewValues[i])
|
TOKEN.call("updateVal", newValue)
|
||||||
else
|
else
|
||||||
printToAll(info .. ": No. " .. i .. " could not be found.", "Yellow")
|
printToAll(info .. ": No. " .. i .. " could not be found.", "Yellow")
|
||||||
end
|
end
|
||||||
@ -228,10 +230,10 @@ end
|
|||||||
|
|
||||||
-- reset doom on agenda
|
-- reset doom on agenda
|
||||||
function resetDoomCounter()
|
function resetDoomCounter()
|
||||||
local doomcounter = getObjectFromGUID("85c4c6")
|
local doomCounter = getObjectFromGUID("85c4c6")
|
||||||
|
|
||||||
if doomcounter ~= nil then
|
if doomCounter ~= nil then
|
||||||
doomcounter.call("updateVal")
|
doomCounter.call("updateVal")
|
||||||
else
|
else
|
||||||
printToAll("Doom counter could not be found.", "Yellow")
|
printToAll("Doom counter could not be found.", "Yellow")
|
||||||
end
|
end
|
||||||
@ -240,7 +242,9 @@ end
|
|||||||
-- gets the GUID of a custom data helper (if present) and adds it to the ignore list
|
-- gets the GUID of a custom data helper (if present) and adds it to the ignore list
|
||||||
function ignoreCustomDataHelper()
|
function ignoreCustomDataHelper()
|
||||||
local customDataHelper = playAreaApi.getCustomDataHelper()
|
local customDataHelper = playAreaApi.getCustomDataHelper()
|
||||||
if customDataHelper then table.insert(IGNORE_GUIDS, customDataHelper.getGUID()) end
|
if customDataHelper then
|
||||||
|
table.insert(IGNORE_GUIDS, customDataHelper.getGUID())
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- read values for trauma from campaign log if enabled
|
-- read values for trauma from campaign log if enabled
|
||||||
@ -271,25 +275,26 @@ end
|
|||||||
function loadTrauma()
|
function loadTrauma()
|
||||||
-- check if "returnTrauma" function exists to avoid calling nil
|
-- check if "returnTrauma" function exists to avoid calling nil
|
||||||
local trauma = campaignLog.getVar("returnTrauma")
|
local trauma = campaignLog.getVar("returnTrauma")
|
||||||
|
|
||||||
if trauma ~= nil then
|
if trauma ~= nil then
|
||||||
printToAll("Trauma values found in campaign log!", "Green")
|
printToAll("Trauma values found in campaign log!", "Green")
|
||||||
RESET_VALUES = campaignLog.call("returnTrauma")
|
RESET_VALUES = campaignLog.call("returnTrauma")
|
||||||
updateCounters(DAMAGE_HORROR_GUIDS, RESET_VALUES, "Damage / Horror")
|
loadingFailedBefore = false
|
||||||
loadingFailedBefore = false
|
|
||||||
elseif loadingFailedBefore then
|
elseif loadingFailedBefore then
|
||||||
printToAll("Trauma values could not be found in campaign log!", "Yellow")
|
printToAll("Trauma values could not be found in campaign log!", "Yellow")
|
||||||
printToAll("Default values for health and sanity loaded.", "Yellow")
|
printToAll("Default values for health and sanity loaded.", "Yellow")
|
||||||
loadingFailedBefore = false
|
loadingFailedBefore = false
|
||||||
else
|
else
|
||||||
-- set campaign log to first state
|
-- set campaign log to first state
|
||||||
local stateId = campaignLog.getStateId()
|
local stateId = campaignLog.getStateId()
|
||||||
|
|
||||||
if stateId ~= 1 then
|
if stateId ~= 1 then
|
||||||
campaignLog = campaignLog.setState(1)
|
campaignLog = campaignLog.setState(1)
|
||||||
end
|
end
|
||||||
loadingFailedBefore = true
|
loadingFailedBefore = true
|
||||||
|
|
||||||
-- small delay to account for potential state change
|
-- small delay to account for potential state change
|
||||||
local spawnDelay = 0.1
|
Wait.time(loadTrauma, 0.1)
|
||||||
Wait.time(loadTrauma, spawnDelay)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user