sm64coopdx/mods/faster-swimming.lua
bluelightzero 8a395088fd
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
Fix Hyperspeed when taking damage underwater with faster-swimming.lua (#1186)
2026-04-08 22:59:25 -04:00

30 lines
701 B
Lua

-- name: Faster Swimming
-- description: Everyone swims faster.
function mario_before_phys_step(m)
local hScale = 1.0
local vScale = 1.0
-- faster swimming
if (m.action & ACT_FLAG_SWIMMING) ~= 0 then
hScale = hScale * 2.0
if
m.action ~= ACT_WATER_PLUNGE
and m.action ~= ACT_BACKWARD_WATER_KB
and m.action ~= ACT_FORWARD_WATER_KB
and m.action ~= ACT_DROWNING
then
vScale = vScale * 2.0
end
end
m.vel.x = m.vel.x * hScale
m.vel.y = m.vel.y * vScale
m.vel.z = m.vel.z * hScale
end
-----------
-- hooks --
-----------
hook_event(HOOK_BEFORE_PHYS_STEP, mario_before_phys_step)