From 0d2d6eff04c0fd7b3b8a4d24599e96f3ba54c1b0 Mon Sep 17 00:00:00 2001 From: MysterD Date: Fri, 14 Apr 2023 02:00:31 -0700 Subject: [PATCH] Arena - make knockback animations twice as fast --- mods/arena/arena-player.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/mods/arena/arena-player.lua b/mods/arena/arena-player.lua index 42ff344b..d8afe043 100644 --- a/mods/arena/arena-player.lua +++ b/mods/arena/arena-player.lua @@ -28,6 +28,14 @@ for i = 0, (MAX_PLAYERS - 1) do s.rank = 0 end +local sKnockbackActions = { + ACT_SOFT_FORWARD_GROUND_KB, ACT_FORWARD_GROUND_KB, ACT_HARD_FORWARD_GROUND_KB, + ACT_FORWARD_AIR_KB, ACT_FORWARD_AIR_KB, ACT_HARD_FORWARD_AIR_KB, + ACT_FORWARD_WATER_KB, ACT_FORWARD_WATER_KB, ACT_FORWARD_WATER_KB, + ACT_SOFT_BACKWARD_GROUND_KB, ACT_BACKWARD_GROUND_KB, ACT_HARD_BACKWARD_GROUND_KB, + ACT_BACKWARD_AIR_KB, ACT_BACKWARD_AIR_KB, ACT_HARD_BACKWARD_AIR_KB, + ACT_BACKWARD_WATER_KB, ACT_BACKWARD_WATER_KB, ACT_BACKWARD_WATER_KB +} ------------ -- hammer -- ------------ @@ -361,6 +369,27 @@ function mario_update(m) local s = gPlayerSyncTable[m.playerIndex] local np = gNetworkPlayers[m.playerIndex] + -- increase knockback animations + local animInfo = nil + if m.marioObj ~= nil then + animInfo = m.marioObj.header.gfx.animInfo + end + for i, value in ipairs(sKnockbackActions) do + if m.action == value then + local frame = animInfo.animFrame + local loopEnd = frame + if animInfo.curAnim ~= nil then + loopEnd = animInfo.curAnim.loopEnd + end + + if frame < loopEnd - 2 then + frame = frame + 1 + end + + animInfo.animFrame = frame + end + end + -- clear invincibilities m.invincTimer = 0 if m.knockbackTimer > 5 then