From 12ad8d48e5abdf270018f3dde29d4a01f99c5e4e Mon Sep 17 00:00:00 2001 From: Saxashitter Date: Sat, 10 Aug 2024 15:03:16 -0400 Subject: [PATCH] fix parry hitlag lap portal bug --- src/Lua/Gimmicks/pizzaportal.lua | 1 + src/Lua/PlayerScripts/player_parry.lua | 67 ++++++++++++++++++-------- src/Lua/main_game.lua | 2 +- 3 files changed, 48 insertions(+), 22 deletions(-) diff --git a/src/Lua/Gimmicks/pizzaportal.lua b/src/Lua/Gimmicks/pizzaportal.lua index 73cdd1c..15d1fe0 100644 --- a/src/Lua/Gimmicks/pizzaportal.lua +++ b/src/Lua/Gimmicks/pizzaportal.lua @@ -69,6 +69,7 @@ addHook("TouchSpecial", function(special, toucher) if PTSR_DoHook("onlap", toucher) == true then return end + PTSR.StopParryHitlag(tplayer, true) toucher.pizza_in = portal_time PTSR:FillCombo(tplayer) S_StartSound(toucher, sfx_lapin) diff --git a/src/Lua/PlayerScripts/player_parry.lua b/src/Lua/PlayerScripts/player_parry.lua index 8ed417d..c433ba9 100644 --- a/src/Lua/PlayerScripts/player_parry.lua +++ b/src/Lua/PlayerScripts/player_parry.lua @@ -111,6 +111,47 @@ PTSR.DoParry = function(parrier, victim) end end +PTSR.DoParryHitlag = function(player) + -- remove to debug the shit for now + + local data = player.ptsr.parryhitlagdata + + data.x = player.mo.x + data.y = player.mo.y + data.z = player.mo.z + + if data.momx == nil + or data.momy == nil + or data.momz == nil then + data.momx = player.mo.momx + data.momy = player.mo.momy + data.momz = player.mo.momz + end + + data.a = player.drawangle + data.state = player.mo.state + data.frame = player.mo.frame + + player.ptsr.parryhitlag = true + player.ptsr.parryhitlagtime = leveltime +end + +PTSR.StopParryHitlag = function(player, dontapplymom) + local data = player.ptsr.parryhitlagdata + + if not dontapplymom then + player.mo.momx = data.momx + player.mo.momy = data.momy + player.mo.momz = data.momz + end + + data.momx = nil + data.momy = nil + data.momz = nil + + player.ptsr.parryhitlag = false +end + -- Parry Stuff -- helper function so we can get whose pizzaface easily @@ -144,11 +185,7 @@ addHook("PlayerThink", function(player) local ptime = leveltime-player.ptsr.parryhitlagtime if ptime >= PTSR.ParryHitLagFrames then - player.mo.momx = data.momx - player.mo.momy = data.momy - player.mo.momz = data.momz - - player.ptsr.parryhitlag = false + PTSR.StopParryHitlag(player) else P_SetOrigin(player.mo, data.x, @@ -170,7 +207,9 @@ addHook("PlayerThink", function(player) end end - if not player.mo.ptsr.parry_cooldown then + if not player.mo.ptsr.parry_cooldown + and not player.mo.pizza_in + and not player.mo.pizza_out then if cmd.buttons & BT_ATTACK then if not player.mo.pre_parry then -- pre parry start local failparrysfx = { @@ -234,21 +273,7 @@ addHook("PlayerThink", function(player) PTSR.DoParryAnim(player.mo, true, _isPF(foundmobj) and player.rings >= PTSR.ParrySpendRequirement) PTSR.DoParryAnim(foundmobj) - if not player.ptsr.parryhitlag then - local data = player.ptsr.parryhitlagdata - data.x = player.mo.x - data.y = player.mo.y - data.z = player.mo.z - data.momx = player.mo.momx - data.momy = player.mo.momy - data.momz = player.mo.momz - data.a = player.drawangle - data.state = player.mo.state - data.frame = player.mo.frame - end - - player.ptsr.parryhitlag = true - player.ptsr.parryhitlagtime = leveltime + PTSR.DoParryHitlag(player) gotanobject = true end diff --git a/src/Lua/main_game.lua b/src/Lua/main_game.lua index 03f6298..69d705d 100644 --- a/src/Lua/main_game.lua +++ b/src/Lua/main_game.lua @@ -143,7 +143,7 @@ PTSR.default_playervars = { cantparry = false, --this is for the pizzaface parry - saxa parryhitlag = false, --hit lag now parryhitlagtime = 0, --this to make sure about shit - parryhitlagdata = {x=0,y=0,z=0,a=0,momx=0,momy=0,momz=0,on=false}, + parryhitlagdata = {x=0,y=0,z=0,a=0}, hudstuff = PTSR_shallowcopy(PTSR.hudstuff) }