2022-01-28 07:56:44 +00:00
|
|
|
-- name: Faster Swimming
|
|
|
|
-- description: Everyone swims faster.
|
|
|
|
|
|
|
|
function mario_before_phys_step(m)
|
|
|
|
local hScale = 1.0
|
2022-01-29 23:42:33 +00:00
|
|
|
local vScale = 1.0
|
2022-01-28 07:56:44 +00:00
|
|
|
|
|
|
|
-- faster swimming
|
|
|
|
if (m.action & ACT_FLAG_SWIMMING) ~= 0 then
|
2022-01-29 09:15:59 +00:00
|
|
|
hScale = hScale * 2.0
|
|
|
|
if m.action ~= ACT_WATER_PLUNGE then
|
|
|
|
vScale = vScale * 2.0
|
|
|
|
end
|
2022-01-28 07:56:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
m.vel.x = m.vel.x * hScale
|
2022-01-29 23:42:33 +00:00
|
|
|
m.vel.y = m.vel.y * vScale
|
2022-01-28 07:56:44 +00:00
|
|
|
m.vel.z = m.vel.z * hScale
|
|
|
|
end
|
|
|
|
|
|
|
|
-----------
|
|
|
|
-- hooks --
|
|
|
|
-----------
|
|
|
|
|
|
|
|
hook_event(HOOK_BEFORE_PHYS_STEP, mario_before_phys_step)
|