sm64coopdx/mods/char-select-extra-chars/z-voices.lua

33 lines
957 B
Lua
Raw Normal View History

2024-09-01 16:44:29 +00:00
-- Character Voices --
-- Don't edit this file, just use the `charSelect.character_add_voice(modelID, voiceTable)` function
if not _G.charSelectExists then return end
local voiceTables = {
[VOICETABLE_TOADETTE] = true,
[VOICETABLE_YOSHI] = true,
[VOICETABLE_PEACH] = true,
[VOICETABLE_DAISY] = true,
[VOICETABLE_BIRDO] = true
}
2024-09-01 16:44:29 +00:00
--- @param m MarioState
local function mario_update(m)
if is_player_active(m) == 0 then return end
local voiceTable = charSelect.character_get_voice(m)
if voiceTables[voiceTable] then
2024-09-01 16:44:29 +00:00
return charSelect.voice.snore(m)
end
end
--- @param m MarioState
--- @param sound CharacterSound
local function character_sound(m, sound)
local voiceTable = charSelect.character_get_voice(m)
if voiceTables[voiceTable] then
2024-09-01 16:44:29 +00:00
return charSelect.voice.sound(m, sound)
end
end
hook_event(HOOK_MARIO_UPDATE, mario_update)
hook_event(HOOK_CHARACTER_SOUND, character_sound)