-- name: \\#00BEFF\\Tiny QoL \\#E7E7E7\\Pack -- description: Adds some QoL features to make the gameplay a bit more enjoyable. \nMade by ExploxionMach -- category: qol local qolFeatures = { coyoteTime = true, starHeal = true, longerMetalVanish = true } local function toggle_coyote_time(index, value) qolFeatures.coyoteTime = value end local function toggle_star_heal(index, value) qolFeatures.starHeal = value end local function toggle_longer_metal_and_vanish(index, value) qolFeatures.longerMetalVanish = value end local lastAction = {} local currentAction = {} function update_action_history(m) local i = m.playerIndex if currentAction[i] == nil then currentAction[i] = m.action lastAction[i] = m.action return end if m.action ~= currentAction[i] then lastAction[i] = currentAction[i] currentAction[i] = m.action end end local coyoteTime = {} local canCoyoteTime = {} local coyoteTimeActs = { [ACT_FREEFALL] = true, [ACT_HOLD_FREEFALL] = true, [ACT_BURNING_FALL] = true, [ACT_BUTT_SLIDE_AIR] = true } local function coyote_time(m) local i = m.playerIndex local last = lastAction[i] if not qolFeatures.coyoteTime then return end if coyoteTime[i] == nil then coyoteTime[i] = 0 end if canCoyoteTime[i] == nil then canCoyoteTime[i] = true end if m.action & ACT_FLAG_AIR == 0 then coyoteTime[i] = 0 canCoyoteTime[i] = true end if coyoteTime[i] > 0 then coyoteTime[i] = coyoteTime[i] - 1 if m.controller.buttonPressed & A_BUTTON ~= 0 then if last == ACT_IDLE or last == ACT_WALKING or last == ACT_BRAKING or last == ACT_DECELERATING or last == ACT_AIR_THROW_LAND then set_mario_action(m, ACT_JUMP, 0) end if last == ACT_HOLD_IDLE or last == ACT_HOLD_WALK or last == ACT_HOLD_JUMP_LAND or last == ACT_HOLD_FREEFALL_LAND then set_mario_action(m, ACT_HOLD_JUMP, 0) end if last == ACT_BURNING_GROUND then set_mario_action(m, ACT_BURNING_JUMP, 0) end if last == ACT_CROUCHING or last == ACT_START_CROUCH then set_mario_action(m, ACT_BACKFLIP, 0) end if last == ACT_TURNING_AROUND or last == ACT_FINISH_TURNING_AROUND then set_mario_action(m, ACT_SIDE_FLIP, 0) end if last == ACT_JUMP_LAND or last == ACT_FREEFALL_LAND or last == ACT_SIDE_FLIP_LAND then set_mario_action(m, ACT_DOUBLE_JUMP, 0) end if last == ACT_DOUBLE_JUMP_LAND then if m.forwardVel > 20 then if (m.flags & MARIO_WING_CAP) ~= 0 then set_mario_action(m, ACT_FLYING_TRIPLE_JUMP, 0) else set_mario_action(m, ACT_TRIPLE_JUMP, 0) end else set_mario_action(m, ACT_JUMP, 0) end end if last == ACT_LONG_JUMP_LAND and m.input & INPUT_Z_DOWN == 0 then set_mario_action(m, ACT_LONG_JUMP, 0) end if last == ACT_CROUCH_SLIDE then if m.forwardVel > 11 then set_mario_action(m, ACT_LONG_JUMP, 0) else set_mario_action(m, ACT_JUMP, 0) end end if last == ACT_BUTT_SLIDE then if m.forwardVel < 0 then set_mario_action(m, ACT_STEEP_JUMP, 0) else set_mario_action(m, ACT_JUMP, 0) end end if last == ACT_DIVE_SLIDE or last == ACT_STOMACH_SLIDE or last == ACT_SLIDE_KICK_SLIDE then if m.forwardVel < 0 then set_mario_action(m, ACT_BACKWARD_ROLLOUT, 0) else set_mario_action(m, ACT_FORWARD_ROLLOUT, 0) end end coyoteTime[i] = 0 end end if canCoyoteTime[i] == true and m.action & ACT_FLAG_AIR ~= 0 then if coyoteTimeActs[m.action] then coyoteTime[i] = 5 end canCoyoteTime[i] = false end end local function star_heal(m, o, interactType) if not qolFeatures.starHeal then return end if interactType == INTERACT_STAR_OR_KEY and m.health ~= 0x000 then m.health = 0x880 end end local hadMetalVanish = {} local function longer_metal_and_vanish(m) local i = m.playerIndex if not qolFeatures.longerMetalVanish then return end if (m.flags & MARIO_METAL_CAP ~= 0 or m.flags & MARIO_VANISH_CAP ~= 0) and not hadMetalVanish[i] then hadMetalVanish[i] = true m.capTimer = m.capTimer + 600 elseif m.flags & MARIO_METAL_CAP == 0 and m.flags & MARIO_VANISH_CAP == 0 then hadMetalVanish[i] = false end end hook_mod_menu_checkbox("Coyote Time", qolFeatures.coyoteTime, toggle_coyote_time) hook_mod_menu_checkbox("Star Heal", qolFeatures.starHeal, toggle_star_heal) hook_mod_menu_checkbox("Longer Metal/Vanish Cap", qolFeatures.longerMetalVanish, toggle_longer_metal_and_vanish) hook_event(HOOK_MARIO_UPDATE, coyote_time) hook_event(HOOK_ON_INTERACT, star_heal) hook_event(HOOK_MARIO_UPDATE, longer_metal_and_vanish) hook_event(HOOK_MARIO_UPDATE, update_action_history)