//Borrowed Miguel's core of the hard drop
-- specify the stall duration and downward speed
local pushcharge = 60 -- 3.5 second 
local pushpower = 20 * FRACUNIT
local waitspeed = 0 * FRACUNIT
local pushrang = 320 * FRACUNIT

addHook("ThinkFrame", function()
for player in players.iterate do
-- initialize custom variables
player.charginpush = player.charginpush or false
player.pushchargetime = player.pushchargetime or 0
player.hasPushed = player.hasPushed or false

if player.mo and player.mo.valid and not (gametype == GT_LTMMURDERMYSTERY) and not (gametype == GT_HIDEANDSEEK) and player.mo.skin == "superguide" and P_IsObjectOnGround(player.mo) then
local custom2_pressed = (player.cmd.buttons & BT_CUSTOM2) ~= 0

if custom2_pressed and not player.charginpush and not player.hasPushed then
player.charginpush = true
player.pushchargetime = pushcharge
player.hasPushed = true

-- play the start sound effect for charginpush
S_StartSound(player.mo, sfx_psh)
end

if player.charginpush then
player.mo.momz = 0 * FRACUNIT -- stall vertical movement
P_InstaThrust(player.mo, player.mo.angle, FixedMul(waitspeed, player.mo.scale))

player.pushchargetime = player.pushchargetime - 1
player.mo.state = S_PLAY_SKID

if player.pushchargetime <= 0 then
player.hasPushed = false
player.charginpush = false
P_Telekinesis(player, FixedMul(pushpower, player.mo.scale), FixedMul(pushrang, player.mo.scale))
S_StartSound(player.mo, sfx_gdsh)

end	
end

if P_IsObjectOnGround(player.mo) == false then
player.charginpush = false -- reset the charginpush flag when the player touches down again
player.pushchargetime = 0
player.hasPushed = false -- allow another stall after touching the ground
end
end
end
end)