sm64coopdx/mods/char-select-extra-chars/a-utils.lua

53 lines
1.4 KiB
Lua

if not _G.charSelectExists then
local first = false
hook_event(HOOK_ON_LEVEL_INIT, function()
if not first then
first = true
play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource)
djui_chat_message_create("\\#ffffa0\\[CS] Extra Characters requires Character Select to be enabled.\nPlease rehost with it enabled.")
end
end)
return
end
--- @param m MarioState
--- Checks if a player is currently active
function active_player(m)
local np = gNetworkPlayers[m.playerIndex]
if m.playerIndex == 0 then
return true
end
if not np.connected then
return false
end
if np.currCourseNum ~= gNetworkPlayers[0].currCourseNum then
return false
end
if np.currActNum ~= gNetworkPlayers[0].currActNum then
return false
end
if np.currLevelNum ~= gNetworkPlayers[0].currLevelNum then
return false
end
if np.currAreaIndex ~= gNetworkPlayers[0].currAreaIndex then
return false
end
return true
end
animTables = {}
--- @param charNum integer
--- @param animTable table
--- Adds custom animations to a character
function character_add_animations(charNum, animTable)
animTables[charNum] = animTable
end
--- @param charNum integer
--- @return table
--- Gets a character's custom animations
function character_get_animations(charNum)
return animTables[charNum]
end