diff --git a/src/Lua/Hooks/PlayerThinks.lua b/src/Lua/Hooks/PlayerThinks.lua index 1eaf35a..37c3970 100644 --- a/src/Lua/Hooks/PlayerThinks.lua +++ b/src/Lua/Hooks/PlayerThinks.lua @@ -196,9 +196,12 @@ end) -- Parry addHook("PlayerThink", function(player) if not (player and player.mo and player.mo.valid) then return end + if (player.playerstate == PST_DEAD) or (player.exiting) then return end + local cmd = player.cmd local pmo = player.mo local maxpptime = 40 -- haha pp + if not player.ptsr_parry_cooldown then if cmd.buttons & BT_ATTACK then if not player.pre_parry then @@ -209,14 +212,13 @@ addHook("PlayerThink", function(player) } local parried - player.pre_parry = true if player.pre_parry_counter then - if player.pre_parry_counter > maxpptime - 4 then + if player.pre_parry_counter > maxpptime - CV_PTSR.parrytimeframe.value then player.pre_parry_counter = 0 S_StartSound(player.mo, sfx_pzprry) L_SpeedCap(player.mo, 15*FRACUNIT) - player.ptsr_parry_cooldown = TICRATE*3 + player.ptsr_parry_cooldown = CV_PTSR.parrycooldown.value // TODO: Remake this parry animation local parry = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_PT_PARRY) @@ -233,11 +235,9 @@ addHook("PlayerThink", function(player) local anglefromplayer = R_PointToAngle2(foundmobj.x, foundmobj.y, pmo.x, pmo.y) foundmobj.pfstunmomentum = true - foundmobj.pfstuntime = 2*TICRATE - P_SetObjectMomZ(foundmobj, 10*FRACUNIT) - P_InstaThrust(foundmobj, anglefromplayer - ANGLE_180, 20*FRACUNIT) - else - return false + foundmobj.pfstuntime = CV_PTSR.parrystuntime.value + P_SetObjectMomZ(foundmobj, CV_PTSR.parryknockback_z.value) + P_InstaThrust(foundmobj, anglefromplayer - ANGLE_180, CV_PTSR.parryknockback_xy.value) end end end, @@ -265,10 +265,16 @@ addHook("PlayerThink", function(player) if player.ptsr_parry_cooldown then player.ptsr_parry_cooldown = $ - 1 + if not player.ptsr_parry_cooldown then + S_StartSound(player.mo, sfx_ngskid) + local tryparry = P_SpawnGhostMobj(player.mo) + tryparry.color = SKINCOLOR_GOLDENROD + tryparry.fuse = 5 + P_SetScale(tryparry, (3*FRACUNIT)/2) + end end if player.pre_parry_counter then player.pre_parry_counter = $ - 1 end - end) \ No newline at end of file diff --git a/src/Lua/consolethings.lua b/src/Lua/consolethings.lua index 35b7074..192be5a 100644 --- a/src/Lua/consolethings.lua +++ b/src/Lua/consolethings.lua @@ -281,6 +281,40 @@ CV_PTSR.aileash = CV_RegisterVar({ PossibleValue = {MIN = 0, MAX = 25000*FRACUNIT}, }) +CV_PTSR.parrytimeframe = CV_RegisterVar({ + name = "PTSR_parrytimeframe", + defaultvalue = "5", + flags = CV_NETVAR, + PossibleValue = {MIN = 0, MAX = 40}, +}) + +CV_PTSR.parrycooldown = CV_RegisterVar({ + name = "PTSR_parrycooldown", + defaultvalue = "70", + flags = CV_NETVAR, + PossibleValue = {MIN = 0, MAX = 525}, +}) +CV_PTSR.parrystuntime = CV_RegisterVar({ + name = "PTSR_parrystuntime", + defaultvalue = "45", + flags = CV_NETVAR, + PossibleValue = {MIN = 0, MAX = 525}, +}) + +CV_PTSR.parryknockback_xy = CV_RegisterVar({ + name = "PTSR_parryknockback_xy", + defaultvalue = "25", + flags = CV_NETVAR|CV_FLOAT, + PossibleValue = {MIN = 0, MAX = 25000*FRACUNIT}, +}) + +CV_PTSR.parryknockback_z = CV_RegisterVar({ + name = "PTSR_parryknockback_z", + defaultvalue = "15", + flags = CV_NETVAR|CV_FLOAT, + PossibleValue = {MIN = 0, MAX = 25000*FRACUNIT}, +}) + CV_PTSR.pizzastyle = CV_RegisterVar({ name = "PTSR_pizzastyle", defaultvalue = "pizzaface", diff --git a/src/Lua/main_hud.lua b/src/Lua/main_hud.lua index 1e75eee..360eec6 100644 --- a/src/Lua/main_hud.lua +++ b/src/Lua/main_hud.lua @@ -319,12 +319,22 @@ local scoreboard_hud = function(v, player) local commonflags = (V_SNAPTOLEFT|V_SNAPTOTOP) local playernameflags = (_player == consoleplayer) and V_YELLOWMAP or V_GRAYMAP + local playerpingcolor + + if _player.ping < 105 then + playerpingcolor = V_GREENMAP + elseif _player.ping < 200 then + playerpingcolor = V_YELLOWMAP + elseif _player.ping < INT32_MAX then + playerpingcolor = V_REDMAP + end + local _xcoord = 22*FRACUNIT - local _ycoord = 15*FRACUNIT + (i*16*FRACUNIT) + local _ycoord = 15*FRACUNIT + (i*20*FRACUNIT) if i > 10 then _xcoord = $ + 160*FRACUNIT - _ycoord = $ - (10*16*FRACUNIT) + _ycoord = $ - (10*20*FRACUNIT) commonflags = $ & ~V_SNAPTOLEFT commonflags = $ | V_SNAPTORIGHT end @@ -340,10 +350,12 @@ local scoreboard_hud = function(v, player) v.drawScaled(_xcoord - 16*FRACUNIT, _ycoord, FRACUNIT/4, PTSR.r2p(v, "BROKEN"), commonflags|V_20TRANS) end - + local scorewidth = v.stringWidth(tostring(_player.score), (commonflags|playernameflags)) + local scoreandpingwidth = v.stringWidth(tostring(_player.score)..tostring(_player.ping), (commonflags)) + -- [ Bar Things] -- v.drawFill(0, 25, 640, 1, V_SNAPTOTOP+V_SNAPTOLEFT) -- bar - v.drawFill(160, 25, 1, 640, V_SNAPTOTOP) + --v.drawFill(160, 25, 1, 640, V_SNAPTOTOP) -- [Player Name] -- v.drawString( _xcoord + 16*FRACUNIT, _ycoord, _player.name, (commonflags|playernameflags), "thin-fixed") @@ -351,6 +363,8 @@ local scoreboard_hud = function(v, player) -- [Player Score] -- v.drawString(_xcoord + 16*FRACUNIT, _ycoord + 8*FRACUNIT, tostring(_player.score), (commonflags), "thin-fixed") + v.drawString( _xcoord +8*FRACUNIT+(scorewidth*FU), _ycoord+8*FRACUNIT, _player.ping.."ms", (commonflags|playerpingcolor), "thin-fixed") + v.drawString( _xcoord +16*FRACUNIT+(scoreandpingwidth*FU), _ycoord+8*FRACUNIT, "laps: ".._player.lapsdid, (commonflags), "thin-fixed") --v.drawString(int x, int y, string text, [int flags, [string align]]) end