Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiskster committed Nov 18, 2023
1 parent 786df38 commit 9520d09
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 13 deletions.
24 changes: 15 additions & 9 deletions src/Lua/Hooks/PlayerThinks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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)
34 changes: 34 additions & 0 deletions src/Lua/consolethings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 18 additions & 4 deletions src/Lua/main_hud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -340,17 +350,21 @@ 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")

-- [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

Expand Down

0 comments on commit 9520d09

Please sign in to comment.