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