introducing soundcubeapi

This commit is contained in:
Chr1Z93 2023-04-04 00:46:29 +02:00
parent 3879c8ed27
commit 108bdfc281
3 changed files with 21 additions and 14 deletions

View File

@ -6,6 +6,7 @@ Cleans up the table for the next scenario in a campaign:
--]] --]]
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi") local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
local soundCubeApi = require("core/SoundCubeApi")
-- enable this for debugging -- enable this for debugging
local SHOW_RAYS = false local SHOW_RAYS = false
@ -165,7 +166,7 @@ function cleanUp(_, color)
printToAll("Clean up started!", "Orange") printToAll("Clean up started!", "Orange")
printToAll("Resetting counters...", "White") printToAll("Resetting counters...", "White")
triggerSoundCube() soundCubeApi.playSoundByName("Vacuum")
ignoreCustomDataHelper() ignoreCustomDataHelper()
getTrauma() getTrauma()
updateCounters(DAMAGE_HORROR_GUIDS, RESET_VALUES, "Damage / Horror") updateCounters(DAMAGE_HORROR_GUIDS, RESET_VALUES, "Damage / Horror")
@ -185,14 +186,6 @@ end
--------------------------------------------------------- ---------------------------------------------------------
-- modular functions, called by other functions -- modular functions, called by other functions
--------------------------------------------------------- ---------------------------------------------------------
function triggerSoundCube()
local soundCube = getObjectsWithTag("SoundCube")[1]
if soundCube then
soundCube.AssetBundle.playTriggerEffect(0)
end
end
function updateCounters(tableOfGUIDs, tableOfNewValues, info) function updateCounters(tableOfGUIDs, tableOfNewValues, info)
if tonumber(tableOfNewValues) then if tonumber(tableOfNewValues) then
local value = tableOfNewValues local value = tableOfNewValues

View File

@ -34,6 +34,7 @@ local hideTitleSplashWaitFunctionId = nil
local playmatApi = require("playermat/PlaymatApi") local playmatApi = require("playermat/PlaymatApi")
local tokenManager = require("core/token/TokenManager") local tokenManager = require("core/token/TokenManager")
local playAreaAPI = require("core/PlayAreaApi") local playAreaAPI = require("core/PlayAreaApi")
local soundCubeApi = require("core/SoundCubeApi")
--------------------------------------------------------- ---------------------------------------------------------
-- data for tokens -- data for tokens
@ -1021,10 +1022,6 @@ function titleSplash(scenarioName)
hideTitleSplashWaitFunctionId = nil hideTitleSplashWaitFunctionId = nil
end, 4) end, 4)
-- play bell sound from soundCube soundCubeApi.playSoundByName("Deep Bell")
local soundCube = getObjectsWithTag("SoundCube")[1]
if soundCube then
soundCube.AssetBundle.playTriggerEffect(1)
end
end end
end end

View File

@ -0,0 +1,17 @@
do
local SoundCubeApi = {}
-- this table links the name of a trigger effect to its index
local soundIndices = {
["Vacuum"] = 0,
["Deep Bell"] = 1
}
-- plays the by name requested sound
---@param soundName String Name of the sound to play
SoundCubeApi.playSoundByName = function(soundName)
getObjectsWithTag("SoundCube")[1].AssetBundle.playTriggerEffect(soundIndices[soundName])
end
return SoundCubeApi
end