-- 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 coyoteTimeVars = {} local function get_coyote_time_vars(i) if not coyoteTimeVars[i] then coyoteTimeVars[i] = {frames = 0, start = true, wasFloorSteep = false} end return coyoteTimeVars[i] end 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 c = get_coyote_time_vars(i) if not qolFeatures.coyoteTime then return end if m.action & ACT_FLAG_AIR == 0 then c.frames = 0 c.start = true if mario_floor_is_steep(m) ~= 0 then c.wasFloorSteep = true else c.wasFloorSteep = false end end if c.frames > 0 then c.frames = c.frames - 1 if m.controller.buttonPressed & A_BUTTON ~= 0 then if m.prevAction == ACT_IDLE or m.prevAction == ACT_WALKING or m.prevAction == ACT_BRAKING or m.prevAction == ACT_DECELERATING or m.prevAction == ACT_AIR_THROW_LAND then if c.wasFloorSteep == true then set_mario_action(m, ACT_STEEP_JUMP, 0) else set_mario_action(m, ACT_JUMP, 0) end end if m.prevAction == ACT_HOLD_IDLE or m.prevAction == ACT_HOLD_WALK or m.prevAction == ACT_HOLD_JUMP_LAND or m.prevAction == ACT_HOLD_FREEFALL_LAND then set_mario_action(m, ACT_HOLD_JUMP, 0) end if m.prevAction == ACT_BURNING_GROUND then set_mario_action(m, ACT_BURNING_JUMP, 0) end if m.prevAction == ACT_CROUCHING or m.prevAction == ACT_START_CROUCH then if c.wasFloorSteep == true then set_mario_action(m, ACT_STEEP_JUMP, 0) else set_mario_action(m, ACT_BACKFLIP, 0) end end if m.prevAction == ACT_TURNING_AROUND or m.prevAction == ACT_FINISH_TURNING_AROUND then if c.wasFloorSteep == true then set_mario_action(m, ACT_STEEP_JUMP, 0) else set_mario_action(m, ACT_SIDE_FLIP, 0) end end if m.prevAction == ACT_JUMP_LAND or m.prevAction == ACT_FREEFALL_LAND or m.prevAction == ACT_SIDE_FLIP_LAND then if c.wasFloorSteep == true then set_mario_action(m, ACT_STEEP_JUMP, 0) else set_mario_action(m, ACT_DOUBLE_JUMP, 0) end end if m.prevAction == 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 if c.wasFloorSteep == true then set_mario_action(m, ACT_STEEP_JUMP, 0) else set_mario_action(m, ACT_JUMP, 0) end end end if m.prevAction == ACT_LONG_JUMP_LAND and m.input & INPUT_Z_DOWN == 0 then set_mario_action(m, ACT_LONG_JUMP, 0) end if m.prevAction == 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 m.prevAction == 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 (m.prevAction == ACT_DIVE_SLIDE or m.prevAction == ACT_STOMACH_SLIDE or m.prevAction == ACT_SLIDE_KICK_SLIDE) and c.wasFloorSteep == false 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 c.frames = 0 end end if c.start == true and m.action & ACT_FLAG_AIR ~= 0 then if coyoteTimeActs[m.action] then c.frames = 5 end c.start = 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.healCounter = 28 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 * 3 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)