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

36 lines
1.0 KiB
Lua
Raw Normal View History

2024-07-01 17:45:25 +02:00
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