-- name: Hand State Menu -- description: Change the state of the hands in the mods menu, enjoy! local handStates = { { name = "Mario 64 Normal", value = -1 }, { name = "Fist", value = 0 }, { name = "Open", value = 1 }, { name = "Peace", value = 2 }, { name = "Cap", value = 3 }, { name = "Wing cap", value = 4 }, { name = "Right Open", value = 5 }, } local checkboxIDs = {} local selectedHand = 1 -- SELECT HAND local function select_hand(handIndex, value) -- Prevent the selected option from being unchecked if not value then if selectedHand == handIndex then update_mod_menu_element_checkbox( checkboxIDs[handIndex], true ) end return end -- Save selected option selectedHand = handIndex -- Save hand state gPlayerSyncTable[0].handState = handStates[handIndex].value -- Uncheck all other options for i = 1, #checkboxIDs do if i ~= handIndex then update_mod_menu_element_checkbox( checkboxIDs[i], false ) end end -- Menu sound play_sound(SOUND_MENU_CHANGE_SELECT, gGlobalSoundSource) end -- CREATE CHECKBOXES for i, hand in ipairs(handStates) do local handIndex = i checkboxIDs[i] = hook_mod_menu_checkbox( hand.name, i == 1, function(_, value) select_hand(handIndex, value) end ) end -- INITIAL STATE selectedHand = 1 -- -1 = Mario 64 normal gPlayerSyncTable[0].handState = -1 -- APPLY HAND STATE local function mario_update(m) local sync = gPlayerSyncTable[m.playerIndex] -- -1 means Mario 64 normal if sync.handState ~= nil and sync.handState >= 0 then m.marioBodyState.handState = sync.handState end end hook_event(HOOK_MARIO_UPDATE, mario_update)